{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"open","user":{"avatar_url":"https://secure.gravatar.com/avatar/51186b9dc99c617166a16f226d524efa?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"51186b9dc99c617166a16f226d524efa","url":"https://api.github.com/users/apetro","login":"apetro","id":952283},"milestone":null,"labels":[],"assignee":null,"updated_at":"2011-11-10T22:07:12Z","closed_at":null,"comments":5,"url":"https://api.github.com/repos/dima767/inspektr/issues/13","body":"Saw this in providing some help with CAS today:\r\n\r\nAuditActionContext constructor IllegalArgumentExceptions-out when arguments, e.g. resourceOperatedUpon, are null\r\n\r\n    assertNotNull(resourceOperatedUpon, \"resourceOperatedUpon cannot be null\");\r\n\r\nThe resulting IllegalArgumentException would be more helpful if it included the rest of the arguments to the constructor, to make it easier for the adopter encountering this exception to figure out what context gave rise to it.\r\n\r\nNot sure whether and how to accomplish this.  Catch the IllegalArgumentException and wrap in an IllegalArgumentException with the fuller context?  \r\n\r\n    public AuditActionContext(final String principal, final String resourceOperatedUpon, final String actionPerformed, final String applicationCode, final Date whenActionWasPerformed, final String clientIpAddress, final String serverIpAddress) {\r\n\r\n      try {\r\n        assertNotNull(principal, \"principal cannot be null\");\r\n        assertNotNull(resourceOperatedUpon, \"resourceOperatedUpon cannot be null\");\r\n        assertNotNull(actionPerformed, \"actionPerformed cannot be null.\");\r\n        assertNotNull(applicationCode, \"applicationCode cannot be null.\");\r\n        assertNotNull(whenActionWasPerformed, \"whenActionPerformed cannot be null.\");\r\n        assertNotNull(clientIpAddress, \"clientIpAddress cannot be null.\");\r\n        assertNotNull(serverIpAddress, \"serverIpAddress cannot be null.\");\r\n      } catch (IllegalArgumentException illegalArgException) {\r\n\r\n        throw new IllegalArgumentException(\"One or more arguments to AuditActionContext constructor were invalid: \" +\r\n         \"principal: \" + principal +\r\n         \"resourceOperatedUpon: \" + resourceOperatedUpon +\r\n         \"actionPerformed: \" + actionPerformed +\r\n         \"applicationCode: \" + applicationCode +\r\n         \"whenActionWasPerformed: \" + whenActionWasPerformed + \r\n         \"clientIpAddress: \" + clientIpAddress + \r\n         \"serverIpAddress: \" + serverIpAddress,\r\n         illegalArgException );\r\n\r\n      }\r\n      ...\r\n    }\r\n\r\n\r\nEnhance the message in each assertNotNull ?\r\n\r\nSomething else?","html_url":"https://github.com/dima767/inspektr/issues/13","title":"AuditActionContext assertNotNulls could yield more helpful IllegalArgumentExceptions","number":13,"id":2198643,"created_at":"2011-11-10T15:01:06Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/b76d385b6c2c645f68195db25db7e424?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b76d385b6c2c645f68195db25db7e424","url":"https://api.github.com/users/SCSU","login":"SCSU","id":1167689},"updated_at":"2011-11-10T22:07:12Z","url":"https://api.github.com/repos/dima767/inspektr/issues/comments/2701922","body":"This is not a pressing issue. It doesn't stop CAS from authenticating users, so I'd say tomorrow is just fine or whenever you have the time.\r\nI'm working with Drew on uPortal stuff for our school. We are still at the unconference site.\r\n\r\nThanks!\r\nKostya\r\n\r\n\r\n-----Original Message-----\r\nFrom: Dmitriy Kopylenko [mailto:reply@reply.github.com] \r\nSent: Thursday, November 10, 2011 4:40 PM\r\nTo: Makarov, Konstantin V.\r\nSubject: Re: [inspektr] AuditActionContext assertNotNulls could yield more helpful IllegalArgumentExceptions (#13)\r\n\r\nIs that a pressing issue at this moment? Are you busy with other stuff? I could get to it tomorrow, or you could do the change if you're not extremely busy, etc. If you want to make a change, sure do that, and also this way we get to practice the git workflow :-) Let me know what's easier for you.\r\n\r\n--- \r\nReply to this email directly or view it on GitHub:\r\nhttps://github.com/dima767/inspektr/issues/13#issuecomment-2701549\r\n","id":2701922,"created_at":"2011-11-10T22:07:12Z"}}