Menu

#4 Non-breaking space causes infinite loop

open
nobody
None
5
2009-09-21
2009-09-21
Craig
No

The method tokenizeToArrayList in TokeniserWhitespace.java uses two methods to look at whitespace characters: Character.isWhitespace() and the characters in its delimiters field: "\r\n\t \u00A0". Unfortunately, isWhitespace() does not regard a non-breaking space (\u00A0) as a whitespace character, which ends up causing an infinite loop when tokenising a string.

The fix is to test for a non-breaking space character when testing isWhitespace() on line 116:
if (Character.isWhitespace(ch) || (int)ch == 160) {
curPos++;
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB