-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta
-
sparc
-
solaris_2.6
-
Verified
Name: rmT116609 Date: 05/09/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 :
Solaris 2.6
A DESCRIPTION OF THE PROBLEM :
The Collections framework has been modified in 1.4. Specifically, a call to Collections.unmodifiableList() will now return either:
an instance of UnmodifiableList (as per 1.3)
or
an instance of UnmodifiableRandomAccessList (if the underlying List implements RandomAccess).
This latter class is not present in 1.3.
This can lead to unmarshalling/ClassNotFound errors when serializing an instance of UnmodifiableList from a 1.4 JVM to a 1.3 JVM.
There appears to be no reference to this anywhere in the compatibility/release notes for 1.4.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. As given in the description box.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.rmi.ServerException: RemoteException occurred in server thread; nested
exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException:
java.util.Collections$UnmodifiableRandomAccessList
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class TheUnmodifiable {
public static void main(String[] args) {
System.out.println(java.util.Collections.unmodifiableList(new
java.util.ArrayList()).getClass().getName());
}
}
Compile this and run it on 1.3.x and 1.4. The outputs are different.
---------- END SOURCE ----------
With JDK1.3.1_03:
-----------------
$java TheUnmodifiable
java.util.Collections$UnmodifiableList
With JDK1.4.0:
---------------
$java TheUnmodifiable
java.util.Collections$UnmodifiableRandomAccessList
CUSTOMER WORKAROUND :
The only workaround is not to use Collections.unmodifiableList().
(Review ID: 146368)
======================================================================