From 2c14e78a225f4bb7d7d1e82ace2bacee5a6b153e Mon Sep 17 00:00:00 2001 From: Karthik K Date: Thu, 11 Mar 2010 23:31:38 -0800 Subject: [PATCH] s/StringBuffer/StringBuilder as appropriate where no concurrency is needed --- org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java | 6 +++--- .../src/org/eclipse/jgit/lib/FileTreeEntry.java | 2 +- .../src/org/eclipse/jgit/lib/GitlinkTreeEntry.java | 2 +- .../src/org/eclipse/jgit/lib/PersonIdent.java | 8 ++++---- .../src/org/eclipse/jgit/lib/SymlinkTreeEntry.java | 2 +- org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java | 2 +- org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java | 2 +- org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeEntry.java | 4 ++-- .../src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java | 2 +- .../src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java | 2 +- .../org/eclipse/jgit/treewalk/filter/AndTreeFilter.java | 2 +- .../org/eclipse/jgit/treewalk/filter/OrTreeFilter.java | 2 +- .../org/eclipse/jgit/treewalk/filter/PathFilterGroup.java | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java index 0d0c377f8..062c1c397 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java @@ -118,7 +118,7 @@ public class Config { private static String escapeValue(final String x) { boolean inquote = false; int lineStart = 0; - final StringBuffer r = new StringBuffer(x.length()); + final StringBuilder r = new StringBuilder(x.length()); for (int k = 0; k < x.length(); k++) { final char c = x.charAt(k); switch (c) { @@ -897,7 +897,7 @@ public class Config { private static String readKeyName(final StringReader in) throws ConfigInvalidException { - final StringBuffer name = new StringBuffer(); + final StringBuilder name = new StringBuilder(); for (;;) { int c = in.read(); if (c < 0) @@ -944,7 +944,7 @@ public class Config { private static String readValue(final StringReader in, boolean quote, final int eol) throws ConfigInvalidException { - final StringBuffer value = new StringBuffer(); + final StringBuilder value = new StringBuilder(); boolean space = false; for (;;) { int c = in.read(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileTreeEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileTreeEntry.java index 9ff4deca3..3da91dd2a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileTreeEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileTreeEntry.java @@ -106,7 +106,7 @@ public class FileTreeEntry extends TreeEntry { } public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(getId())); r.append(' '); r.append(isExecutable() ? 'X' : 'F'); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitlinkTreeEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitlinkTreeEntry.java index a00075912..fdee61501 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitlinkTreeEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitlinkTreeEntry.java @@ -83,7 +83,7 @@ public class GitlinkTreeEntry extends TreeEntry { @Override public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(getId())); r.append(" G "); r.append(getFullName()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java index 49d727f8e..0bc2e7a2d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java @@ -251,7 +251,7 @@ public class PersonIdent { * @return this person's declared time zone; null if time zone is unknown. */ public TimeZone getTimeZone() { - StringBuffer tzId = new StringBuffer(8); + StringBuilder tzId = new StringBuilder(8); tzId.append("GMT"); appendTimezone(tzId); return TimeZone.getTimeZone(tzId.toString()); @@ -285,7 +285,7 @@ public class PersonIdent { * @return a string in the git author format */ public String toExternalString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append(getName()); r.append(" <"); r.append(getEmailAddress()); @@ -296,7 +296,7 @@ public class PersonIdent { return r.toString(); } - private void appendTimezone(final StringBuffer r) { + private void appendTimezone(final StringBuilder r) { int offset = tzOffset; final char sign; final int offsetHours; @@ -324,7 +324,7 @@ public class PersonIdent { } public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); final SimpleDateFormat dtfmt; dtfmt = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy Z", Locale.US); dtfmt.setTimeZone(getTimeZone()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymlinkTreeEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymlinkTreeEntry.java index 81666be45..abb31c152 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymlinkTreeEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymlinkTreeEntry.java @@ -81,7 +81,7 @@ public class SymlinkTreeEntry extends TreeEntry { } public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(getId())); r.append(" S "); r.append(getFullName()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java index 0e1c1651d..35ccf773c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java @@ -163,7 +163,7 @@ public class Tag { throw new CorruptObjectException(tagId, "no tagger/bad header"); // Message should start with an empty line, but - StringBuffer tempMessage = new StringBuffer(); + StringBuilder tempMessage = new StringBuilder(); char[] readBuf = new char[2048]; int readLen; while ((readLen = br.read(readBuf)) > 0) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java index 130d3ded9..61607cba9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java @@ -598,7 +598,7 @@ public class Tree extends TreeEntry implements Treeish { } public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(getId())); r.append(" T "); r.append(getFullName()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeEntry.java index b6dd9311a..58f2bc74c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeEntry.java @@ -210,7 +210,7 @@ public abstract class TreeEntry implements Comparable { * @return repository relative name of this entry */ public String getFullName() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); appendFullName(r); return r.toString(); } @@ -285,7 +285,7 @@ public abstract class TreeEntry implements Comparable { */ public abstract FileMode getMode(); - private void appendFullName(final StringBuffer r) { + private void appendFullName(final StringBuilder r) { final TreeEntry p = getParent(); final String n = getName(); if (p != null) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java index 406a7764d..112f07aed 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java @@ -170,7 +170,7 @@ public abstract class AndRevFilter extends RevFilter { @Override public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append("("); for (int i = 0; i < subfilters.length; i++) { if (i > 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java index 540e7cba6..bd1314a93 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java @@ -168,7 +168,7 @@ public abstract class OrRevFilter extends RevFilter { @Override public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append("("); for (int i = 0; i < subfilters.length; i++) { if (i > 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java index 7ba6af5fc..9a6156f08 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java @@ -182,7 +182,7 @@ public abstract class AndTreeFilter extends TreeFilter { @Override public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append("("); for (int i = 0; i < subfilters.length; i++) { if (i > 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java index 455031fc1..f14ceeab3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java @@ -180,7 +180,7 @@ public abstract class OrTreeFilter extends TreeFilter { @Override public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append("("); for (int i = 0; i < subfilters.length; i++) { if (i > 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java index ced799b74..e58512da3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java @@ -192,7 +192,7 @@ public class PathFilterGroup { } public String toString() { - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append("FAST("); for (int i = 0; i < paths.length; i++) { if (i > 0)