|
Quick Lists
|
|
Bug ID:
|
6591151
|
|
Votes
|
0
|
|
Synopsis
|
Serialization problems with javax.swing.plaf.metal.MetalLookAndFeel
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
|
|
Release Fixed
|
7(b20)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
6593607
|
|
Submit Date
|
09-AUG-2007
|
|
Description
|
OPERATING SYSTEM(S):
--------------------
customer Windows XP [Version 5.1.2600]
FULL JDK VERSION(S):
--------------------
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode)
PROBLEM DESCRIPTION:
--------------------
i) java.io.NotSerializableException for MetalLookAndFeel
ii) MarshallException thrown when a new instace of javax.swing.plaf.metal.MetalLookAndFeel is passed to the server
STEPS TO REPRODUCE:
-------------------
i) javac SER1.java
ii) java SER1
EXCEPTION/TRACE
----------------
Exception in thread "main" java.io.NotSerializableException: java.lang.Object
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at SER1.main(SER1.java:7)
TESTCASE DESCRIPTION:
---------------------
import java.io.*;
public class SER1{
public static void main(String[] args) throws Exception{
FileOutputStream fos = new FileOutputStream("t.tmp");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(new javax.swing.plaf.metal.MetalLookAndFeel());
oos.close();
fos.close();
}
}
TECHNICAL ANALYSIS
-------------------
The private member variable in BasicLookAndFeel (private Object audioLock) should be made transient to succeed the above test case.
Posted Date : 2007-08-09 15:18:25.0
|
|
Work Around
|
None
|
|
Evaluation
|
I accepted this bug and verified that the following class
also can't be serialized, so all other Lafs should be checked as well
new BasicLookAndFeel(){
public String getDescription() {
return null;
}
public String getID() {
return null;
}
public String getName() {
return null;
}
public boolean isNativeLookAndFeel() {
return false;
}
public boolean isSupportedLookAndFeel() {
return false;
}
}
Posted Date : 2007-08-17 09:10:15.0
It isn't a regression. The bug exists in every JDK which I have tested: jdk6, jdk5, jdk1.4.
Posted Date : 2007-08-17 09:31:39.0
The bug cause is very simple. BasicLookAndFeel class, which is the base class of MetalLookAndFeel, contains a field of Object type. The Object class doesn't implement Serializable interface. It is the cause.
A solution is to make the field transient. It is safe because the field is private, non-static and it is used only for synchronization purposes.
Posted Date : 2007-08-17 11:06:02.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |