jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java
changeset 29110 ea89fdd8a5d5
parent 28243 47080f9ae750
child 29111 e9103f166a4a
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Tue Feb 24 12:45:56 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Wed Feb 25 18:30:07 2015 +0800
@@ -3806,14 +3806,15 @@
                             if (item.equals("all")) continue;
 
                             // add or remove
-                            boolean add = true;
-                            // -1, unchanged, 0 crtical, 1 non-critical
+                            boolean add;
+                            // -1, unchanged, 0 critical, 1 non-critical
                             int action = -1;
                             String type = null;
                             if (item.startsWith("-")) {
                                 add = false;
                                 type = item.substring(1);
                             } else {
+                                add = true;
                                 int colonpos = item.indexOf(':');
                                 if (colonpos >= 0) {
                                     type = item.substring(0, colonpos);
@@ -3823,6 +3824,8 @@
                                         throw new Exception(rb.getString
                                             ("Illegal.value.") + item);
                                     }
+                                } else {
+                                    type = item;
                                 }
                             }
                             String n = reqex.getNameByOid(findOidForExtName(type));
@@ -3834,8 +3837,8 @@
                                             e.getExtensionId(),
                                             !e.isCritical(),
                                             e.getExtensionValue());
-                                    ext.set(n, e);
                                 }
+                                ext.set(n, e);
                             } else {
                                 ext.delete(n);
                             }