< prev index next >

src/share/classes/sun/security/tools/policytool/PolicyTool.java

Print this page
rev 1461 : 6987827: security/util/Resources.java needs improvement
Reviewed-by: valeriep
rev 1513 : 7194449: String resources for Key Tool and Policy Tool should be in their respective packages
Reviewed-by: alanb, weijun, mullan

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -58,11 +58,12 @@
 
 public class PolicyTool {
 
     // for i18n
     static final java.util.ResourceBundle rb =
-        java.util.ResourceBundle.getBundle("sun.security.util.Resources");
+        java.util.ResourceBundle.getBundle(
+            "sun.security.tools.policytool.Resources");
     static final Collator collator = Collator.getInstance();
     static {
         // this is for case insensitive string comparisons
         collator.setStrength(Collator.PRIMARY);
     };

@@ -226,13 +227,11 @@
                 for (int i = 0; i < signers.length; i++) {
                     PublicKey pubKey = getPublicKeyAlias(signers[i]);
                     if (pubKey == null) {
                         newWarning = true;
                         MessageFormat form = new MessageFormat(rb.getString
-                            ("Warning: A public key for alias " +
-                            "'signers[i]' does not exist.  " +
-                            "Make sure a KeyStore is properly configured."));
+                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
                         Object[] source = {signers[i]};
                         warnings.addElement(form.format(source));
                     }
                 }
             }

@@ -246,11 +245,11 @@
                     verifyPrincipal(pe.getPrincipalClass(),
                                 pe.getPrincipalName());
                 } catch (ClassNotFoundException fnfe) {
                     newWarning = true;
                     MessageFormat form = new MessageFormat(rb.getString
-                                ("Warning: Class not found: class"));
+                                ("Warning.Class.not.found.class"));
                     Object[] source = {pe.getPrincipalClass()};
                     warnings.addElement(form.format(source));
                 }
             }
 

@@ -262,17 +261,17 @@
                 try {
                     verifyPermission(pe.permission, pe.name, pe.action);
                 } catch (ClassNotFoundException fnfe) {
                     newWarning = true;
                     MessageFormat form = new MessageFormat(rb.getString
-                                ("Warning: Class not found: class"));
+                                ("Warning.Class.not.found.class"));
                     Object[] source = {pe.permission};
                     warnings.addElement(form.format(source));
                 } catch (InvocationTargetException ite) {
                     newWarning = true;
                     MessageFormat form = new MessageFormat(rb.getString
-                        ("Warning: Invalid argument(s) for constructor: arg"));
+                        ("Warning.Invalid.argument.s.for.constructor.arg"));
                     Object[] source = {pe.permission};
                     warnings.addElement(form.format(source));
                 }
 
                 // see if all the permission signers have public keys

@@ -283,13 +282,11 @@
                     for (int i = 0; i < signers.length; i++) {
                         PublicKey pubKey = getPublicKeyAlias(signers[i]);
                         if (pubKey == null) {
                             newWarning = true;
                             MessageFormat form = new MessageFormat(rb.getString
-                                ("Warning: A public key for alias " +
-                                "'signers[i]' does not exist.  " +
-                               "Make sure a KeyStore is properly configured."));
+                                ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
                             Object[] source = {signers[i]};
                             warnings.addElement(form.format(source));
                         }
                     }
                 }

@@ -613,11 +610,11 @@
         Class<?> PRIN = Class.forName("java.security.Principal");
         Class<?> pc = Class.forName(type, true,
                 Thread.currentThread().getContextClassLoader());
         if (!PRIN.isAssignableFrom(pc)) {
             MessageFormat form = new MessageFormat(rb.getString
-                        ("Illegal Principal Type: type"));
+                        ("Illegal.Principal.Type.type"));
             Object[] source = {type};
             throw new InstantiationException(form.format(source));
         }
 
         if (ToolDialog.X500_PRIN_CLASS.equals(pc.getName())) {

@@ -692,23 +689,23 @@
             if (collator.compare(flags, "-file") == 0) {
                 if (++n == args.length) usage();
                 policyFileName = args[n];
             } else {
                 MessageFormat form = new MessageFormat(rb.getString
-                                ("Illegal option: option"));
+                                ("Illegal.option.option"));
                 Object[] source = { flags };
                 System.err.println(form.format(source));
                 usage();
             }
         }
     }
 
     static void usage() {
-        System.out.println(rb.getString("Usage: policytool [options]"));
+        System.out.println(rb.getString("Usage.policytool.options."));
         System.out.println();
         System.out.println(rb.getString
-                ("  [-file <file>]    policy file location"));
+                (".file.file.policy.file.location"));
         System.out.println();
 
         System.exit(1);
     }
 

@@ -904,27 +901,27 @@
     public static final String OPEN_POLICY_FILE         =
                         PolicyTool.rb.getString("Open");
     public static final String SAVE_POLICY_FILE         =
                         PolicyTool.rb.getString("Save");
     public static final String SAVE_AS_POLICY_FILE      =
-                        PolicyTool.rb.getString("Save As");
+                        PolicyTool.rb.getString("Save.As");
     public static final String VIEW_WARNINGS            =
-                        PolicyTool.rb.getString("View Warning Log");
+                        PolicyTool.rb.getString("View.Warning.Log");
     public static final String QUIT                     =
                         PolicyTool.rb.getString("Exit");
     public static final String ADD_POLICY_ENTRY         =
-                        PolicyTool.rb.getString("Add Policy Entry");
+                        PolicyTool.rb.getString("Add.Policy.Entry");
     public static final String EDIT_POLICY_ENTRY        =
-                        PolicyTool.rb.getString("Edit Policy Entry");
+                        PolicyTool.rb.getString("Edit.Policy.Entry");
     public static final String REMOVE_POLICY_ENTRY      =
-                        PolicyTool.rb.getString("Remove Policy Entry");
+                        PolicyTool.rb.getString("Remove.Policy.Entry");
     public static final String EDIT_KEYSTORE            =
                         PolicyTool.rb.getString("Edit");
     public static final String ADD_PUBKEY_ALIAS         =
-                        PolicyTool.rb.getString("Add Public Key Alias");
+                        PolicyTool.rb.getString("Add.Public.Key.Alias");
     public static final String REMOVE_PUBKEY_ALIAS      =
-                        PolicyTool.rb.getString("Remove Public Key Alias");
+                        PolicyTool.rb.getString("Remove.Public.Key.Alias");
 
     /* gridbag index for components in the main window (MW) */
     public static final int MW_FILENAME_LABEL           = 0;
     public static final int MW_FILENAME_TEXTFIELD       = 1;
     public static final int MW_PANEL                    = 2;

@@ -969,17 +966,17 @@
         menuBar.add(menu);
         setMenuBar(menuBar);
 
 
         // policy entry listing
-        Label label = new Label(PolicyTool.rb.getString("Policy File:"));
+        Label label = new Label(PolicyTool.rb.getString("Policy.File."));
         addNewComponent(this, label, MW_FILENAME_LABEL,
                         0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                         TOP_BOTTOM_PADDING);
         TextField tf = new TextField(50);
         tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("Policy File:"));
+                PolicyTool.rb.getString("Policy.File."));
         tf.setEditable(false);
         addNewComponent(this, tf, MW_FILENAME_TEXTFIELD,
                         1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                         TOP_BOTTOM_PADDING);
 

@@ -1057,11 +1054,11 @@
             tool.modified = false;
             setVisible(true);
 
             // display the error
             MessageFormat form = new MessageFormat(PolicyTool.rb.getString
-                ("Could not open policy file: policyFile: e.toString()"));
+                ("Could.not.open.policy.file.policyFile.e.toString."));
             Object[] source = {policyFile, e.toString()};
             displayErrorDialog(null, form.format(source));
         }
     }
 

@@ -1134,11 +1131,11 @@
     /**
      * display the main PolicyTool window
      */
     void displayToolWindow(String args[]) {
 
-        setTitle(PolicyTool.rb.getString("Policy Tool"));
+        setTitle(PolicyTool.rb.getString("Policy.Tool"));
         setResizable(true);
         addWindowListener(new ToolWindowListener(this));
         setBounds(135, 80, 500, 500);
         setLayout(new GridBagLayout());
 

@@ -1147,13 +1144,11 @@
         // display it
         setVisible(true);
 
         if (tool.newWarning == true) {
             displayStatusDialog(this, PolicyTool.rb.getString
-                ("Errors have occurred while opening the " +
-                "policy configuration.  View the Warning Log " +
-                "for more information."));
+                ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
         }
     }
 
     /**
      * displays a dialog box describing an error which occurred.

@@ -1232,11 +1227,11 @@
 
         TextArea ta = new TextArea();
         ta.setEditable(false);
         for (int i = 0; i < tool.warnings.size(); i++) {
             ta.append(tool.warnings.elementAt(i));
-            ta.append(PolicyTool.rb.getString("\n"));
+            ta.append(PolicyTool.rb.getString("NEWLINE"));
         }
         addNewComponent(wd, ta, 0,
                         0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                         BOTTOM_PADDING);
         ta.setFocusable(false);

@@ -1333,26 +1328,26 @@
                 "javax.security.auth.x500.X500Principal";
 
     /* popup menus */
     public static final String PERM             =
         PolicyTool.rb.getString
-        ("Permission:                                                       ");
+        ("Permission.");
 
     public static final String PRIN_TYPE        =
-        PolicyTool.rb.getString("Principal Type:");
+        PolicyTool.rb.getString("Principal.Type.");
     public static final String PRIN_NAME        =
-        PolicyTool.rb.getString("Principal Name:");
+        PolicyTool.rb.getString("Principal.Name.");
 
     /* more popu menus */
     public static final String PERM_NAME        =
         PolicyTool.rb.getString
-        ("Target Name:                                                    ");
+        ("Target.Name.");
 
     /* and more popup menus */
     public static final String PERM_ACTIONS             =
       PolicyTool.rb.getString
-      ("Actions:                                                             ");
+      ("Actions.");
 
     /* gridbag index for display OverWriteFile (OW) components */
     public static final int OW_LABEL                    = 0;
     public static final int OW_OK_BUTTON                = 1;
     public static final int OW_CANCEL_BUTTON            = 2;

@@ -1541,11 +1536,11 @@
         setBounds(location.x + 75, location.y + 100, 400, 150);
         setLayout(new GridBagLayout());
 
         // ask the user if they want to over write the existing file
         MessageFormat form = new MessageFormat(PolicyTool.rb.getString
-                ("OK to overwrite existing file filename?"));
+                ("OK.to.overwrite.existing.file.filename."));
         Object[] source = {filename};
         Label label = new Label(form.format(source));
         tw.addNewComponent(this, label, OW_LABEL,
                            0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                            tw.TOP_PADDING);

@@ -1585,16 +1580,16 @@
 
         int listIndex = 0;
         PolicyEntry entries[] = null;
         TaggedList prinList = new TaggedList(3, false);
         prinList.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("Principal List"));
+                PolicyTool.rb.getString("Principal.List"));
         prinList.addActionListener
                 (new EditPrinButtonListener(tool, tw, this, edit));
         TaggedList permList = new TaggedList(10, false);
         permList.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("Permission List"));
+                PolicyTool.rb.getString("Permission.List"));
         permList.addActionListener
                 (new EditPermButtonListener(tool, tw, this, edit));
 
         // find where the PolicyTool gui is
         Point location = tw.getLocationOnScreen();

@@ -1627,61 +1622,61 @@
                 permList.addTaggedItem(ToolDialog.PermissionEntryToUserFriendlyString(nextPerm), nextPerm);
             }
         }
 
         // codebase label and textfield
-        Label label = new Label(PolicyTool.rb.getString("CodeBase:"));
+        Label label = new Label(PolicyTool.rb.getString("CodeBase."));
         tw.addNewComponent(this, label, PE_CODEBASE_LABEL,
                 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
         TextField tf;
         tf = (edit ?
                 new TextField(entries[listIndex].getGrantEntry().codeBase, 60) :
                 new TextField(60));
         tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("Code Base"));
+                PolicyTool.rb.getString("Code.Base"));
         tw.addNewComponent(this, tf, PE_CODEBASE_TEXTFIELD,
                 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
 
         // signedby label and textfield
-        label = new Label(PolicyTool.rb.getString("SignedBy:"));
+        label = new Label(PolicyTool.rb.getString("SignedBy."));
         tw.addNewComponent(this, label, PE_SIGNEDBY_LABEL,
                            0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
         tf = (edit ?
                 new TextField(entries[listIndex].getGrantEntry().signedBy, 60) :
                 new TextField(60));
         tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("Signed By:"));
+                PolicyTool.rb.getString("Signed.By."));
         tw.addNewComponent(this, tf, PE_SIGNEDBY_TEXTFIELD,
                            1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
 
         // panel for principal buttons
         Panel panel = new Panel();
         panel.setLayout(new GridBagLayout());
 
-        Button button = new Button(PolicyTool.rb.getString("Add Principal"));
+        Button button = new Button(PolicyTool.rb.getString("Add.Principal"));
         button.addActionListener
                 (new AddPrinButtonListener(tool, tw, this, edit));
         tw.addNewComponent(panel, button, PE_ADD_PRIN_BUTTON,
                 0, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
 
-        button = new Button(PolicyTool.rb.getString("Edit Principal"));
+        button = new Button(PolicyTool.rb.getString("Edit.Principal"));
         button.addActionListener(new EditPrinButtonListener
                                                 (tool, tw, this, edit));
         tw.addNewComponent(panel, button, PE_EDIT_PRIN_BUTTON,
                 1, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
 
-        button = new Button(PolicyTool.rb.getString("Remove Principal"));
+        button = new Button(PolicyTool.rb.getString("Remove.Principal"));
         button.addActionListener(new RemovePrinButtonListener
                                         (tool, tw, this, edit));
         tw.addNewComponent(panel, button, PE_REMOVE_PRIN_BUTTON,
                 2, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
 
         tw.addNewComponent(this, panel, PE_PANEL0,
                 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.HORIZONTAL);
 
         // principal label and list
-        label = new Label(PolicyTool.rb.getString("Principals:"));
+        label = new Label(PolicyTool.rb.getString("Principals."));
         tw.addNewComponent(this, label, PE_PRIN_LABEL,
                            0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                            ToolWindow.BOTTOM_PADDING);
         tw.addNewComponent(this, prinList, PE_PRIN_LIST,
                            1, 3, 3, 1, 0.0, 0.0, GridBagConstraints.BOTH,

@@ -1689,24 +1684,24 @@
 
         // panel for permission buttons
         panel = new Panel();
         panel.setLayout(new GridBagLayout());
 
-        button = new Button(PolicyTool.rb.getString("  Add Permission"));
+        button = new Button(PolicyTool.rb.getString(".Add.Permission"));
         button.addActionListener(new AddPermButtonListener
                                                 (tool, tw, this, edit));
         tw.addNewComponent(panel, button, PE_ADD_PERM_BUTTON,
                 0, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
 
-        button = new Button(PolicyTool.rb.getString("  Edit Permission"));
+        button = new Button(PolicyTool.rb.getString(".Edit.Permission"));
         button.addActionListener(new EditPermButtonListener
                                                 (tool, tw, this, edit));
         tw.addNewComponent(panel, button, PE_EDIT_PERM_BUTTON,
                 1, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
 
 
-        button = new Button(PolicyTool.rb.getString("Remove Permission"));
+        button = new Button(PolicyTool.rb.getString("Remove.Permission"));
         button.addActionListener(new RemovePermButtonListener
                                         (tool, tw, this, edit));
         tw.addNewComponent(panel, button, PE_REMOVE_PERM_BUTTON,
                 2, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
 

@@ -1808,57 +1803,57 @@
 
         if (mode == EDIT_KEYSTORE) {
 
             // KeyStore label and textfield
             Label label = new Label
-                        (PolicyTool.rb.getString("KeyStore URL:"));
+                        (PolicyTool.rb.getString("KeyStore.URL."));
             tw.addNewComponent(this, label, KSD_NAME_LABEL,
                                0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.BOTTOM_PADDING);
             TextField tf = new TextField(tool.getKeyStoreName(), 30);
 
             // URL to U R L, so that accessibility reader will pronounce well
             tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("KeyStore U R L:"));
+                PolicyTool.rb.getString("KeyStore.U.R.L."));
             tw.addNewComponent(this, tf, KSD_NAME_TEXTFIELD,
                                1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.BOTTOM_PADDING);
 
             // KeyStore type and textfield
-            label = new Label(PolicyTool.rb.getString("KeyStore Type:"));
+            label = new Label(PolicyTool.rb.getString("KeyStore.Type."));
             tw.addNewComponent(this, label, KSD_TYPE_LABEL,
                                0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.BOTTOM_PADDING);
             tf = new TextField(tool.getKeyStoreType(), 30);
             tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("KeyStore Type:"));
+                PolicyTool.rb.getString("KeyStore.Type."));
             tw.addNewComponent(this, tf, KSD_TYPE_TEXTFIELD,
                                1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.BOTTOM_PADDING);
 
             // KeyStore provider and textfield
             label = new Label(PolicyTool.rb.getString
-                                ("KeyStore Provider:"));
+                                ("KeyStore.Provider."));
             tw.addNewComponent(this, label, KSD_PROVIDER_LABEL,
                                0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.BOTTOM_PADDING);
             tf = new TextField(tool.getKeyStoreProvider(), 30);
             tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("KeyStore Provider:"));
+                PolicyTool.rb.getString("KeyStore.Provider."));
             tw.addNewComponent(this, tf, KSD_PROVIDER_TEXTFIELD,
                                1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.BOTTOM_PADDING);
 
             // KeyStore password URL and textfield
             label = new Label(PolicyTool.rb.getString
-                                ("KeyStore Password URL:"));
+                                ("KeyStore.Password.URL."));
             tw.addNewComponent(this, label, KSD_PWD_URL_LABEL,
                                0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.BOTTOM_PADDING);
             tf = new TextField(tool.getKeyStorePwdURL(), 30);
             tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("KeyStore Password U R L:"));
+                PolicyTool.rb.getString("KeyStore.Password.U.R.L."));
             tw.addNewComponent(this, tf, KSD_PWD_URL_TEXTFIELD,
                                1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.BOTTOM_PADDING);
 
             // OK button

@@ -1909,12 +1904,12 @@
         newTD.setLayout(new GridBagLayout());
         newTD.setResizable(true);
 
         // description label
         Label label = (edit ?
-                new Label(PolicyTool.rb.getString("  Edit Principal:")) :
-                new Label(PolicyTool.rb.getString("  Add New Principal:")));
+                new Label(PolicyTool.rb.getString(".Edit.Principal.")) :
+                new Label(PolicyTool.rb.getString(".Add.New.Principal.")));
         tw.addNewComponent(newTD, label, PRD_DESC_LABEL,
                            0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                            ToolWindow.TOP_BOTTOM_PADDING);
 
         // principal choice

@@ -2016,12 +2011,12 @@
         newTD.setLayout(new GridBagLayout());
         newTD.setResizable(true);
 
         // description label
         Label label = (edit ?
-                new Label(PolicyTool.rb.getString("  Edit Permission:")) :
-                new Label(PolicyTool.rb.getString("  Add New Permission:")));
+                new Label(PolicyTool.rb.getString(".Edit.Permission.")) :
+                new Label(PolicyTool.rb.getString(".Add.New.Permission.")));
         tw.addNewComponent(newTD, label, PD_DESC_LABEL,
                            0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                            ToolWindow.TOP_BOTTOM_PADDING);
 
         // permission choice (added in alphabetical order)

@@ -2084,17 +2079,17 @@
         tw.addNewComponent(newTD, tf, PD_ACTIONS_TEXTFIELD,
                            1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                            ToolWindow.LR_PADDING);
 
         // signedby label and textfield
-        label = new Label(PolicyTool.rb.getString("Signed By:"));
+        label = new Label(PolicyTool.rb.getString("Signed.By."));
         tw.addNewComponent(newTD, label, PD_SIGNEDBY_LABEL,
                            0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                            ToolWindow.LR_PADDING);
         tf = (edit ? new TextField(editMe.signedBy, 40) : new TextField(40));
         tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.rb.getString("Signed By:"));
+                PolicyTool.rb.getString("Signed.By."));
         tw.addNewComponent(newTD, tf, PD_SIGNEDBY_TEXTFIELD,
                            1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                            ToolWindow.LR_PADDING);
 
         // OK button

@@ -2135,16 +2130,14 @@
         PolicyParser.PrincipalEntry pppe = null;
 
         if ((pclass.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS)) &&
             (!pname.equals(PolicyParser.PrincipalEntry.WILDCARD_NAME))) {
             throw new Exception
-                        (PolicyTool.rb.getString("Cannot Specify Principal " +
-                        "with a Wildcard Class without a Wildcard Name"));
+                        (PolicyTool.rb.getString("Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name"));
         } else if (pname.equals("")) {
             throw new Exception
-                        (PolicyTool.rb.getString("Cannot Specify Principal " +
-                        "without a Name"));
+                        (PolicyTool.rb.getString("Cannot.Specify.Principal.without.a.Name"));
         } else if (pclass.equals("")) {
             // make this consistent with what PolicyParser does
             // when it sees an empty principal class
             pclass = PolicyParser.REPLACE_NAME;
             tool.warnings.addElement(

@@ -2188,11 +2181,11 @@
         if (tf.getText().trim().equals("") == false)
             name = new String(tf.getText().trim());
         if (permission.equals("") ||
             (!permission.equals(ALL_PERM_CLASS) && name == null)) {
             throw new InvalidParameterException(PolicyTool.rb.getString
-                ("Permission and Target Name must have a value"));
+                ("Permission.and.Target.Name.must.have.a.value"));
         }
 
         // When the permission is FilePermission, we need to check the name
         // to make sure it's not escaped. We believe --
         //

@@ -2205,16 +2198,11 @@
 
         if (permission.equals(FILE_PERM_CLASS) && name.lastIndexOf("\\\\") > 0) {
             char result = tw.displayYesNoDialog(this,
                     PolicyTool.rb.getString("Warning"),
                     PolicyTool.rb.getString(
-                        "Warning: File name may include escaped backslash characters. " +
-                        "It is not necessary to escape backslash characters " +
-                        "(the tool escapes characters as necessary when writing " +
-                        "the policy contents to the persistent store).\n\n" +
-                        "Click on Retain to retain the entered name, or click on " +
-                        "Edit to edit the name."),
+                        "Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes"),
                     PolicyTool.rb.getString("Retain"),
                     PolicyTool.rb.getString("Edit")
                     );
             if (result != 'Y') {
                 // an invisible exception

@@ -2244,13 +2232,11 @@
                 try {
                     PublicKey pubKey = tool.getPublicKeyAlias(signers[i]);
                     if (pubKey == null) {
                         MessageFormat form = new MessageFormat
                             (PolicyTool.rb.getString
-                            ("Warning: A public key for alias " +
-                            "'signers[i]' does not exist.  " +
-                            "Make sure a KeyStore is properly configured."));
+                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
                         Object[] source = {signers[i]};
                         tool.warnings.addElement(form.format(source));
                         tw.displayStatusDialog(this, form.format(source));
                     }
                 } catch (Exception e) {

@@ -2276,11 +2262,11 @@
         setBounds(location.x + 25, location.y + 100, 600, 400);
         setLayout(new GridBagLayout());
 
         // ask the user do they really want to do this?
         Label label = new Label
-                (PolicyTool.rb.getString("Remove this Policy Entry?"));
+                (PolicyTool.rb.getString("Remove.this.Policy.Entry."));
         tw.addNewComponent(this, label, CRPE_LABEL1,
                            0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                            ToolWindow.BOTTOM_PADDING);
 
         // display the policy entry

@@ -2341,11 +2327,11 @@
      */
     void displaySaveAsDialog(int nextEvent) {
 
         // pop up a dialog box for the user to enter a filename.
         FileDialog fd = new FileDialog
-                (tw, PolicyTool.rb.getString("Save As"), FileDialog.SAVE);
+                (tw, PolicyTool.rb.getString("Save.As"), FileDialog.SAVE);
         fd.addWindowListener(new WindowAdapter() {
             public void windowClosing(WindowEvent e) {
                 e.getWindow().setVisible(false);
             }
         });

@@ -2363,20 +2349,20 @@
         // see if the file already exists
         File saveAsFile = new File(filename);
         if (saveAsFile.exists()) {
             // display a dialog box for the user to enter policy info
             ToolDialog td = new ToolDialog
-                (PolicyTool.rb.getString("Overwrite File"), tool, tw, true);
+                (PolicyTool.rb.getString("Overwrite.File"), tool, tw, true);
             td.displayOverWriteFileDialog(filename, nextEvent);
         } else {
             try {
                 // save the policy entries to a file
                 tool.savePolicy(filename);
 
                 // display status
                 MessageFormat form = new MessageFormat(PolicyTool.rb.getString
-                        ("Policy successfully written to filename"));
+                        ("Policy.successfully.written.to.filename"));
                 Object[] source = {filename};
                 tw.displayStatusDialog(null, form.format(source));
 
                 // display the new policy filename
                 TextField newFilename = (TextField)tw.getComponent

@@ -2389,11 +2375,11 @@
                 userSaveContinue(tool, tw, this, nextEvent);
 
             } catch (FileNotFoundException fnfe) {
                 if (filename == null || filename.equals("")) {
                     tw.displayErrorDialog(null, new FileNotFoundException
-                                (PolicyTool.rb.getString("null filename")));
+                                (PolicyTool.rb.getString("null.filename")));
                 } else {
                     tw.displayErrorDialog(null, fnfe);
                 }
             } catch (Exception ee) {
                 tw.displayErrorDialog(null, ee);

@@ -2412,11 +2398,11 @@
             Point location = tw.getLocationOnScreen();
             setBounds(location.x + 75, location.y + 100, 400, 150);
             setLayout(new GridBagLayout());
 
             Label label = new Label
-                (PolicyTool.rb.getString("Save changes?"));
+                (PolicyTool.rb.getString("Save.changes."));
             tw.addNewComponent(this, label, USC_LABEL,
                                0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                                ToolWindow.L_TOP_BOTTOM_PADDING);
 
             Panel panel = new Panel();

@@ -2537,13 +2523,11 @@
                 tw.setVisible(true);
 
                 // inform user of warnings
                 if (tool.newWarning == true) {
                     tw.displayStatusDialog(null, PolicyTool.rb.getString
-                        ("Errors have occurred while opening the " +
-                        "policy configuration.  View the Warning Log " +
-                        "for more information."));
+                        ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
                 }
 
             } catch (Exception e) {
                 // add blank policy listing
                 list = new List(40, false);

@@ -2558,11 +2542,11 @@
                 newFilename.setText("");
                 tw.setVisible(true);
 
                 // display the error
                 MessageFormat form = new MessageFormat(PolicyTool.rb.getString
-                    ("Could not open policy file: policyFile: e.toString()"));
+                    ("Could.not.open.policy.file.policyFile.e.toString."));
                 Object[] source = {policyFile, e.toString()};
                 tw.displayErrorDialog(null, form.format(source));
             }
             break;
         }

@@ -2710,11 +2694,11 @@
 
     public void actionPerformed(ActionEvent e) {
 
         // display the permission list for a policy entry
         ToolDialog td = new ToolDialog
-                (PolicyTool.rb.getString("Policy Entry"), tool, tw, true);
+                (PolicyTool.rb.getString("Policy.Entry"), tool, tw, true);
         td.displayPolicyEntryDialog(true);
     }
 }
 
 /**

@@ -2735,33 +2719,33 @@
         if (PolicyTool.collator.compare(e.getActionCommand(),
                                        ToolWindow.QUIT) == 0) {
 
             // ask user if they want to save changes
             ToolDialog td = new ToolDialog
-                (PolicyTool.rb.getString("Save Changes"), tool, tw, true);
+                (PolicyTool.rb.getString("Save.Changes"), tool, tw, true);
             td.displayUserSave(ToolDialog.QUIT);
 
             // the above method will perform the QUIT as long as the
             // user does not CANCEL the request
 
         } else if (PolicyTool.collator.compare(e.getActionCommand(),
                                    ToolWindow.NEW_POLICY_FILE) == 0) {
 
             // ask user if they want to save changes
             ToolDialog td = new ToolDialog
-                (PolicyTool.rb.getString("Save Changes"), tool, tw, true);
+                (PolicyTool.rb.getString("Save.Changes"), tool, tw, true);
             td.displayUserSave(ToolDialog.NEW);
 
             // the above method will perform the NEW as long as the
             // user does not CANCEL the request
 
         } else if (PolicyTool.collator.compare(e.getActionCommand(),
                                   ToolWindow.OPEN_POLICY_FILE) == 0) {
 
             // ask user if they want to save changes
             ToolDialog td = new ToolDialog
-                (PolicyTool.rb.getString("Save Changes"), tool, tw, true);
+                (PolicyTool.rb.getString("Save.Changes"), tool, tw, true);
             td.displayUserSave(ToolDialog.OPEN);
 
             // the above method will perform the OPEN as long as the
             // user does not CANCEL the request
 

@@ -2774,27 +2758,27 @@
 
             // if there is no filename, do a SAVE_AS
             if (filename == null || filename.length() == 0) {
                 // user wants to SAVE AS
                 ToolDialog td = new ToolDialog
-                        (PolicyTool.rb.getString("Save As"), tool, tw, true);
+                        (PolicyTool.rb.getString("Save.As"), tool, tw, true);
                 td.displaySaveAsDialog(ToolDialog.NOACTION);
             } else {
                 try {
                     // save the policy entries to a file
                     tool.savePolicy(filename);
 
                     // display status
                     MessageFormat form = new MessageFormat
                         (PolicyTool.rb.getString
-                        ("Policy successfully written to filename"));
+                        ("Policy.successfully.written.to.filename"));
                     Object[] source = {filename};
                     tw.displayStatusDialog(null, form.format(source));
                 } catch (FileNotFoundException fnfe) {
                     if (filename == null || filename.equals("")) {
                         tw.displayErrorDialog(null, new FileNotFoundException
-                                (PolicyTool.rb.getString("null filename")));
+                                (PolicyTool.rb.getString("null.filename")));
                     } else {
                         tw.displayErrorDialog(null, fnfe);
                     }
                 } catch (Exception ee) {
                     tw.displayErrorDialog(null, ee);

@@ -2803,11 +2787,11 @@
         } else if (PolicyTool.collator.compare(e.getActionCommand(),
                                ToolWindow.SAVE_AS_POLICY_FILE) == 0) {
 
             // user wants to SAVE AS
             ToolDialog td = new ToolDialog
-                (PolicyTool.rb.getString("Save As"), tool, tw, true);
+                (PolicyTool.rb.getString("Save.As"), tool, tw, true);
             td.displaySaveAsDialog(ToolDialog.NOACTION);
 
         } else if (PolicyTool.collator.compare(e.getActionCommand(),
                                      ToolWindow.VIEW_WARNINGS) == 0) {
             tw.displayWarningLog(null);

@@ -2833,45 +2817,45 @@
         if (PolicyTool.collator.compare(e.getActionCommand(),
                            ToolWindow.ADD_POLICY_ENTRY) == 0) {
 
             // display a dialog box for the user to enter policy info
             ToolDialog td = new ToolDialog
-                (PolicyTool.rb.getString("Policy Entry"), tool, tw, true);
+                (PolicyTool.rb.getString("Policy.Entry"), tool, tw, true);
             td.displayPolicyEntryDialog(false);
 
         } else if (PolicyTool.collator.compare(e.getActionCommand(),
                                ToolWindow.REMOVE_POLICY_ENTRY) == 0) {
 
             // get the selected entry
             List list = (List)tw.getComponent(ToolWindow.MW_POLICY_LIST);
             int index = list.getSelectedIndex();
             if (index < 0) {
                 tw.displayErrorDialog(null, new Exception
-                        (PolicyTool.rb.getString("No Policy Entry selected")));
+                        (PolicyTool.rb.getString("No.Policy.Entry.selected")));
                 return;
             }
 
             // ask the user if they really want to remove the policy entry
             ToolDialog td = new ToolDialog(PolicyTool.rb.getString
-                ("Remove Policy Entry"), tool, tw, true);
+                ("Remove.Policy.Entry"), tool, tw, true);
             td.displayConfirmRemovePolicyEntry();
 
         } else if (PolicyTool.collator.compare(e.getActionCommand(),
                                  ToolWindow.EDIT_POLICY_ENTRY) == 0) {
 
             // get the selected entry
             List list = (List)tw.getComponent(ToolWindow.MW_POLICY_LIST);
             int index = list.getSelectedIndex();
             if (index < 0) {
                 tw.displayErrorDialog(null, new Exception
-                        (PolicyTool.rb.getString("No Policy Entry selected")));
+                        (PolicyTool.rb.getString("No.Policy.Entry.selected")));
                 return;
             }
 
             // display the permission list for a policy entry
             ToolDialog td = new ToolDialog
-                (PolicyTool.rb.getString("Policy Entry"), tool, tw, true);
+                (PolicyTool.rb.getString("Policy.Entry"), tool, tw, true);
             td.displayPolicyEntryDialog(true);
 
         } else if (PolicyTool.collator.compare(e.getActionCommand(),
                                      ToolWindow.EDIT_KEYSTORE) == 0) {
 

@@ -2909,11 +2893,11 @@
             tool.savePolicy(filename);
 
             // display status
             MessageFormat form = new MessageFormat
                 (PolicyTool.rb.getString
-                ("Policy successfully written to filename"));
+                ("Policy.successfully.written.to.filename"));
             Object[] source = {filename};
             tw.displayStatusDialog(null, form.format(source));
 
             // display the new policy filename
             TextField newFilename = (TextField)tw.getComponent

@@ -2928,11 +2912,11 @@
             td.userSaveContinue(tool, tw, td, nextEvent);
 
         } catch (FileNotFoundException fnfe) {
             if (filename == null || filename.equals("")) {
                 tw.displayErrorDialog(null, new FileNotFoundException
-                                (PolicyTool.rb.getString("null filename")));
+                                (PolicyTool.rb.getString("null.filename")));
             } else {
                 tw.displayErrorDialog(null, fnfe);
             }
             td.setVisible(false);
             td.dispose();

@@ -2980,13 +2964,11 @@
                 for (int i = 0; i < signers.length; i++) {
                     PublicKey pubKey = tool.getPublicKeyAlias(signers[i]);
                     if (pubKey == null) {
                         MessageFormat form = new MessageFormat
                             (PolicyTool.rb.getString
-                            ("Warning: A public key for alias " +
-                            "'signers[i]' does not exist.  " +
-                            "Make sure a KeyStore is properly configured."));
+                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
                         Object[] source = {signers[i]};
                         tool.warnings.addElement(form.format(source));
                         tw.displayStatusDialog(td, form.format(source));
                     }
                 }

@@ -3050,11 +3032,11 @@
                         (provider.length() == 0 ? null : provider),
                         (pwdURL.length() == 0 ? null : pwdURL));
             tool.modified = true;
         } catch (Exception ex) {
             MessageFormat form = new MessageFormat(PolicyTool.rb.getString
-                ("Unable to open KeyStore: ex.toString()"));
+                ("Unable.to.open.KeyStore.ex.toString."));
             Object[] source = {ex.toString()};
             tw.displayErrorDialog(td, form.format(source));
             return;
         }
 

@@ -3146,11 +3128,11 @@
                     tool.verifyPrincipal(pppe.getPrincipalClass(),
                                         pppe.getPrincipalName());
                 } catch (ClassNotFoundException cnfe) {
                     MessageFormat form = new MessageFormat
                                 (PolicyTool.rb.getString
-                                ("Warning: Class not found: class"));
+                                ("Warning.Class.not.found.class"));
                     Object[] source = {pppe.getPrincipalClass()};
                     tool.warnings.addElement(form.format(source));
                     tw.displayStatusDialog(infoDialog, form.format(source));
                 }
 

@@ -3207,11 +3189,11 @@
 
             try {
                 tool.verifyPermission(pppe.permission, pppe.name, pppe.action);
             } catch (ClassNotFoundException cnfe) {
                 MessageFormat form = new MessageFormat(PolicyTool.rb.getString
-                                ("Warning: Class not found: class"));
+                                ("Warning.Class.not.found.class"));
                 Object[] source = {pppe.permission};
                 tool.warnings.addElement(form.format(source));
                 tw.displayStatusDialog(infoDialog, form.format(source));
             }
 

@@ -3263,11 +3245,11 @@
                 ToolDialog.PE_PRIN_LIST);
         int prinIndex = prinList.getSelectedIndex();
 
         if (prinIndex < 0) {
             tw.displayErrorDialog(td, new Exception
-                (PolicyTool.rb.getString("No principal selected")));
+                (PolicyTool.rb.getString("No.principal.selected")));
             return;
         }
         // remove the principal from the display
         prinList.removeTaggedItem(prinIndex);
     }

@@ -3298,11 +3280,11 @@
                 ToolDialog.PE_PERM_LIST);
         int permIndex = permList.getSelectedIndex();
 
         if (permIndex < 0) {
             tw.displayErrorDialog(td, new Exception
-                (PolicyTool.rb.getString("No permission selected")));
+                (PolicyTool.rb.getString("No.permission.selected")));
             return;
         }
         // remove the permission from the display
         permList.removeTaggedItem(permIndex);
 

@@ -3340,11 +3322,11 @@
                 ToolDialog.PE_PRIN_LIST);
         int prinIndex = list.getSelectedIndex();
 
         if (prinIndex < 0) {
             tw.displayErrorDialog(td, new Exception
-                (PolicyTool.rb.getString("No principal selected")));
+                (PolicyTool.rb.getString("No.principal.selected")));
             return;
         }
         td.displayPrincipalDialog(editPolicyEntry, true);
     }
 }

@@ -3379,11 +3361,11 @@
         List list = (List)td.getComponent(ToolDialog.PE_PERM_LIST);
         int permIndex = list.getSelectedIndex();
 
         if (permIndex < 0) {
             tw.displayErrorDialog(td, new Exception
-                (PolicyTool.rb.getString("No permission selected")));
+                (PolicyTool.rb.getString("No.permission.selected")));
             return;
         }
         td.displayPermissionDialog(editPolicyEntry, true);
     }
 }

@@ -3681,11 +3663,11 @@
                 tool.savePolicy(filename);
 
                 // display status
                 MessageFormat form = new MessageFormat
                         (PolicyTool.rb.getString
-                        ("Policy successfully written to filename"));
+                        ("Policy.successfully.written.to.filename"));
                 Object[] source = {filename};
                 tw.displayStatusDialog(null, form.format(source));
 
                 // now continue with the originally requested command
                 // (QUIT, NEW, or OPEN)

@@ -3915,11 +3897,11 @@
                 "destroyCredential",
                 "createLoginContext.<" + PolicyTool.rb.getString("name") + ">",
                 "getLoginConfiguration",
                 "setLoginConfiguration",
                 "createLoginConfiguration.<" +
-                        PolicyTool.rb.getString("configuration type") + ">",
+                        PolicyTool.rb.getString("configuration.type") + ">",
                 "refreshLoginConfiguration"
                 },
         null);
     }
 }

@@ -4132,11 +4114,11 @@
                 "setContextClassLoader",
                 "enableContextClassLoaderOverride",
                 "setSecurityManage",
                 "createSecurityManager",
                 "getenv.<" +
-                    PolicyTool.rb.getString("environment variable name") + ">",
+                    PolicyTool.rb.getString("environment.variable.name") + ">",
                 "exitVM",
                 "shutdownHooks",
                 "setFactory",
                 "setIO",
                 "modifyThread",

@@ -4144,15 +4126,15 @@
                 "modifyThreadGroup",
                 "getProtectionDomain",
                 "readFileDescriptor",
                 "writeFileDescriptor",
                 "loadLibrary.<" +
-                    PolicyTool.rb.getString("library name") + ">",
+                    PolicyTool.rb.getString("library.name") + ">",
                 "accessClassInPackage.<" +
-                    PolicyTool.rb.getString("package name")+">",
+                    PolicyTool.rb.getString("package.name")+">",
                 "defineClassInPackage.<" +
-                    PolicyTool.rb.getString("package name")+">",
+                    PolicyTool.rb.getString("package.name")+">",
                 "accessDeclaredMembers",
                 "queuePrintJob",
                 "getStackTrace",
                 "setDefaultUncaughtExceptionHandler",
                 "preferences",

@@ -4171,31 +4153,31 @@
                 "createAccessControlContext",
                 "getDomainCombiner",
                 "getPolicy",
                 "setPolicy",
                 "createPolicy.<" +
-                    PolicyTool.rb.getString("policy type") + ">",
+                    PolicyTool.rb.getString("policy.type") + ">",
                 "getProperty.<" +
-                    PolicyTool.rb.getString("property name") + ">",
+                    PolicyTool.rb.getString("property.name") + ">",
                 "setProperty.<" +
-                    PolicyTool.rb.getString("property name") + ">",
+                    PolicyTool.rb.getString("property.name") + ">",
                 "insertProvider.<" +
-                    PolicyTool.rb.getString("provider name") + ">",
+                    PolicyTool.rb.getString("provider.name") + ">",
                 "removeProvider.<" +
-                    PolicyTool.rb.getString("provider name") + ">",
+                    PolicyTool.rb.getString("provider.name") + ">",
                 //"setSystemScope",
                 //"setIdentityPublicKey",
                 //"setIdentityInfo",
                 //"addIdentityCertificate",
                 //"removeIdentityCertificate",
                 //"printIdentity",
                 "clearProviderProperties.<" +
-                    PolicyTool.rb.getString("provider name") + ">",
+                    PolicyTool.rb.getString("provider.name") + ">",
                 "putProviderProperty.<" +
-                    PolicyTool.rb.getString("provider name") + ">",
+                    PolicyTool.rb.getString("provider.name") + ">",
                 "removeProviderProperty.<" +
-                    PolicyTool.rb.getString("provider name") + ">",
+                    PolicyTool.rb.getString("provider.name") + ">",
                 //"getSignerPrivateKey",
                 //"setSignerKeyPair"
                 },
         null);
     }
< prev index next >