JDK-6406290 : REGRESSION: XML Persistance Delegate for Insets broken in Mustang B77
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-03-30
  • Updated: 2011-01-19
  • Resolved: 2006-03-30
Related Reports
Duplicate :  
Relates :  
Description
A DESCRIPTION OF THE REGRESSION :
Works in 5.0 but not Mustang b77. Have not tested other builds.

XMLEncoder encoder = new XMLEncoder(new FileOutputStream("C:/temp.txt"));
encoder.writeObject(new Insets(1, 1, 1, 1));

The bug is probably related to 5082816 that got broken in 5.0 beta 2. That bug is confirmed but not fixed. This is a new bug though since this code works in 5.0.

REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
public class TestCase
{
  public static void main(String[] args)
  {
    try {
      XMLEncoder enc = new XMLEncoder(new FileOutputStream("Test.xml"));
      enc.writeObject(new Insets(0, 0, 0, 0));
      enc.close();
    } catch (FileNotFoundException ex) {
      ex.printStackTrace();
    }
  }
}

RELEASE LAST WORKED:
5.0 Update 6

RELEASE TEST FAILS:
mustang-beta

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An XML File
ACTUAL -
java.lang.NoSuchMethodException: java.awt.Insets.getTop()
Continuing ...
java.lang.NoSuchMethodException: java.awt.Insets.getLeft()
Continuing ...
java.lang.NoSuchMethodException: java.awt.Insets.getBottom()
Continuing ...
java.lang.NoSuchMethodException: java.awt.Insets.getRight()
Continuing ...
java.lang.IllegalArgumentException
Continuing ...
java.lang.Exception: XMLEncoder: discarding statement XMLEncoder.writeObject(Insets);

OBSERVED APPLICATION IMPACT:
This will break any application that is using the XMLEncoder/XMLDecoder and with it serializes an Insets() object.