--- old/src/java.base/share/classes/sun/security/provider/PolicyFile.java 2014-08-21 20:45:52.000000000 +0800 +++ new/src/java.base/share/classes/sun/security/provider/PolicyFile.java 2014-08-21 20:45:51.000000000 +0800 @@ -1485,30 +1485,30 @@ } int startIndex = 0; int v; - StringBuilder sb = new StringBuilder(); - while ((v = sp.getSelfName().indexOf(SELF, startIndex)) != -1) { + StringBuilder sb = new StringBuilder(); + while ((v = sp.getSelfName().indexOf(SELF, startIndex)) != -1) { - // add non-SELF string - sb.append(sp.getSelfName().substring(startIndex, v)); + // add non-SELF string + sb.append(sp.getSelfName().substring(startIndex, v)); - // expand SELF - Iterator pli = entryPs.iterator(); - while (pli.hasNext()) { - PolicyParser.PrincipalEntry pppe = pli.next(); - 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] + "\""); - } - if (pli.hasNext()) { - sb.append(", "); - } - } - startIndex = v + SELF.length(); - } + // expand SELF + Iterator pli = entryPs.iterator(); + while (pli.hasNext()) { + PolicyParser.PrincipalEntry pppe = pli.next(); + String[][] principalInfo = getPrincipalInfo(pppe, pdp); + for (int i = 0; i < principalInfo.length; i++) { + if (i != 0) { + sb.append(", "); + } + sb.append(principalInfo[i][0]).append(' ').append('"') + .append(principalInfo[i][1]).append('"'); + } + if (pli.hasNext()) { + sb.append(", "); + } + } + startIndex = v + SELF.length(); + } // add remaining string (might be the entire string) sb.append(sp.getSelfName().substring(startIndex)); @@ -1774,17 +1774,17 @@ Principal[] principals = pd.getPrincipals(); String pals = ""; 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() @@ -1884,7 +1884,7 @@ 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