Mantis - Resin
Viewing Issue Advanced Details
5540 minor always 10-02-13 13:28 10-03-13 11:48
alex  
ferg  
normal  
closed 4.0.37  
fixed  
none    
none 4.0.38  
0005540: Hessian: NPE deserializing an instance of java.net.InetAddress
rep by Michael Charnoky,
InetAddress addr = InetAddress.getLocalHost();
Object obj = addr;
Class<?> clazz = InetAddress.class;
String file = "hessian-test.ser";

System.out.println("Serializing: "+obj);
FileOutputStream fos = new FileOutputStream(file);
Hessian2Output out = new Hessian2Output(fos);
out.startMessage();
out.writeObject(obj);
out.completeMessage();
out.close();

System.out.println("Deserializing...");
FileInputStream fis = new FileInputStream(file);
Hessian2Input his = new Hessian2Input(fis);
his.startMessage();
Object deserializedObj = his.readObject(clazz);
his.completeMessage();
System.out.println("Done: "+deserializedObj);
java.net.InetAddress:java.lang.NullPointerException
    at
com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:251)
    at
com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:150)
    at
com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2219)
    at
com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1731)
    at
com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1715)
    at nextbus.util.HessianSerialUtils.main(HessianSerialUtils.java:125)
Caused by: java.lang.NullPointerException
    at java.net.InetAddress.readResolve(InetAddress.java:287)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at
com.caucho.hessian.io.UnsafeDeserializer.resolve(UnsafeDeserializer.java:291)
    at
com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:242)

Notes
(0006329)
ferg   
10-03-13 11:48   
hessian/3bbd