Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

SOAPFaultException is Serializable, but field fault is not #1216

Open
LanceAndersen opened this issue Apr 12, 2018 · 0 comments
Open

SOAPFaultException is Serializable, but field fault is not #1216

LanceAndersen opened this issue Apr 12, 2018 · 0 comments

Comments

@LanceAndersen
Copy link

This issue is referenced from https://bugs.openjdk.java.net/browse/JDK-8136994

FULL PRODUCT VERSION :
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
Linux 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
javax.xml.ws.soap.SOAPFaultException is Serializable (as all Throwable(s)), but the private field "fault" (class javax.xml.soap.SOAPFault) is not.
This violates the serialization protocol and produces a java.io.NotSerializableException if a SOAPFaultException must be serialized (e.g. because of a remote service call).

ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Serialize a SOAPFaultException.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
serialization should work, without throwing exception.
ACTUAL -
java.io.NotSerializableException: com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.io.;
import javax.xml.soap.
;
import javax.xml.ws.soap.*;

public class SOAPFaultExceptionSerializationTest {

public static void main(String args[]) throws java.lang.Exception { 
    SOAPFaultException exception = new SOAPFaultException(SOAPFactory.newInstance().createFault()); 
    new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(exception); 
} 

}
---------- END SOURCE ----------

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant