changeset 7862:e6c94a202bfd

7173873: JFrame.setDefaultCloseOperation(EXIT_ON_CLOSE) will never lead to SE if EXIT_ON_CLOSE is already set Reviewed-by: malenkov, serb
author alexsch
date Fri, 15 Feb 2013 14:24:42 +0400
parents c95dc15ac183
children 4bf242def958
files src/share/classes/javax/swing/JFrame.java
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/JFrame.java	Wed Feb 13 12:38:28 2013 -0800
+++ b/src/share/classes/javax/swing/JFrame.java	Fri Feb 15 14:24:42 2013 +0400
@@ -387,13 +387,14 @@
             operation != EXIT_ON_CLOSE) {
             throw new IllegalArgumentException("defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, DISPOSE_ON_CLOSE, or EXIT_ON_CLOSE");
         }
+
+        if (operation == EXIT_ON_CLOSE) {
+            SecurityManager security = System.getSecurityManager();
+            if (security != null) {
+                security.checkExit(0);
+            }
+        }
         if (this.defaultCloseOperation != operation) {
-            if (operation == EXIT_ON_CLOSE) {
-                SecurityManager security = System.getSecurityManager();
-                if (security != null) {
-                    security.checkExit(0);
-                }
-            }
             int oldValue = this.defaultCloseOperation;
             this.defaultCloseOperation = operation;
             firePropertyChange("defaultCloseOperation", oldValue, operation);