Browse Source

s/StringBuffer/StringBuilder as appropriate where no concurrency is needed

stable-0.8
Karthik K 15 years ago
parent
commit
2c14e78a22
  1. 6
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/FileTreeEntry.java
  3. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/GitlinkTreeEntry.java
  4. 8
      org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
  5. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/SymlinkTreeEntry.java
  6. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java
  7. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java
  8. 4
      org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeEntry.java
  9. 2
      org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java
  10. 2
      org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java
  11. 2
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java
  12. 2
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java
  13. 2
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java

6
org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java

@ -118,7 +118,7 @@ public class Config {
private static String escapeValue(final String x) { private static String escapeValue(final String x) {
boolean inquote = false; boolean inquote = false;
int lineStart = 0; 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++) { for (int k = 0; k < x.length(); k++) {
final char c = x.charAt(k); final char c = x.charAt(k);
switch (c) { switch (c) {
@ -897,7 +897,7 @@ public class Config {
private static String readKeyName(final StringReader in) private static String readKeyName(final StringReader in)
throws ConfigInvalidException { throws ConfigInvalidException {
final StringBuffer name = new StringBuffer(); final StringBuilder name = new StringBuilder();
for (;;) { for (;;) {
int c = in.read(); int c = in.read();
if (c < 0) if (c < 0)
@ -944,7 +944,7 @@ public class Config {
private static String readValue(final StringReader in, boolean quote, private static String readValue(final StringReader in, boolean quote,
final int eol) throws ConfigInvalidException { final int eol) throws ConfigInvalidException {
final StringBuffer value = new StringBuffer(); final StringBuilder value = new StringBuilder();
boolean space = false; boolean space = false;
for (;;) { for (;;) {
int c = in.read(); int c = in.read();

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/FileTreeEntry.java

@ -106,7 +106,7 @@ public class FileTreeEntry extends TreeEntry {
} }
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append(ObjectId.toString(getId())); r.append(ObjectId.toString(getId()));
r.append(' '); r.append(' ');
r.append(isExecutable() ? 'X' : 'F'); r.append(isExecutable() ? 'X' : 'F');

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/GitlinkTreeEntry.java

@ -83,7 +83,7 @@ public class GitlinkTreeEntry extends TreeEntry {
@Override @Override
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append(ObjectId.toString(getId())); r.append(ObjectId.toString(getId()));
r.append(" G "); r.append(" G ");
r.append(getFullName()); r.append(getFullName());

8
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. * @return this person's declared time zone; null if time zone is unknown.
*/ */
public TimeZone getTimeZone() { public TimeZone getTimeZone() {
StringBuffer tzId = new StringBuffer(8); StringBuilder tzId = new StringBuilder(8);
tzId.append("GMT"); tzId.append("GMT");
appendTimezone(tzId); appendTimezone(tzId);
return TimeZone.getTimeZone(tzId.toString()); return TimeZone.getTimeZone(tzId.toString());
@ -285,7 +285,7 @@ public class PersonIdent {
* @return a string in the git author format * @return a string in the git author format
*/ */
public String toExternalString() { public String toExternalString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append(getName()); r.append(getName());
r.append(" <"); r.append(" <");
r.append(getEmailAddress()); r.append(getEmailAddress());
@ -296,7 +296,7 @@ public class PersonIdent {
return r.toString(); return r.toString();
} }
private void appendTimezone(final StringBuffer r) { private void appendTimezone(final StringBuilder r) {
int offset = tzOffset; int offset = tzOffset;
final char sign; final char sign;
final int offsetHours; final int offsetHours;
@ -324,7 +324,7 @@ public class PersonIdent {
} }
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
final SimpleDateFormat dtfmt; final SimpleDateFormat dtfmt;
dtfmt = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy Z", Locale.US); dtfmt = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy Z", Locale.US);
dtfmt.setTimeZone(getTimeZone()); dtfmt.setTimeZone(getTimeZone());

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/SymlinkTreeEntry.java

@ -81,7 +81,7 @@ public class SymlinkTreeEntry extends TreeEntry {
} }
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append(ObjectId.toString(getId())); r.append(ObjectId.toString(getId()));
r.append(" S "); r.append(" S ");
r.append(getFullName()); r.append(getFullName());

2
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"); throw new CorruptObjectException(tagId, "no tagger/bad header");
// Message should start with an empty line, but // Message should start with an empty line, but
StringBuffer tempMessage = new StringBuffer(); StringBuilder tempMessage = new StringBuilder();
char[] readBuf = new char[2048]; char[] readBuf = new char[2048];
int readLen; int readLen;
while ((readLen = br.read(readBuf)) > 0) { while ((readLen = br.read(readBuf)) > 0) {

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java

@ -598,7 +598,7 @@ public class Tree extends TreeEntry implements Treeish {
} }
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append(ObjectId.toString(getId())); r.append(ObjectId.toString(getId()));
r.append(" T "); r.append(" T ");
r.append(getFullName()); r.append(getFullName());

4
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 * @return repository relative name of this entry
*/ */
public String getFullName() { public String getFullName() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
appendFullName(r); appendFullName(r);
return r.toString(); return r.toString();
} }
@ -285,7 +285,7 @@ public abstract class TreeEntry implements Comparable {
*/ */
public abstract FileMode getMode(); public abstract FileMode getMode();
private void appendFullName(final StringBuffer r) { private void appendFullName(final StringBuilder r) {
final TreeEntry p = getParent(); final TreeEntry p = getParent();
final String n = getName(); final String n = getName();
if (p != null) { if (p != null) {

2
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java

@ -170,7 +170,7 @@ public abstract class AndRevFilter extends RevFilter {
@Override @Override
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append("("); r.append("(");
for (int i = 0; i < subfilters.length; i++) { for (int i = 0; i < subfilters.length; i++) {
if (i > 0) if (i > 0)

2
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java

@ -168,7 +168,7 @@ public abstract class OrRevFilter extends RevFilter {
@Override @Override
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append("("); r.append("(");
for (int i = 0; i < subfilters.length; i++) { for (int i = 0; i < subfilters.length; i++) {
if (i > 0) if (i > 0)

2
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java

@ -182,7 +182,7 @@ public abstract class AndTreeFilter extends TreeFilter {
@Override @Override
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append("("); r.append("(");
for (int i = 0; i < subfilters.length; i++) { for (int i = 0; i < subfilters.length; i++) {
if (i > 0) if (i > 0)

2
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java

@ -180,7 +180,7 @@ public abstract class OrTreeFilter extends TreeFilter {
@Override @Override
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append("("); r.append("(");
for (int i = 0; i < subfilters.length; i++) { for (int i = 0; i < subfilters.length; i++) {
if (i > 0) if (i > 0)

2
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java

@ -192,7 +192,7 @@ public class PathFilterGroup {
} }
public String toString() { public String toString() {
final StringBuffer r = new StringBuffer(); final StringBuilder r = new StringBuilder();
r.append("FAST("); r.append("FAST(");
for (int i = 0; i < paths.length; i++) { for (int i = 0; i < paths.length; i++) {
if (i > 0) if (i > 0)

Loading…
Cancel
Save