JDK-4941591 : REGRESSION: 4 JCK1.5-runtime api/javax_naming/... tests fail
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris_2.6
  • CPU: generic,sparc
  • Submitted: 2003-10-22
  • Updated: 2004-01-15
  • Resolved: 2003-12-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b32Fixed
Related Reports
Duplicate :  
Relates :  
Description

Name: mmR10223			Date: 10/22/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0-b24 (passes using JDK1.5.0-b23, JDK1.4.2-b28)
JCK            : JCK1.5-runtime (b06)
Platform[s]    : all
switch/Mode    : default
JCK test owner : http://javaweb.eng/jck/usr/owners.jto
Falling test[s]: 
        api/javax_naming/spi/ResolveResult/serial/index.html#Constructor [serial2001]
        api/javax_naming/LinkException/serial/index.html#Constructor [serial2001, serial2002, serial2003]
	api/javax_naming/NamingException/serial/index.html#Constructor [serial2001, serial2002, serial2003]
	api/javax_naming/CannotProceedException/serial/index.html#Constructor
 
These tests fail using JDK1.5.0-b24 on all platforms with java.lang.IllegalArgumentException:

1. For api/javax_naming/spi/ResolveResult/serial/index.html#Constructor

java.lang.IllegalArgumentException: Invalid field: javax.naming.Name remainingName
	at javasoft.sqe.serial.StreamObject.getObjectField(StreamObject.java:556)
	...

2. For api/javax_naming/LinkException/serial/index.html#Constructor

java.lang.IllegalArgumentException: Invalid field: javax.naming.Name linkRemainingName
	at javasoft.sqe.serial.StreamObject.getObjectField(StreamObject.java:556)
	...

3. For api/javax_naming/NamingException/serial/index.html#Constructo

java.lang.IllegalArgumentException: Invalid field: javax.naming.Name remainingName
	at javasoft.sqe.serial.StreamObject.getObjectField(StreamObject.java:556)
	...

4. For api/javax_naming/CannotProceedException/serial/index.html#Constructor

java.lang.IllegalArgumentException: Invalid field: javax.naming.Name altName
	at javasoft.sqe.serial.StreamObject.getObjectField(StreamObject.java:556
	...


Test source location:
=====================
/java/re/jck/1.5/promoted/latest/binaries/JCK-runtime-15/tests/api/javax_naming/spi/ResolveResult/serial/ConstructorTests.java
/java/re/jck/1.5/promoted/latest/binaries/JCK-runtime-15/tests/api/javax_naming/LinkException/serial/ConstructorTests.java
/java/re/jck/1.5/promoted/latest/binaries/JCK-runtime-15/tests/api/javax_naming/NamingException/serial/ConstructorTests.java
/java/re/jck/1.5/promoted/latest/binaries/JCK-runtime-15/tests/api/javax_naming/CannotProceedException/serial/ConstructorTests.java

jtr file location:
==================
/net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b24/jck15/sparc/sol10_sparc_gnome_plugin_ns6.1_linux-8/workDir/api/javax_naming/spi/ResolveResult/serial/index_Constructor.jtr
/net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b24/jck15/sparc/sol10_sparc_gnome_plugin_ns6.1_linux-8/workDir/api/javax_naming/LinkException/serial/index_Constructor.jtr
/net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b24/jck15/sparc/sol10_sparc_gnome_plugin_ns6.1_linux-8/workDir/api/javax_naming/NamingException/serial/index_Constructor.jtr
/net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b24/jck15/sparc/sol10_sparc_gnome_plugin_ns6.1_linux-8/workDir/api/javax_naming/CannotProceedException/serial/index_Constructor.jtr

How to reproduce:
=================
Run the following script (you may need to change its variables)
 
--- script start ---
#!/bin/bash

#Paths in Java Software:
JDK="/java/re/jdk/1.5.0/promoted/all/b24/binaries/solaris-sparc"
JCK="/java/re/jck/1.5/promoted/beta/b06/binaries/JCK-runtime-15"

#Alternative paths outside Java Software:
#JDK="/net/koori.sfbay/onestop/jdk/1.5.0/promoted/all/b24/binaries/solaris-sparc"
#JCK="/net/koori.sfbay/onestop/jck/1.5/promoted/beta/b06/binaries/JCK-runtime-15"

#Alternative paths for the NSK site:
#JCK="/net/linux-15/export/home/java/jck1.5/JCK-runtime-15"
#JDK="/net/linux-15/export/home/java/jdk1.5.0/sparc"

CLASSPATH="$JCK/classes:$JCK/lib/javatest.jar"
 
$JDK/bin/java $switches -cp $CLASSPATH javasoft.sqe.tests.api.javax.naming.spi.ResolveResult.serial.ConstructorTests -TestCaseID serial2001

--- script end ---

Test output:
============
java.lang.IllegalArgumentException: Invalid field: javax.naming.Name remainingName
	at javasoft.sqe.serial.StreamObject.getObjectField(StreamObject.java:556)
	at javasoft.sqe.tests.api.javax.naming.spi.ResolveResult.serial.ConstructorTests.serial2001(ConstructorTests.java:86)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
	at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
	at com.sun.jck.lib.ExecJCKTestSameJVMCmd$Version2Test.execute(ExecJCKTestSameJVMCmd.java:372)
	at com.sun.jck.lib.ExecJCKTestSameJVMCmd$StandardTest.run(ExecJCKTestSameJVMCmd.java:317)
	at com.sun.jck.lib.ExecJCKTestSameJVMCmd.execute(ExecJCKTestSameJVMCmd.java:194)
	at com.sun.jck.lib.ExecJCKTestSameJVMCmd.run(ExecJCKTestSameJVMCmd.java:125)
	at com.sun.javatest.agent.Agent$Task.executeCommand(Agent.java:818)
	at com.sun.javatest.agent.Agent$Task.execute(Agent.java:749)
	at com.sun.javatest.agent.Agent$Task.handleRequest(Agent.java:610)
	at com.sun.javatest.agent.Agent.handleRequestsUntilClosed(Agent.java:379)
	at com.sun.javatest.agent.Agent.access$000(Agent.java:43)
	at com.sun.javatest.agent.Agent$1.run(Agent.java:255)
	at java.lang.Thread.run(Thread.java:549)
serial2001: Failed. Test case throws exception: java.lang.IllegalArgumentException: Invalid field: javax.naming.Name remainingName
result: Failed. test cases: 1; all failed; first test case failure: serial2001


test result: Failed. test cases: 1; all failed; first test case failure: serial2001



Specific machine info:
======================
Hostname: linux-19
OS: Windows 2003
Hostname: linux-22
OS: RedHat Linux 9.0 (GNOME)
Hostname: linux-4
OS: SuSE SLES 8
Hostname: linux-6
OS: Solaris 9 (x86) (CDE)
Hostname: linux-8
OS: Solaris 10 (sparc) (CDE)

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b32 tiger-beta VERIFIED IN: tiger-beta
02-09-2004

EVALUATION While the investigation for this bug is still under progress, below is the update on our current findings. The JCK failures are seen since the integration of the fix to: 4912487: javax.naming.Name should extend Comparable This is a single line fix to the javax.naming.Name class to extend from Comparable interface (CompareTo method was already defined): < public interface Name extends Cloneable, java.io.Serializable { > public interface Name extends Cloneable, java.io.Serializable, Comparable { Extending the Comparable interface is breaking the serialization compatibility tests of the JCK testsuite. However, a program using the default serialization under the same constraints works fine. The JCK tests pass when a serialVersionUID is generated for the Name interface. My understanding is that defining the serialVersionUID for the interfaces is not needed to retain the compatibility with the older versions of the interfaces. I again verified it by comparing the serialized form (generated with default write methods) of both old and new Name interfaces. The files containing the serialized form of both Name classes match byte by byte. The serial form doesn't contain the type information for the interface reference (as they are null). Hence the class description or the serialVesionUID doesn't get recorded. I am not convinced if adding the serialVersionUID to the Name interface is the right thing to do here. Further more, ###@###.### pointed out a potential problem with adding of serialVersionUID to the Name interface: "the Adding this field potentially cause problems for classes that implement Name but don't define their own serialVersionUID fields. They'll inherit this value, and it'll be wrong. I think to make further investigation on the reason for test failures, it would be of help if we get assistance from the JCK engineers in understanding the JCK tests that have failed. ###@###.### 2003-10-24 Name: ygR10224 Date: 10/24/2003 Java ObjectSerialization Specification, ch. 4.6 "Stream Unique Identifiers" says: "... The stream-unique identifier is a 64-bit hash of the class name, interface class names, methods, and fields. The value must be declared in all versions of a class except the first. It may be declared in the original class but is not required. The value is fixed for all compatible classes. ... ... The serialVersionUID is computed using the signature of a stream of bytes that reflect the class definition. The National Institute of Standards and Technology (NIST) Secure Hash Algorithm (SHA-1) is used to compute a signature for the stream. The first two 32-bit quantities are used to form a 64-bit hash. A java.lang.DataOutputStream is used to convert primitive data types to a sequence of bytes. The values input to the stream are defined by the Java" Virtual Machine (VM) specification for classes. The sequence of items in the stream is as follows: 1. The class name written using UTF encoding. 2. The class modifiers written as a 32-bit integer. 3. The name of each interface sorted by name written using UTF encoding. ..." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is clear that after the integration of the fix for 4912487 ("javax.naming.Name should extend Comparable") the serialVersionUID of javax.naming.Name has been changed incompatibly: <gyi@helmet(pts/2).860> /set/java/jdk1.5.0/solaris/bin/java -version java version "1.5.0-beta" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b25) Java HotSpot(TM) Client VM (build 1.5.0-beta-b25, mixed mode) <gyi@helmet(pts/2).861> /set/java/jdk1.5.0/solaris/bin/serialver javax.naming.Name javax.naming.Name: static final long serialVersionUID = -3420508244076200191L; The correct serialVersionUID should be this one that was released previously in JDK 1.3.X/1.4.X: <gyi@helmet(pts/2).857> /set/java/jdk1.4.2/solaris/bin/java -version java version "1.4.2-rc" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-rc-b25) Java HotSpot(TM) Client VM (build 1.4.2-rc-b25, mixed mode) <gyi@helmet(pts/2).858> /set/java/jdk1.4.2/solaris/bin/serialver javax.naming.Name javax.naming.Name: static final long serialVersionUID = -3617482732056931635L; Please add the correct "private static final long serialVersionUID = -3617482732056931635L;" constant to the interface javax.naming.Name to make its compatible across J2SE versions. ====================================================================== That's correct that the serialVersionUID has changed for Name interface since tiger-b24. We can add the backward compatibility serialVersionUID value to the Name interface. That will enable the JCK tests pass, but it really won't have any impact on the serialization as such as Name is an interface. I wonder if JCK tests should test for serialVersionUID in-compatibility for interfaces and abstract classes. As far as the other doubt (of ours) is concerned, adding serialVersionUID won't impact the classes that implement Name interface but doesn't define their own serialVersionUID fields. The inherited serialVersionUID is not taken into consideration during serialization. ###@###.### 2003-10-29
29-10-2003