TitleUserProfile error when retrieving a Cookie with an empty username
Date14-Nov-2004 18:01:29 EET
Version2.1.120
SubmitterArkub
PageProvider used
CriticalityBadBug
Servlet Container
Browser version
URL
StatusClosedBug
Java version

Hi there,

It looks like when clicking the "login" button with an empty username field, a cookie containing "username=" is set. Then when the method UserProfile.parseStringRepresentation is invoked, the used StringTokenizer crashes sadly by desperately looking for a value token, and the user then get a "java.util.NoSuchElementException java.util.StringTokenizer.nextToken(StringTokenizer.java:259) com.ecyrd.jspwiki.auth.UserProfile.parseStringRepresentation(UserProfile.java:115)" message on every page.

I guess following code should avoid the crash, or the Cookie might not be set when no username is available.

while( tok.hasMoreTokens() )
{
  String param = tok.nextToken();
  if( param.equals("username") && tok.hasMoreTokens())
  {
     String value = tok.nextToken();
     prof.setName( value );
   }
}

instead of


[...]

String param  = tok.nextToken();
String value  = tok.nextToken();

[...]

jspWiki rocks, thanks for that.

Arkub

Confirmed. Oops.

--JanneJalkanen

Fixed in 2.1.124.

-- JanneJalkanen

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.
« This page (revision-4) was last changed on 01-Dec-2004 23:49 by JanneJalkanen