Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8136994

SOAPFaultException is Serializable, but field fault is not

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 8u51
    • xml
    • x86_64
    • windows_7

      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 ----------

            aefimov Aleksej Efimov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: