-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
sparc
-
solaris_2.6
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>
-------------------------------------------------------------
======================================================================
- duplicates
-
JDK-4270489 RFE: Some objects, such as AudioFormat, should be Serializable
- Closed
- relates to
-
JDK-4903472 RFE: Mark LineEvent not Serializable
- Closed