Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4489236

Error when persisting JLabel objects containing icons with XMLEncoder/XMLDecoder

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • client-libs
    • beta3
    • x86
    • windows_2000



      Name: bsC130419 Date: 08/07/2001


      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)


      Compile and run the following code:

      import java.beans.*;
      import java.io.*;
      import javax.swing.*;

      public class Test
      {
          public static void main( String[] args )
          {
      try
      {
      JPanel lPanel = new JPanel();
      JLabel lLabel = new JLabel(new ImageIcon("Test.gif"));
      lPanel.add(lLabel);

      XMLEncoder e = new XMLEncoder(
      new BufferedOutputStream(
               new FileOutputStream("Test.xml")));
              e.writeObject(lPanel);
              e.close();
      }
      catch(Exception e)
      {
      e.printStackTrace();
      }
          }
      }

      An error message results:

      java.lang.NullPointerException
      Continuing ...
      java.lang.RuntimeException: failed to evaluate: <unbound>=ImageIcon.new(null);
      Continuing ...

      Note: So far, this message ONLY appears when attempting to persist JLabel
      objects with an icon defined.
      (Review ID: 129541)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: