[Bug 109] New: NullPointerException in deserialized AccessEvent.

http://bugzilla.qos.ch/show_bug.cgi?id=109 Summary: NullPointerException in deserialized AccessEvent. Product: logback-access Version: unspecified Platform: All OS/Version: Windows Status: NEW Severity: major Priority: P1 Component: Other AssignedTo: logback-dev@qos.ch ReportedBy: joern@huxhorn.de The following methods throw NPE's in case of deserialized AccessEvents. They should instead retun null. getRequestHeaderNames() buildRequestHeaderMap() buildRequestParameterMap() getResponseHeader(String key) getResponseHeaderNameList() getRequestContent() getStatusCode() (possibly, wrong if condition) getContentLength() (possibly, wrong if condition) getResponseContent() (please check) -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #1 from joern@huxhorn.de 2007-10-24 13:43 ------- Created an attachment (id=12) --> (http://bugzilla.qos.ch/attachment.cgi?id=12&action=view) Returning null instead of NPE. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #2 from joern@huxhorn.de 2007-10-25 11:46 ------- Please see http://bugzilla.qos.ch/show_bug.cgi?id=110 for a patch that fixes additional AccessEvent-problems including the ones from this patch/bug. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 noreply.ceki@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #3 from noreply.ceki@qos.ch 2008-01-25 12:27 ------- I have checked in the fix to this bug. See revisions 1608 and 1609. http://svn.qos.ch/viewvc?view=rev&revision=1608 http://svn.qos.ch/viewvc?view=rev&revision=1609 The idea is to make a copy of the contents of various httpRequest and httpResponse fields (without serializing httpRequest and httpResponse). Also note many converters in the c.q.l.acces.Pattern package cannot deal with null values returned by various get methods in AccessEvent. To make a long story short, I think the aforementioned fix that was just checked in should work fine. I would appreciate if you could give it a try. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #4 from joern@huxhorn.de 2008-01-26 01:31 ------- Created an attachment (id=19) --> (http://bugzilla.qos.ch/attachment.cgi?id=19&action=view) Fixes remaining issues described in comment. - Fixed typo in ServerAdapter and all implementing classes (builResponseHeaderMap()). IDEA did an automatic import cleanup/sort - I hope you don't mind. - Fixed NPE in AccessEvent.buildResponseHeaderMap(). This does only happen if 0.9.8 is sending the event. This change would ease my life a *lot* since our webapp must use 0.9.8 until 0.9.9 is released. - Fixed NPE in AccessEvent.getRequestContent(). -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 joern@huxhorn.de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | ------- Comment #5 from joern@huxhorn.de 2008-01-26 01:39 ------- There are still some issues. The AccessEvent.buildResponseHeaderMap() is just for backwards compatibility against 0.9.8. I think the additional if doesn't hurt, anyway. Beside the problems described in my patch everything works fine. I verified that my patched version works with 0.9.8 events. It's just necessary to handle the Map returned by AccessEvent.getRequestParameterMap() as a Map<String,? extends Object> in the meantime, i.e. until 0.9.9 is officially released. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #6 from joern@huxhorn.de 2008-01-26 02:17 ------- Created an attachment (id=20) --> (http://bugzilla.qos.ch/attachment.cgi?id=20&action=view) Second try ;) I missed some because my code didn't call the methods. AccessEvent.buildResponseHeaderMap() now returns an empty Map if it couldn't obtain one from serverAdapter. Method results int that case: getResponseHeaderNameList => empty list. getResponseHeader => null getResponseHeaderMap => empty map. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 joern@huxhorn.de changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #19 is|0 |1 obsolete| | -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #7 from noreply.ceki@qos.ch 2008-01-28 11:09 ------- Hi Joern, As mentioned in revision 1613, I have not merged the defensive code compensating for the bug in 0.9.8. I understand that is not very helpful to you. In exchange, I propose to release 0.9.9 very soon, say tomorrow morning. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #8 from joern@huxhorn.de 2008-01-28 11:56 ------- Hi Ceki. You don't have to hurry a release, this week is perfectly fine with me. I just didn't know when 0.9.9 could be expected and 0.9.8 was released in August... 0.9.9 in April would have been a problem :) I'll check/verify your latest changes this evening. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #9 from joern@huxhorn.de 2008-01-28 12:10 ------- Ceki, could you please also consider bug #100 and bug #105 for inclusion in 0.9.9? I would prefer to wait another week to get them included. I provided patches for both of them and neither can have a negative impact. Bug #100 is a very nasty one... I can personally live without both patches since I'm currently using my own SocketAppender implementation but other people surely have serious problems because of #100... Thanks, Joern. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #10 from joern@huxhorn.de 2008-01-28 21:34 ------- Sorry, but: java.lang.NullPointerException at ch.qos.logback.access.servlet.Util.isFormUrlEncoded(Util.java:11) at ch.qos.logback.access.spi.AccessEvent.getRequestContent(AccessEvent.java:342) A check against null is definitely needed in both getRequestContent and getResponseContent. I'll add a patch in a moment. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #11 from joern@huxhorn.de 2008-01-28 21:39 ------- Created an attachment (id=21) --> (http://bugzilla.qos.ch/attachment.cgi?id=21&action=view) NPE in getRequestContent & getResponseContent, changed serialVersionUID I changed the serialVersionUID since we changed the signature of Map<String, String[]> requestParameterMap. Otherwise, a previously serialized object is deserialized without error but the requestParameterMap returns a String instead of String[] despite the different type. This results in a ClassCastException. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 ------- Comment #12 from joern@huxhorn.de 2008-03-04 14:49 ------- Hi Ceki, can I expect 0.9.9 including fixes for bug #100, bug #105 and this bug pretty soon? I'm just asking because I hold back a new version of my log viewer until this is resolved. I had to change it so I could check if this bug is fixed (which it still isn't as I commented above) which means that my app now explodes with NPE's when using 0.9.8 and also a deserialization error if 0.9.8 and 0.9.9 are mixed - which is expected since I changed the serialVersionUID. I know, this isn't really your problem, but I wanted to ask again before reverting my app back to 0.9.8 - especially since I have to change back and forth to verify a fix for this bug. Please let me know if I can help somehow... -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=109 noreply.ceki@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #13 from noreply.ceki@qos.ch 2008-03-13 04:29 ------- Thank you for re-opening this report. The NPE issue for getRequestContent and getResponseContent after serialization is fixed in revision 1643. For more details please see http://svn.qos.ch/viewvc?view=rev&revision=1643 I'll cut a milestone release shortly... -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
participants (1)
-
bugzilla-daemon@pixie.qos.ch