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

PropertyEditorManager.findEditor(String.class) returns null under Web Start

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Linux cay-t41p 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      PropertyEditorManager.findEditor(String.class) returns null under Web Start, ditto for java.awt.Color.class and java.awt.Font.class. Without Web Start, these calls return editors in the sun.beans.editors package.

      Curiously (or perhaps not so curiously), requesting an editor for int.class, boolean.class, etc. works fine under Web Start.

      The fix might be to simply add the three editors to the registry map in PropertyEditorManager.initialize.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Compile the program:

      javac Test.java

      2) Make a file test.mf with the line

      Main-Class: Test

      3) Make a JAR file:

      jar cvfm test.jar test.mf Test.class

      4) Run standalone:

      java -jar test.jar.

      You get sun.beans.editors.StringEditor

      5) Make a JNLP file test.jnlp:


      <jnlp
        spec="1.0+"
        codebase="file:."
        href="test.jnlp">
        <information>
          <title>Oh no!</title>
          <vendor>A Frustrated Vendor</vendor>
          <description>Yet another Web Start Bug</description>
          <offline-allowed/>
        </information>
        <resources>
          <j2se version="1.4+"/>
          <jar href="test.jar"/>
        </resources>
        <application-desc/>
      </jnlp>

      6) To run in Web Start, run

      javaws test.jnlp.

      You get null.

      7) Tear hair, gnash teeth, ...

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Get sun.beans.editors.StringEditor
      ACTUAL -
      Get null under Web Start.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.beans.*;

      public class Test
      {
         public static void main(String[] args) throws Exception
         {
            JOptionPane.showMessageDialog(null, "" + PropertyEditorManager.findEditor(Stringe.class));
         }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      1) Supply my own StringEditor.

      2) Require the user to accept "All Permission".

      Of course, 2) was a joke. I use WebStart so that users can SAFELY try out my application without having to accept a certificate.

            malenkov Sergey Malenkov (Inactive)
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: