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

Deserialization of enums in javax.net.ssl.SSLEngineResult fails

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b46
    • CPU:
      sparc
    • OS:
      solaris_2.6
    • Verification:
      Verified

      Description



      Name: ygR10224 Date: 03/15/2004


      Filed By : SPB JCK team (###@###.###)
      JDK :
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] :
          api/javax_net/ssl/SSLEngineResult/HandshakeStatus/serial/index.html#Input
          api/javax_net/ssl/SSLEngineResult/Status/serial/index.html#Input


      Problem description
      ===================
      Deserialization of the following enum classes:

        javax.net.ssl.SSLEngineResult.HandshakeStatus
        javax.net.ssl.SSLEngineResult.Status

      fails since JDK1.5.0-beta2-b40.
          
      Please look at the minimized test that demonstrates the issue
      (Note that this test passes with JDK1.5.0-beta2-b39, b38, b37):

      ------- Test.java -------
      import java.io.*;
      import javax.net.ssl.*;


      public class Test {

          public static void main(String[] args) throws Exception {
          
              if ((args.length == 2)
                      && (args[0].equals("write") || args[0].equals("read"))) {
                  
                  if (args[0].equals("write")) {
                      System.out.println("Serialize to file " + args[1] + " ...");
                      
                      SSLEngineResult.Status obj = SSLEngineResult.Status.OK;
                      
                      ObjectOutputStream oos = new ObjectOutputStream(
                              new FileOutputStream(args[1]));
                      oos.writeObject(obj);
                      oos.flush();
                      oos.close();
                      System.out.println("Passed.");
                  } else if (args[0].equals("read")) {
                      System.out.println("Deserialize from file " + args[1] + " ...");
                      ObjectInputStream ois = new ObjectInputStream(
                              new FileInputStream(args[1]));
                      
                      SSLEngineResult.Status obj =
                              (SSLEngineResult.Status) ois.readObject();
                      
                      ois.close();
                      System.out.println("Passed.");
                  }
              
              } else {
                  System.out.println("Usage:\n java Test write|read filename");
                  System.exit(1);
              }
          
          }
      }

      ------- end-of-Test.java -------

      <gyi@helmet> /net/orion/export/JDK1.5.0b42/solaris-sparc/bin/javac Test.java

      <gyi@helmet> /net/orion/export/JDK1.5.0b42/solaris-sparc/bin/java Test write test.ser
      Serialize to file test.ser ...
      Passed.

      <gyi@helmet> /net/orion/export/JDK1.5.0b42/solaris-sparc/bin/java Test read test.ser
      Deserialize from file test.ser ...
      Exception in thread "main" java.io.InvalidObjectException: enum constant OK does not exist in class javax.net.ssl.SSLEngineResult$Status
              at java.io.ObjectInputStream.readEnum(ObjectInputStream.java:1662)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1293)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
              at Test.main(Test.java:28)
      Caused by: java.lang.IllegalArgumentException: javax.net.ssl.SSLEngineResult$Status is not an enum type
              at java.lang.Class.enumConstantDirectory(Class.java:2533)
              at java.lang.Enum.valueOf(Enum.java:186)
              at java.io.ObjectInputStream.readEnum(ObjectInputStream.java:1660)
              ... 3 more


      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

      Specific Machine Info:
      =====================
      SunOS helmet 5.8 Generic_108528-14 sun4u sparc SUNW,Ultra-2

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            wetmore Bradford Wetmore
            Reporter:
            gyisunw Gyi Gyi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: