-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta2
-
x86, sparc
-
generic, linux, solaris_2.6, windows_98
-
Verified
Name: iaR10016 Date: 06/27/2001
JDK : JDK1.4.0 beta-b69
JCK : JCK1.3a, JCK1.4
Platform[s] : RedHat Linux 6.2, Windows ME, Windows 95, Windows 98
switch/Mode : -client -Xmixed
JCK test owner : http://javaweb.eng/jck/usr/owners.jto
Failing Test : api/java_util/PropertyResourceBundle/index.html#handleGetObject
api/java_util/ListResourceBundle/index.html#handleGetObject
api/java_util/ListResourceBundle/index.html#getKeys
Methods PropertyResourceBundle.handleGetObject(String key) and
ListResourceBundle.handleGetObject(String key) should throw
NullPointerException if "key" parameter is null, but in JDK1.4.0-beta2-b69 the exception
is not thrown.
JavaTM 2 Platform Std. Ed. v1.4.0 Specification reads:
...
public final Object handleGetObject(String key)
Description copied from class: ResourceBundle
Gets an object for the given key from this resource bundle.
Returns null if this resource bundle does not contain an object for the given key.
Specified by: handleGetObject in class ResourceBundle
Following copied from class: java.util.ResourceBundle
Parameters:
key - the key for the desired object
Returns:
the object for the given key, or null
Throws:
NullPointerException - if key is null
...
The following test example demonstrates the bug:
--------- test.java ---------
import java.util.*;
import java.io.StringBufferInputStream;
public class test {
public static void main(String argv[]) {
try {
(new PropertyResourceBundle(new StringBufferInputStream("key=value"))).handleGetObject(null);
System.out.println("NullPointerException was not thrown!");
} catch(Exception e) {
System.out.println(e);
}
}
}
-----------------------------
Sample output is:
...
$ /net/linux-15/export/home/jdk1.4.0/linux/bin/java -version
java version "1.4.0-beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b69)
Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b69, mixed mode)
$
$ /net/linux-15/export/home/jdk1.4.0/linux/bin/java test
NullPointerException was not thrown!
$
...
Test source location:
=====================
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/java_util/PropertyResourceBundle/handleGetObjectTests.java
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/java_util/PropertyResourceBundle/Util.java
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/java_util/ListResourceBundle/handleGetObjectTests.java
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/java_util/ListResourceBundle/getKeysTests.java
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/java_util/ListResourceBundle/PrimitiveBundle.java
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/java_util/ListResourceBundle/Util.java
jtr file location:
==================
/net/jtgb4u4c.eng/export/sail16/results/merlin/b69/jck14/linux/redhat6.2_single_gnome_client_int_debug_linux-14/workDir/api/java_util/PropertyResourceBundle/index_handleGetObject.jtr
/net/jtgb4u4c.eng/export/sail16/results/merlin/b69/jck14/linux/redhat6.2_single_gnome_client_int_debug_linux-14/workDir/api/java_util/ListResourceBundle/index_handleGetObject.jtr
/net/jtgb4u4c.eng/export/sail16/results/merlin/b69/jck14/linux/redhat6.2_single_gnome_client_int_debug_linux-14/workDir/api/java_util/ListResourceBundle/index_getKeys.jtr
How to reproduce:
====================
Run the following script under RedHat Linux 6.2 (probably, you need to change JCK and JAVA_HOME paths):
--------Script START---------------------
#!/bin/sh
JAVA_HOME=/net/jdk/export/disk8/local.java/jdk1.4/linux-i386
JCK=/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14
export CLASSPATH="$JCK/classes:$JCK/javatest.jar"
executeClass="javasoft.sqe.tests.api.java.util.PropertyResourceBundle.handleGetObjectTests -TestCaseID PropertyResourceBundle1056"
$JAVA_HOME/bin/java ${executeClass}
echo
executeClass="javasoft.sqe.tests.api.java.util.ListResourceBundle.handleGetObjectTests -TestCaseID ListResourceBundle1043"
$JAVA_HOME/bin/java ${executeClass}
---------Script END----------------------
Test output:
=============
PropertyResourceBundle1056: Failed. handleGetObject(key) returned wrong value
handleGetObject(key) return wrong value : nullNullPointerException expected key = nullproperties = "=value0
=value1
key2=value2
key3=value3
key4=value4
"
STATUS:Failed.tests: 1; failed: 1; first test case failure: PropertyResourceBundle1056
ListResourceBundle1043: Failed. handleGetObject(key) returned wrong result : nullNullPointerException expected key = nullcontents = {{java.lang.Object@4d2e5f, value0}, {key, value1}}
STATUS:Failed.tests: 1; failed: 1; first test case failure: ListResourceBundle1043
Specific Machine Info:
=====================
Hostname: linux-14
OS: RedHat Linux 6.2
Hostname: Linux-18
OS: Windows ME
======================================================================
- duplicates
-
JDK-4475831 ListResourceBundle.handleGetObject(null) does not throw NPE
- Closed
- relates to
-
JDK-4485805 ListResourceBundle.getKeys() doesn`t work with null keys
- Closed