History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1498
Type: Sub-task Sub-task
Status: Open Open
Priority: Critical Critical
Assignee: Unassigned
Reporter: Frederic Leitenberger
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
WebWork
Cookie interceptor (WW-1409)

Fix for NullPointer-Exception when using CookieInterceptor an NO Cookies at all are submitted from the client

Created: 11/Apr/08 05:27 AM   Updated: 11/Apr/08 05:30 AM
Component/s: Interceptors
Affects Version/s: 2.2.6
Fix Version/s: None

Environment: any

Flags: Important, Patch


 Description  « Hide
When using the CookieInterceptor and accessing the WebService for the very first time, the very first request fails with an NullPointer-Exception, because there are no cookies present.
After the first request, there is an SessionId-Cookie from Tomcat itself and the error vanishes (normally) ...

The method before(ActionInvocation invocation) accesses the cookies like this:
Cookie cookies[] = request.getCookies();
for (int a = 0; a < cookies.length; a++) {
...

In the case of no Cookies present, the function "request.getCookies()" return null and an NullPointer-Exception is thrown.

The fix is as follows:
Add the following around the for-loop:
if (cookies != null) {
...
}

(I don't know how to create a "CVS-Patch", so s.o. has to put it in there manually ...)

 All   Comments   Change History      Sort Order:
Frederic Leitenberger - [11/Apr/08 05:30 AM ]
Correction:
Affects Version/s: 2.2.7 (and maybe earlier ones too)