Name: gm110360 Date: 06/20/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Windows NT 4.0 (SP 5)
ADDITIONAL OPERATING SYSTEMS :
generic
A DESCRIPTION OF THE PROBLEM :
IllegalArgumentException - not thrown when ncl is not a
registered.
Instead ArrayIndexOutOfBoundsException thrown.
Similar to 4400732 (closed, fixed) which only removes a
listener that is not registerd.
This testcase first adds a listener and then removes one
that is not registered.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. run class Test below
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected:
IllegalArgumentException
Actual:
ArrayIndexOutOfBoundsException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
---------------output------------------------------
Exception thrown = java.lang.ArrayIndexOutOfBoundsException
Test Fail
java.lang.ArrayIndexOutOfBoundsException
at java.util.prefs.AbstractPreferences.removeNodeChangeListener
(AbstractPreferences.java:1083)
at Test.main(Test.java:16)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.prefs.*;
import java.util.*;
public class Test {
public static void main(String[] args) {
try {
Preferences userRoot = Preferences.userRoot();
Preferences N1 = userRoot.node("N1");
userRoot.flush();
NodeChangeListenerTestAdd ncl = new NodeChangeListenerTestAdd();
NodeChangeListenerTestAdd ncl2 = new NodeChangeListenerTestAdd();
//add ncl
N1.addNodeChangeListener(ncl);
//remove ncl2
N1.removeNodeChangeListener(ncl2);
System.out.println("Test Fail");
} catch (IllegalArgumentException iae) {
System.out.println(
"Expected IllegalArgumentException thrown = " + iae + " Test Pass");
} catch (Exception e) {
System.out.println("Exception thrown = " + e);
System.out.println("Test Fail");
e.printStackTrace();
}
}
}
class NodeChangeListenerTestAdd implements NodeChangeListener {
public void childAdded(NodeChangeEvent evt) {
}
public void childRemoved(NodeChangeEvent evt) {
}
}
---------- END SOURCE ----------
(Review ID: 153756)
======================================================================
###@###.### 10/28/04 07:28 GMT
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Windows NT 4.0 (SP 5)
ADDITIONAL OPERATING SYSTEMS :
generic
A DESCRIPTION OF THE PROBLEM :
IllegalArgumentException - not thrown when ncl is not a
registered.
Instead ArrayIndexOutOfBoundsException thrown.
Similar to 4400732 (closed, fixed) which only removes a
listener that is not registerd.
This testcase first adds a listener and then removes one
that is not registered.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. run class Test below
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected:
IllegalArgumentException
Actual:
ArrayIndexOutOfBoundsException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
---------------output------------------------------
Exception thrown = java.lang.ArrayIndexOutOfBoundsException
Test Fail
java.lang.ArrayIndexOutOfBoundsException
at java.util.prefs.AbstractPreferences.removeNodeChangeListener
(AbstractPreferences.java:1083)
at Test.main(Test.java:16)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.prefs.*;
import java.util.*;
public class Test {
public static void main(String[] args) {
try {
Preferences userRoot = Preferences.userRoot();
Preferences N1 = userRoot.node("N1");
userRoot.flush();
NodeChangeListenerTestAdd ncl = new NodeChangeListenerTestAdd();
NodeChangeListenerTestAdd ncl2 = new NodeChangeListenerTestAdd();
//add ncl
N1.addNodeChangeListener(ncl);
//remove ncl2
N1.removeNodeChangeListener(ncl2);
System.out.println("Test Fail");
} catch (IllegalArgumentException iae) {
System.out.println(
"Expected IllegalArgumentException thrown = " + iae + " Test Pass");
} catch (Exception e) {
System.out.println("Exception thrown = " + e);
System.out.println("Test Fail");
e.printStackTrace();
}
}
}
class NodeChangeListenerTestAdd implements NodeChangeListener {
public void childAdded(NodeChangeEvent evt) {
}
public void childRemoved(NodeChangeEvent evt) {
}
}
---------- END SOURCE ----------
(Review ID: 153756)
======================================================================
###@###.### 10/28/04 07:28 GMT