Name: gm110360 Date: 04/11/2002
FULL PRODUCT VERSION :
bash-2.04$ java -version
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
FULL OPERATING SYSTEM VERSION :
Linux niall.rococosoft.com 2.4.17 #4 SMP Tue Jan 29 15:28:00
GMT 2002 i686 unknown
A DESCRIPTION OF THE PROBLEM :
The StringTokenizers constructors which take a delimiter
string do not check if the string is null, causing an
unexpected and inappropriate NullPointerException later when
one of the string tokeniser methods are called.
The javadocs also need to be updated to record this exception.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. javac test.java
2. java -cp . test
3.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I expect a NullPointerException from the constructor,
prevening creation of the object.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
public class test
{
public static void main(String[] args)
throws Throwable
{
StringTokenizer st = new StringTokenizer("foo", null, false);
System.err.println(st.countTokens());
}
}
---------- END SOURCE ----------
(Review ID: 145287)
======================================================================