I did one more refactoring in this packages.
diff --git a/src/share/classes/javax/management/openmbean/ArrayType.java b/src/share/classes/javax/management/openmbean/ArrayType.java --- a/src/share/classes/javax/management/openmbean/ArrayType.java +++ b/src/share/classes/javax/management/openmbean/ArrayType.java @@ -459,7 +459,7 @@ isPrimitiveArray = at.isPrimitiveArray(); } StringBuilder result = - new StringBuilder(dimension + "-dimension array of "); + new StringBuilder(dimension).append("-dimension array of "); final String elementClassName = elementType.getClassName(); if (isPrimitiveArray) { // Convert from wrapper type to primitive type diff --git a/src/share/classes/javax/sound/sampled/AudioFileFormat.java b/src/share/classes/javax/sound/sampled/AudioFileFormat.java --- a/src/share/classes/javax/sound/sampled/AudioFileFormat.java +++ b/src/share/classes/javax/sound/sampled/AudioFileFormat.java @@ -288,19 +288,20 @@ //$$fb2002-11-01: fix for 4672864: AudioFileFormat.toString() throws unexpected NullPointerException if (type != null) { - buf.append(type.toString() + " (." + type.getExtension() + ") file"); + buf.append(type.toString()).append(" (.").append(type.getExtension()).append(") file"); + } else { buf.append("unknown file format"); } if (byteLength != AudioSystem.NOT_SPECIFIED) { - buf.append(", byte length: " + byteLength); + buf.append(", byte length: ").append(byteLength); } - buf.append(", data format: " + format); + buf.append(", data format: ").append(format); if (frameLength != AudioSystem.NOT_SPECIFIED) { - buf.append(", frame length: " + frameLength); + buf.append(", frame length: ").append(frameLength); } return new String(buf); diff --git a/src/share/classes/javax/naming/directory/BasicAttribute.java b/src/share/classes/javax/naming/directory/BasicAttribute.java --- a/src/share/classes/javax/naming/directory/BasicAttribute.java +++ b/src/share/classes/javax/naming/directory/BasicAttribute.java @@ -211,7 +211,7 @@ * @return The non-null string representation of this attribute. */ public String toString() { - StringBuffer answer = new StringBuffer(attrID + ": "); + StringBuffer answer = new StringBuffer(attrID).append(": "); if (values.size() == 0) { answer.append("No values"); } else { diff --git a/src/share/classes/javax/naming/BinaryRefAddr.java b/src/share/classes/javax/naming/BinaryRefAddr.java --- a/src/share/classes/javax/naming/BinaryRefAddr.java +++ b/src/share/classes/javax/naming/BinaryRefAddr.java @@ -169,7 +169,7 @@ str.append("AddressContents: "); for (int i = 0; i<buf.length && i < 32; i++) { - str.append(Integer.toHexString(buf[i]) +" "); + str.append(Integer.toHexString(buf[i])).append(' '); } if (buf.length >= 32) str.append(" ...\n"); diff --git a/src/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java b/src/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java --- a/src/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java +++ b/src/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java @@ -197,7 +197,7 @@ */ public String toString() { String ls = System.getProperty("line.separator", "\n"); - StringBuilder sb = new StringBuilder("JPEGQTable:"+ls); + StringBuilder sb = new StringBuilder("JPEGQTable:").append(ls); for (int i=0; i < qTable.length; i++) { if (i % 8 == 0) { sb.append('\t'); diff --git a/src/share/classes/javax/naming/NameImpl.java b/src/share/classes/javax/naming/NameImpl.java --- a/src/share/classes/javax/naming/NameImpl.java +++ b/src/share/classes/javax/naming/NameImpl.java @@ -170,7 +170,7 @@ endQuote = one ? syntaxEndQuote1 : syntaxEndQuote2; i += syntaxTypevalSeparator.length(); - answer.append(syntaxTypevalSeparator+beginQuote); // add back + answer.append(syntaxTypevalSeparator).append(beginQuote); // add back // consume string until matching quote for (i += beginQuote.length(); On Fri, Jun 7, 2013 at 10:25 AM, Otávio Gonçalves de Santana < otavioj...@java.net> wrote: > > The string addition in the parameter will create another string buffer, > append all the components, then convert that to a string so the you can be > appended to your string buffer. > > So I replace this: > > sb.append(" xxx: [" + getXXX() + "]\n"); > > for this: > > sb.append(" xxx: [").append(getXXX()).append("]\n"); > > The classes are: > > javax.imageio.plugins.jpeg.JPEGQTable > javax.management.openmbean.ArrayType > javax.naming.BinaryRefAddr > javax.naming.directory.BasicAttribute > javax.naming.NameImpl > javax.sound.sampled.AudioFileFormat > > > The diff bellow: > > > diff --git a/src/share/classes/javax/management/openmbean/ArrayType.java > b/src/share/classes/javax/management/openmbean/ArrayType.java > --- a/src/share/classes/javax/management/openmbean/ArrayType.java > +++ b/src/share/classes/javax/management/openmbean/ArrayType.java > @@ -459,7 +459,7 @@ > isPrimitiveArray = at.isPrimitiveArray(); > } > StringBuilder result = > - new StringBuilder(dimension + "-dimension array of "); > + new StringBuilder(dimension).append("-dimension array of "); > final String elementClassName = elementType.getClassName(); > if (isPrimitiveArray) { > // Convert from wrapper type to primitive type > > > > > diff --git a/src/share/classes/javax/sound/sampled/AudioFileFormat.java > b/src/share/classes/javax/sound/sampled/AudioFileFormat.java > --- a/src/share/classes/javax/sound/sampled/AudioFileFormat.java > +++ b/src/share/classes/javax/sound/sampled/AudioFileFormat.java > @@ -288,19 +288,20 @@ > > //$$fb2002-11-01: fix for 4672864: AudioFileFormat.toString() > throws unexpected NullPointerException > if (type != null) { > - buf.append(type.toString() + " (." + type.getExtension() + ") > file"); > + buf.append(type.toString()).append(" > (.").append(type.getExtension()).append(") file"); > + > } else { > buf.append("unknown file format"); > } > > if (byteLength != AudioSystem.NOT_SPECIFIED) { > - buf.append(", byte length: " + byteLength); > + buf.append(", byte length: ").append(byteLength); > } > > - buf.append(", data format: " + format); > + buf.append(", data format: ").append(format); > > if (frameLength != AudioSystem.NOT_SPECIFIED) { > - buf.append(", frame length: " + frameLength); > + buf.append(", frame length: ").append(frameLength); > } > > return new String(buf); > > > > > diff --git a/src/share/classes/javax/naming/directory/BasicAttribute.java > b/src/share/classes/javax/naming/directory/BasicAttribute.java > --- a/src/share/classes/javax/naming/directory/BasicAttribute.java > +++ b/src/share/classes/javax/naming/directory/BasicAttribute.java > @@ -211,7 +211,7 @@ > * @return The non-null string representation of this attribute. > */ > public String toString() { > - StringBuffer answer = new StringBuffer(attrID + ": "); > + StringBuffer answer = new StringBuffer(attrID).append(": "); > if (values.size() == 0) { > answer.append("No values"); > } else { > > > > > diff --git a/src/share/classes/javax/naming/BinaryRefAddr.java > b/src/share/classes/javax/naming/BinaryRefAddr.java > --- a/src/share/classes/javax/naming/BinaryRefAddr.java > +++ b/src/share/classes/javax/naming/BinaryRefAddr.java > @@ -169,7 +169,7 @@ > > str.append("AddressContents: "); > for (int i = 0; i<buf.length && i < 32; i++) { > - str.append(Integer.toHexString(buf[i]) +" "); > + str.append(Integer.toHexString(buf[i])).append(" "); > } > if (buf.length >= 32) > str.append(" ...\n"); > > > > > diff --git a/src/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java > b/src/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java > --- a/src/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java > +++ b/src/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java > @@ -197,7 +197,7 @@ > */ > public String toString() { > String ls = System.getProperty("line.separator", "\n"); > - StringBuilder sb = new StringBuilder("JPEGQTable:"+ls); > + StringBuilder sb = new StringBuilder("JPEGQTable:").append(ls); > for (int i=0; i < qTable.length; i++) { > if (i % 8 == 0) { > sb.append('\t'); > > > > > diff --git a/src/share/classes/javax/naming/NameImpl.java > b/src/share/classes/javax/naming/NameImpl.java > --- a/src/share/classes/javax/naming/NameImpl.java > +++ b/src/share/classes/javax/naming/NameImpl.java > @@ -170,7 +170,7 @@ > endQuote = one ? syntaxEndQuote1 : syntaxEndQuote2; > > i += syntaxTypevalSeparator.length(); > - answer.append(syntaxTypevalSeparator+beginQuote); // add > back > + answer.append(syntaxTypevalSeparator).append(beginQuote); > // add back > > // consume string until matching quote > for (i += beginQuote.length(); > > > > > > > > > -- > Atenciosamente. > > Otávio Gonçalves de Santana > > blog: http://otaviosantana.blogspot.com.br/ > twitter: http://twitter.com/otaviojava > site: http://www.otaviojava.com.br > (11) 98255-3513 > > -- Atenciosamente. Otávio Gonçalves de Santana blog: http://otaviosantana.blogspot.com.br/ twitter: http://twitter.com/otaviojava site: http://www.otaviojava.com.br (11) 98255-3513