6806224: PIT : Getting java.lang.NullPointerException while opening Filedialog
authordcherepanov
Thu, 19 Feb 2009 14:10:19 +0300
changeset 2458 f4bee3ba17ee
parent 2457 38ee6f7fd9f8
child 2459 08f3416ff334
6806224: PIT : Getting java.lang.NullPointerException while opening Filedialog Reviewed-by: art, dav
jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Tue Feb 17 14:44:58 2009 +0300
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Thu Feb 19 14:10:19 2009 +0300
@@ -166,7 +166,7 @@
         enableLog.log(Level.FINE, "Initial enable state: {0}", new Object[] {Boolean.valueOf(enabled)});
 
         if (target.isVisible()) {
-            show();
+            setVisible(true);
         }
     }
 
@@ -496,10 +496,6 @@
         xSetVisible(b);
     }
 
-    public void show() {
-        setVisible(true);
-    }
-
     public void hide() {
         setVisible(false);
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java	Tue Feb 17 14:44:58 2009 +0300
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java	Thu Feb 19 14:10:19 2009 +0300
@@ -739,7 +739,17 @@
         this.filter = filter;
     }
 
-    public void show() {
+
+    public void dispose() {
+        FileDialog fd = (FileDialog)fileDialog;
+        if (fd != null) {
+            fd.removeAll();
+        }
+        super.dispose();
+    }
+
+    // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
+    public void setVisible(boolean b){
         if (fileDialog == null) {
             init((FileDialog)target);
         }
@@ -754,34 +764,20 @@
             setFile(savedFile);
         }
 
-        super.show();
-        selectionField.requestFocusInWindow();
-    }
-
-    public void dispose() {
-        FileDialog fd = (FileDialog)fileDialog;
-        if (fd != null) {
-            fd.removeAll();
-        }
-        super.dispose();
-    }
-
-    // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
-    public void setVisible(boolean b){
         super.setVisible(b);
         if (b == true){
             // See 6240074 for more information
             XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
             choicePeer.addXChoicePeerListener(this);
-
             KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
         }else{
             // See 6240074 for more information
             XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
             choicePeer.removeXChoicePeerListener();
-
             KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
         }
+
+        selectionField.requestFocusInWindow();
     }
 
     /*