eclipse-ee4j / metro-saaj

https://eclipse-ee4j.github.io/metro-saaj/
Other
13 stars 16 forks source link

SOAPFaultException is Serializable, but field fault is not #203

Open Tomas-Kraus opened 2 years ago

Tomas-Kraus commented 2 years ago

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 eclipse-ee4j/metro-jax-ws#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 ----------

Source: https://github.com/javaee/metro-jax-ws/issues/1216 Author: LanceAndersen