JDK-4335276 : LineEvent serialization does not work
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 2000-05-03
  • Updated: 2002-10-30
  • Resolved: 2002-10-30
Related Reports
Duplicate :  
Relates :  
Description

Name: ooR10001			Date: 05/03/2000



javax.sound.sampled.LineEvent object could not be serialized,
because it has non-transient and non-static field 'type' of
non-Serializable class javax.sound.sampled.LineEvent.Type.
It caused a problem.
 
The test example to reproduce the bug:
-------------------------------------------------------------
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import javax.sound.sampled.AudioSystem;

public class test {

  public static void main(String[] args) {
    try {

        javax.sound.sampled.LineEvent obj = 
            new javax.sound.sampled.LineEvent(
                AudioSystem.getLine(new javax.sound.sampled.Line$Info(
                javax.sound.sampled.Line.class)),
                javax.sound.sampled.LineEvent$Type.START, 0L);

        FileOutputStream ostream = new FileOutputStream("gold.tmp");
        ObjectOutputStream objos = new ObjectOutputStream(ostream);
        objos.writeObject(obj);
        objos.close();
        System.out.println("OKAY");

    } catch (java.io.IOException e) {
        e.printStackTrace();
    } catch (javax.sound.sampled.LineUnavailableException e) {
    }
  }

}
-------------------------------------------------------------
Test output:

java.io.NotSerializableException: javax.sound.sampled.LineEvent$Type
        at 
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
        at 
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
        at 
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
        at 
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
        at 
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
        at 
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
        at test.main(test.java:18)
<program hangs>
-------------------------------------------------------------
======================================================================

Comments
EVALUATION ###@###.### 2002-10-29 Should be fixed for tiger along with 4270489.
29-10-2002