Name: ygR10224 Date: 09/11/2003
Filed By : SPB JCK team (###@###.###)
JDK : java full version "1.5.0-beta-b18"
JCK : 1.5
Platform[s] : Solaris
switch/Mode :
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] : N/A
Problem description
===================
In spite of the java.net.Inet6Address implementing
the java.io.Serializable interface it can't be serialized
on system which supports IPv6, because this class contains
non-transient and non-static field scope_ifname of non-Serializable
class java.net.NetworkInterface.
Minimized test:
===============
------- Test1.java -------
import java.net.*;
import java.io.*;
public class Test1 {
public static void main(String[] args)
throws IOException, ClassNotFoundException,
SocketException, UnknownHostException
{
Inet6Address obj = null;
byte[] addr = new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
NetworkInterface ni = NetworkInterface.getByInetAddress(
InetAddress.getByName("::1"));
System.out.println(ni);
obj = Inet6Address.getByAddress("::1", addr, ni);
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("i6a1.ser"));
oos.writeObject(obj);
oos.close();
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("i6a1.ser"));
Inet6Address nobj = (Inet6Address) ois.readObject();
if (nobj.equals(obj)) {
System.out.println("PASSED");
} else {
System.out.println("FAILED");
}
}
}
------- end-of-Test1.java -------
Minimized test output:
======================
<gyi@sword(pts/6).267> java -Djava.net.preferIPv6Addresses=true Test1
name:lo0 (lo0) index: 1 addresses:
/0:0:0:0:0:0:0:1;
/127.0.0.1;
Exception in thread "main" java.io.NotSerializableException: java.net.NetworkInterface
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1057)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1335)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1307)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1250)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1055)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
at Test1.main(Test1.java:21)
Specific Machine Info:
=====================
SunOS sword 5.8 Generic_108528-22 sun4u sparc SUNW,Ultra-2
======================================================================