-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0, 5.0
-
generic, x86
-
generic, windows_xp
Name: jl125535 Date: 08/04/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b61)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b61, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The delegate for serializing Matteborder to XML is faulty.
Solution:
Add getTop(), getBottom(), getLeft(), getRight() to EmptyBorder or rewrite delegate.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run code which is just a little modified from your in-JavaDoc example and works for all other beans.
>javac TestCase.java
>java TestCase
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An XML- file
ACTUAL -
An error message.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NoSuchMethodException: javax.swing.border.MatteBorder.getTop()
Continuing ...
java.lang.NoSuchMethodException: javax.swing.border.MatteBorder.getLeft()
Continuing ...
java.lang.NoSuchMethodException: javax.swing.border.MatteBorder.getBottom()
Continuing ...
java.lang.NoSuchMethodException: javax.swing.border.MatteBorder.getRight()
Continuing ...
java.lang.NullPointerException
Continuing ...
java.lang.Exception: discarding statement XMLEncoder0.writeObject(MatteBorder0);
Continuing ...
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.border.MatteBorder;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.beans.XMLEncoder;
public class TestCase
{
public static void main(String[] args)
{
try {
XMLEncoder enc = new XMLEncoder(new FileOutputStream("Test.xml"));
enc.writeObject(new MatteBorder(new Insets(0, 0, 0, 0), Color.BLACK));
enc.close();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Write own delegate.
(Incident Review ID: 289847)
======================================================================
FULL PRODUCT VERSION :
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b61)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b61, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The delegate for serializing Matteborder to XML is faulty.
Solution:
Add getTop(), getBottom(), getLeft(), getRight() to EmptyBorder or rewrite delegate.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run code which is just a little modified from your in-JavaDoc example and works for all other beans.
>javac TestCase.java
>java TestCase
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An XML- file
ACTUAL -
An error message.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NoSuchMethodException: javax.swing.border.MatteBorder.getTop()
Continuing ...
java.lang.NoSuchMethodException: javax.swing.border.MatteBorder.getLeft()
Continuing ...
java.lang.NoSuchMethodException: javax.swing.border.MatteBorder.getBottom()
Continuing ...
java.lang.NoSuchMethodException: javax.swing.border.MatteBorder.getRight()
Continuing ...
java.lang.NullPointerException
Continuing ...
java.lang.Exception: discarding statement XMLEncoder0.writeObject(MatteBorder0);
Continuing ...
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.border.MatteBorder;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.beans.XMLEncoder;
public class TestCase
{
public static void main(String[] args)
{
try {
XMLEncoder enc = new XMLEncoder(new FileOutputStream("Test.xml"));
enc.writeObject(new MatteBorder(new Insets(0, 0, 0, 0), Color.BLACK));
enc.close();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Write own delegate.
(Incident Review ID: 289847)
======================================================================
- duplicates
-
JDK-6402062 LTP: XMLEncoder could not write object of type java.awt.Insets (fails since mustang-b76)
- Closed
- relates to
-
JDK-6406290 REGRESSION: XML Persistance Delegate for Insets broken in Mustang B77
- Closed