src/java.base/share/classes/sun/security/provider/PolicyFile.java

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

@@ -1493,17 +1493,17 @@
 
             // expand SELF
             Iterator<PolicyParser.PrincipalEntry> pli = entryPs.iterator();
             while (pli.hasNext()) {
                 PolicyParser.PrincipalEntry pppe = pli.next();
-                String[][] principalInfo = getPrincipalInfo(pppe,pdp);
+                String[][] principalInfo = getPrincipalInfo(pppe, pdp);
                 for (int i = 0; i < principalInfo.length; i++) {
                     if (i != 0) {
                         sb.append(", ");
                     }
-                    sb.append(principalInfo[i][0] + " " +
-                        "\"" + principalInfo[i][1] + "\"");
+                    sb.append(principalInfo[i][0]).append(' ').append('"')
+                            .append(principalInfo[i][1]).append('"');
                 }
                 if (pli.hasNext()) {
                     sb.append(", ");
                 }
             }

@@ -1772,21 +1772,21 @@
 
     private String printPD(ProtectionDomain pd) {
         Principal[] principals = pd.getPrincipals();
         String pals = "<no principals>";
         if (principals != null && principals.length > 0) {
-            StringBuilder palBuf = new StringBuilder("(principals ");
+            StringBuilder palSB = new StringBuilder("(principals ");
             for (int i = 0; i < principals.length; i++) {
-                palBuf.append(principals[i].getClass().getName() +
-                              " \"" + principals[i].getName() +
-                              "\"");
+                palSB.append(principals[i].getClass().getName())
+                        .append(" \"").append(principals[i].getName())
+                        .append('"');
                 if (i < principals.length-1)
-                    palBuf.append(", ");
+                    palSB.append(", ");
                 else
-                    palBuf.append(")");
+                    palSB.append(')');
             }
-            pals = palBuf.toString();
+            pals = palSB.toString();
         }
         return "PD CodeSource: "
                 + pd.getCodeSource()
                 +"\n\t" + "PD ClassLoader: "
                 + pd.getClassLoader()

@@ -1882,11 +1882,11 @@
                         ("unable.to.perform.substitution.on.alias.suffix"));
                     Object[] source = {value.substring(colonIndex+1)};
                     throw new Exception(form.format(source));
                 }
 
-                sb.append(X500PRINCIPAL + " \"" + suffix + "\"");
+                sb.append(X500PRINCIPAL).append(" \"").append(suffix).append('"');
                 startIndex = e+2;
             } else {
                 MessageFormat form = new MessageFormat
                         (ResourcesMgr.getString
                         ("substitution.value.prefix.unsupported"));