Skip to content

Commit

Permalink
Using StringBuilder instead of StringBuffer in XMLMemento
Browse files Browse the repository at this point in the history
Done via a JDT cleanup action
  • Loading branch information
vogella committed Apr 29, 2022
1 parent a7ecd8a commit 66106bc
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ public static XMLMemento createReadRoot(Reader reader) throws WorkbenchException
* protocol restriction if does not exist already
*/
private static String getAttributeNewValue(Object attributeOldValue) {
StringBuffer strNewValue = new StringBuffer(FILE_STRING);
StringBuilder strNewValue = new StringBuilder(FILE_STRING);
if (attributeOldValue instanceof String && ((String) attributeOldValue).length() != 0) {
String strOldValue = (String) attributeOldValue;
boolean exists = Arrays.asList(strOldValue.split(",")).stream().anyMatch(x -> x.trim().equals(FILE_STRING)); //$NON-NLS-1$
if (!exists) {
strNewValue.append(", ").append(strOldValue); //$NON-NLS-1$
} else {
strNewValue = new StringBuffer(strOldValue);
strNewValue = new StringBuilder(strOldValue);
}
}
return strNewValue.toString();
Expand Down

0 comments on commit 66106bc

Please sign in to comment.