src/java.base/share/classes/com/sun/crypto/provider/DHPublicKey.java

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

@@ -258,20 +258,22 @@
     }
 
     public String toString() {
         String LINE_SEP = System.getProperty("line.separator");
 
-        StringBuilder sb
-            = new StringBuilder("SunJCE Diffie-Hellman Public Key:"
-                               + LINE_SEP + "y:" + LINE_SEP
-                               + Debug.toHexString(this.y)
-                               + LINE_SEP + "p:" + LINE_SEP
-                               + Debug.toHexString(this.p)
-                               + LINE_SEP + "g:" + LINE_SEP
-                               + Debug.toHexString(this.g));
-        if (this.l != 0)
-            sb.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
+        StringBuilder sb = new StringBuilder();
+        sb.append("SunJCE Diffie-Hellman Public Key:").append(LINE_SEP)
+                .append("y:").append(LINE_SEP)
+                .append(Debug.toHexString(this.y)).append(LINE_SEP)
+                .append("p:").append(LINE_SEP)
+                .append(Debug.toHexString(this.p))
+                .append(LINE_SEP).append("g:").append(LINE_SEP)
+                .append(Debug.toHexString(this.g));
+        if (this.l != 0) {
+            sb.append(LINE_SEP).append("l:").append(LINE_SEP).append("    ")
+                    .append(this.l);
+        }
         return sb.toString();
     }
 
     private void parseKeyBits() throws InvalidKeyException {
         try {