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

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 963                                 grantEntry.signedBy +
 964                                 "\""));
 965 
 966         if (stringEntry.length() == 0)
 967             return new String("CodeBase <ALL>");
 968         return stringEntry;
 969     }
 970 
 971     /**
 972      * convert the Principals portion of this policy entry into a string
 973      */
 974     String principalsToString() {
 975         String result = "";
 976         if ((grantEntry.principals != null) &&
 977             (!grantEntry.principals.isEmpty())) {
 978             StringBuilder sb = new StringBuilder(200);
 979             ListIterator<PolicyParser.PrincipalEntry> list =
 980                                 grantEntry.principals.listIterator();
 981             while (list.hasNext()) {
 982                 PolicyParser.PrincipalEntry pppe = list.next();
 983                 sb.append(" Principal " + pppe.getDisplayClass() + " " +
 984                     pppe.getDisplayName(true));

 985                 if (list.hasNext()) sb.append(", ");
 986             }
 987             result = sb.toString();
 988         }
 989         return result;
 990     }
 991 
 992     /**
 993      * convert this policy entry into a PolicyParser.PermissionEntry
 994      */
 995     PolicyParser.PermissionEntry toPermissionEntry(Permission perm) {
 996 
 997         String actions = null;
 998 
 999         // get the actions
1000         if (perm.getActions() != null &&
1001             perm.getActions().trim() != "")
1002                 actions = perm.getActions();
1003 
1004         PolicyParser.PermissionEntry pe = new PolicyParser.PermissionEntry




 963                                 grantEntry.signedBy +
 964                                 "\""));
 965 
 966         if (stringEntry.length() == 0)
 967             return new String("CodeBase <ALL>");
 968         return stringEntry;
 969     }
 970 
 971     /**
 972      * convert the Principals portion of this policy entry into a string
 973      */
 974     String principalsToString() {
 975         String result = "";
 976         if ((grantEntry.principals != null) &&
 977             (!grantEntry.principals.isEmpty())) {
 978             StringBuilder sb = new StringBuilder(200);
 979             ListIterator<PolicyParser.PrincipalEntry> list =
 980                                 grantEntry.principals.listIterator();
 981             while (list.hasNext()) {
 982                 PolicyParser.PrincipalEntry pppe = list.next();
 983                 sb.append(" Principal ").append(pppe.getDisplayClass())
 984                         .append(' ')
 985                         .append(pppe.getDisplayName(true));
 986                 if (list.hasNext()) sb.append(", ");
 987             }
 988             result = sb.toString();
 989         }
 990         return result;
 991     }
 992 
 993     /**
 994      * convert this policy entry into a PolicyParser.PermissionEntry
 995      */
 996     PolicyParser.PermissionEntry toPermissionEntry(Permission perm) {
 997 
 998         String actions = null;
 999 
1000         // get the actions
1001         if (perm.getActions() != null &&
1002             perm.getActions().trim() != "")
1003                 actions = perm.getActions();
1004 
1005         PolicyParser.PermissionEntry pe = new PolicyParser.PermissionEntry