diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-11-25 17:17:20 +0100 |
---|---|---|
committer | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-12-27 16:57:38 +0100 |
commit | c310fa0c802f40a774edb58641de3ac5bfad0e2c (patch) | |
tree | 28dc002136ce8a2c122e2cb012a317aa7d8a0efa /org.eclipse.jgit/src/org/eclipse/jgit/lib | |
parent | 03d50dc50b584caf2826f7db8a4748435b610f63 (diff) | |
download | jgit-c310fa0c802f40a774edb58641de3ac5bfad0e2c.tar.gz jgit-c310fa0c802f40a774edb58641de3ac5bfad0e2c.zip |
Mark non-externalizable strings as such
A few classes such as Constanrs are marked with @SuppressWarnings, as are
toString() methods with many liternal, but otherwise $NLS-n$ is used for
string containing text that should not be translated. A few literals may
fall into the gray zone, but mostly I've tried to only tag the obvious
ones.
Change-Id: I22e50a77e2bf9e0b842a66bdf674e8fa1692f590
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib')
29 files changed, 117 insertions, 106 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java index 44460fe653..87dabd4902 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java @@ -375,8 +375,9 @@ public final class AbbreviatedObjectId implements Serializable { return new String(b, 0, nibbles); } + @SuppressWarnings("nls") @Override public String toString() { - return "AbbreviatedObjectId[" + name() + "]"; + return "AbbreviatedObjectId[" + name() + "]"; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java index 9d2babd047..e408c79a3b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java @@ -489,6 +489,7 @@ public abstract class AnyObjectId implements Comparable<Object> { dst[o--] = '0'; } + @SuppressWarnings("nls") @Override public String toString() { return "AnyObjectId[" + name() + "]"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java index f80c803605..a0f4418c58 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java @@ -487,7 +487,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re */ public B findGitDir() { if (getGitDir() == null) - findGitDir(new File("").getAbsoluteFile()); + findGitDir(new File("").getAbsoluteFile()); //$NON-NLS-1$ return self(); } @@ -628,7 +628,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re if (getGitDir() == null) setGitDir(getWorkTree().getParentFile()); if (getIndexFile() == null) - setIndexFile(new File(getGitDir(), "index")); + setIndexFile(new File(getGitDir(), "index")); //$NON-NLS-1$ } } @@ -640,7 +640,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re */ protected void setupInternals() throws IOException { if (getObjectDirectory() == null && getGitDir() != null) - setObjectDirectory(safeFS().resolve(getGitDir(), "objects")); + setObjectDirectory(safeFS().resolve(getGitDir(), "objects")); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java index e198e07e4d..98c2647190 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java @@ -168,7 +168,7 @@ public class BatchRefUpdate { if (msg == null && !appendStatus) disableRefLog(); else if (msg == null && appendStatus) { - refLogMessage = ""; + refLogMessage = ""; //$NON-NLS-1$ refLogIncludeResult = true; } else { refLogMessage = msg; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchingProgressMonitor.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchingProgressMonitor.java index 83857649ce..39856c0c98 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchingProgressMonitor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchingProgressMonitor.java @@ -69,7 +69,7 @@ public abstract class BatchingProgressMonitor implements ProgressMonitor { public Thread newThread(Runnable taskBody) { Thread thr = baseFactory.newThread(taskBody); - thr.setName("JGit-AlarmQueue"); + thr.setName("JGit-AlarmQueue"); //$NON-NLS-1$ thr.setDaemon(true); return thr; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java index b0883e3f43..2c51931ff6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java @@ -81,7 +81,7 @@ public class BranchConfig { if (remote == null || mergeRef == null) return null; - if (remote.equals(".")) + if (remote.equals(".")) //$NON-NLS-1$ return mergeRef; return findRemoteTrackingBranch(remote, mergeRef); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java index 239140713c..c5c488dac3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java @@ -66,15 +66,15 @@ import java.util.List; public class CommitBuilder { private static final ObjectId[] EMPTY_OBJECTID_LIST = new ObjectId[0]; - private static final byte[] htree = Constants.encodeASCII("tree"); + private static final byte[] htree = Constants.encodeASCII("tree"); //$NON-NLS-1$ - private static final byte[] hparent = Constants.encodeASCII("parent"); + private static final byte[] hparent = Constants.encodeASCII("parent"); //$NON-NLS-1$ - private static final byte[] hauthor = Constants.encodeASCII("author"); + private static final byte[] hauthor = Constants.encodeASCII("author"); //$NON-NLS-1$ - private static final byte[] hcommitter = Constants.encodeASCII("committer"); + private static final byte[] hcommitter = Constants.encodeASCII("committer"); //$NON-NLS-1$ - private static final byte[] hencoding = Constants.encodeASCII("encoding"); + private static final byte[] hencoding = Constants.encodeASCII("encoding"); //$NON-NLS-1$ private ObjectId treeId; @@ -322,6 +322,7 @@ public class CommitBuilder { return build(); } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder r = new StringBuilder(); 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 15bd37e69f..84d77ce32b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java @@ -134,24 +134,24 @@ public class Config { r.append('"'); inquote = false; } - r.append("\\n\\\n"); + r.append("\\n\\\n"); //$NON-NLS-1$ lineStart = r.length(); break; case '\t': - r.append("\\t"); + r.append("\\t"); //$NON-NLS-1$ break; case '\b': - r.append("\\b"); + r.append("\\b"); //$NON-NLS-1$ break; case '\\': - r.append("\\\\"); + r.append("\\\\"); //$NON-NLS-1$ break; case '"': - r.append("\\\""); + r.append("\\\""); //$NON-NLS-1$ break; case ';': @@ -354,7 +354,7 @@ public class Config { @SuppressWarnings("unchecked") private static <T> T[] allValuesOf(final T value) { try { - return (T[]) value.getClass().getMethod("values").invoke(null); + return (T[]) value.getClass().getMethod("values").invoke(null); //$NON-NLS-1$ } catch (Exception err) { String typeName = value.getClass().getName(); String msg = MessageFormat.format( @@ -393,9 +393,9 @@ public class Config { for (T e : all) { if (StringUtils.equalsIgnoreCase(e.name(), n)) return e; - else if (StringUtils.equalsIgnoreCase(e.name(), "TRUE")) + else if (StringUtils.equalsIgnoreCase(e.name(), "TRUE")) //$NON-NLS-1$ trueState = e; - else if (StringUtils.equalsIgnoreCase(e.name(), "FALSE")) + else if (StringUtils.equalsIgnoreCase(e.name(), "FALSE")) //$NON-NLS-1$ falseState = e; } @@ -664,11 +664,11 @@ public class Config { final String s; if (value >= GiB && (value % GiB) == 0) - s = String.valueOf(value / GiB) + " g"; + s = String.valueOf(value / GiB) + " g"; //$NON-NLS-1$ else if (value >= MiB && (value % MiB) == 0) - s = String.valueOf(value / MiB) + " m"; + s = String.valueOf(value / MiB) + " m"; //$NON-NLS-1$ else if (value >= KiB && (value % KiB) == 0) - s = String.valueOf(value / KiB) + " k"; + s = String.valueOf(value / KiB) + " k"; //$NON-NLS-1$ else s = String.valueOf(value); @@ -695,7 +695,7 @@ public class Config { */ public void setBoolean(final String section, final String subsection, final String name, final boolean value) { - setString(section, subsection, name, value ? "true" : "false"); + setString(section, subsection, name, value ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ } /** @@ -937,8 +937,8 @@ public class Config { out.append(' '); String escaped = escapeValue(e.subsection); // make sure to avoid double quotes here - boolean quoted = escaped.startsWith("\"") - && escaped.endsWith("\""); + boolean quoted = escaped.startsWith("\"") //$NON-NLS-1$ + && escaped.endsWith("\""); //$NON-NLS-1$ if (!quoted) out.append('"'); out.append(escaped); @@ -947,11 +947,11 @@ public class Config { } out.append(']'); } else if (e.section != null && e.name != null) { - if (e.prefix == null || "".equals(e.prefix)) + if (e.prefix == null || "".equals(e.prefix)) //$NON-NLS-1$ out.append('\t'); out.append(e.name); if (MAGIC_EMPTY_VALUE != e.value) { - out.append(" ="); + out.append(" ="); //$NON-NLS-1$ if (e.value != null) { out.append(' '); out.append(escapeValue(e.value)); @@ -1005,7 +1005,7 @@ public class Config { } else if (e.section == null && Character.isWhitespace(c)) { // Save the leading whitespace (if any). if (e.prefix == null) - e.prefix = ""; + e.prefix = ""; //$NON-NLS-1$ e.prefix += c; } else if ('[' == c) { @@ -1018,7 +1018,7 @@ public class Config { } if (']' != input) throw new ConfigInvalidException(JGitText.get().badGroupHeader); - e.suffix = ""; + e.suffix = ""; //$NON-NLS-1$ } else if (last != null) { // Read a value. @@ -1026,7 +1026,7 @@ public class Config { e.subsection = last.subsection; in.reset(); e.name = readKeyName(in); - if (e.name.endsWith("\n")) { + if (e.name.endsWith("\n")) { //$NON-NLS-1$ e.name = e.name.substring(0, e.name.length() - 1); e.value = MAGIC_EMPTY_VALUE; } else diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java index c20006e38e..dbaa043e21 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java @@ -47,6 +47,7 @@ package org.eclipse.jgit.lib; * Constants for use with the Configuration classes: section names, * configuration keys */ +@SuppressWarnings("nls") public class ConfigConstants { /** The "core" section */ public static final String CONFIG_CORE_SECTION = "core"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java index 2715f5f94a..8a49bdb4f3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java @@ -112,6 +112,7 @@ class ConfigLine { return a.equals(b); } + @SuppressWarnings("nls") @Override public String toString() { if (section == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java index cc5fe25e52..b7c4c64321 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java @@ -98,7 +98,7 @@ class ConfigSnapshot { Set<String> getNames(String section, String subsection) { List<ConfigLine> s = sorted(); - int idx = find(s, section, subsection, ""); + int idx = find(s, section, subsection, ""); //$NON-NLS-1$ if (idx < 0) idx = -(idx + 1); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java index e66e3a8354..262f7ce7f3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java @@ -56,6 +56,7 @@ import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.util.MutableInteger; /** Misc. constants used throughout JGit. */ +@SuppressWarnings("nls") public final class Constants { /** Hash function used natively by Git for all objects. */ private static final String HASH_FUNCTION = "SHA-1"; 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 7348773aa4..936fd82bfd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitlinkTreeEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitlinkTreeEntry.java @@ -80,7 +80,7 @@ public class GitlinkTreeEntry extends TreeEntry { public String toString() { final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(getId())); - r.append(" G "); + r.append(" G "); //$NON-NLS-1$ r.append(getFullName()); return r.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java index 0da9e4224e..d32eb99792 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java @@ -227,7 +227,7 @@ public class IndexDiff { * @throws IOException */ public boolean diff() throws IOException { - return diff(null, 0, 0, ""); + return diff(null, 0, 0, ""); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java index 5fc1e83252..bb67befae1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java @@ -67,31 +67,31 @@ import org.eclipse.jgit.util.MutableInteger; */ public class ObjectChecker { /** Header "tree " */ - public static final byte[] tree = Constants.encodeASCII("tree "); + public static final byte[] tree = Constants.encodeASCII("tree "); //$NON-NLS-1$ /** Header "parent " */ - public static final byte[] parent = Constants.encodeASCII("parent "); + public static final byte[] parent = Constants.encodeASCII("parent "); //$NON-NLS-1$ /** Header "author " */ - public static final byte[] author = Constants.encodeASCII("author "); + public static final byte[] author = Constants.encodeASCII("author "); //$NON-NLS-1$ /** Header "committer " */ - public static final byte[] committer = Constants.encodeASCII("committer "); + public static final byte[] committer = Constants.encodeASCII("committer "); //$NON-NLS-1$ /** Header "encoding " */ - public static final byte[] encoding = Constants.encodeASCII("encoding "); + public static final byte[] encoding = Constants.encodeASCII("encoding "); //$NON-NLS-1$ /** Header "object " */ - public static final byte[] object = Constants.encodeASCII("object "); + public static final byte[] object = Constants.encodeASCII("object "); //$NON-NLS-1$ /** Header "type " */ - public static final byte[] type = Constants.encodeASCII("type "); + public static final byte[] type = Constants.encodeASCII("type "); //$NON-NLS-1$ /** Header "tag " */ - public static final byte[] tag = Constants.encodeASCII("tag "); + public static final byte[] tag = Constants.encodeASCII("tag "); //$NON-NLS-1$ /** Header "tagger " */ - public static final byte[] tagger = Constants.encodeASCII("tagger "); + public static final byte[] tagger = Constants.encodeASCII("tagger "); //$NON-NLS-1$ private final MutableObjectId tempId = new MutableObjectId(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java index babfc6f075..f481c772dc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java @@ -178,7 +178,7 @@ public abstract class ObjectIdRef implements Ref { @Override public String toString() { StringBuilder r = new StringBuilder(); - r.append("Ref["); + r.append("Ref["); //$NON-NLS-1$ r.append(getName()); r.append('='); r.append(ObjectId.toString(getObjectId())); 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 f81d9c5a84..69f7fd4404 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java @@ -217,7 +217,7 @@ public class PersonIdent implements Serializable { */ public TimeZone getTimeZone() { StringBuilder tzId = new StringBuilder(8); - tzId.append("GMT"); + tzId.append("GMT"); //$NON-NLS-1$ appendTimezone(tzId); return TimeZone.getTimeZone(tzId.toString()); } @@ -255,9 +255,9 @@ public class PersonIdent implements Serializable { public String toExternalString() { final StringBuilder r = new StringBuilder(); r.append(getName()); - r.append(" <"); + r.append(" <"); //$NON-NLS-1$ r.append(getEmailAddress()); - r.append("> "); + r.append("> "); //$NON-NLS-1$ r.append(when / 1000); r.append(' '); appendTimezone(r); @@ -291,6 +291,7 @@ public class PersonIdent implements Serializable { r.append(offsetMins); } + @SuppressWarnings("nls") public String toString() { final StringBuilder r = new StringBuilder(); final SimpleDateFormat dtfmt; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefRename.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefRename.java index 3cfb75a609..05eb31183d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefRename.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefRename.java @@ -77,12 +77,12 @@ public abstract class RefRename { source = src; destination = dst; - String cmd = ""; + String cmd = ""; //$NON-NLS-1$ if (source.getName().startsWith(Constants.R_HEADS) && destination.getName().startsWith(Constants.R_HEADS)) - cmd = "Branch: "; - setRefLogMessage(cmd + "renamed " - + Repository.shortenRefName(source.getName()) + " to " + cmd = "Branch: "; //$NON-NLS-1$ + setRefLogMessage(cmd + "renamed " //$NON-NLS-1$ + + Repository.shortenRefName(source.getName()) + " to " //$NON-NLS-1$ + Repository.shortenRefName(destination.getName())); } @@ -132,7 +132,7 @@ public abstract class RefRename { /** Don't record this rename in the ref's associated reflog. */ public void disableRefLog() { - destination.setRefLogMessage("", false); + destination.setRefLogMessage("", false); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java index 83f1981494..394af29534 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java @@ -190,7 +190,7 @@ public abstract class RefUpdate { protected RefUpdate(final Ref ref) { this.ref = ref; oldValue = ref.getObjectId(); - refLogMessage = ""; + refLogMessage = ""; //$NON-NLS-1$ } /** @return the reference database this update modifies. */ @@ -372,7 +372,7 @@ public abstract class RefUpdate { if (msg == null && !appendStatus) disableRefLog(); else if (msg == null && appendStatus) { - refLogMessage = ""; + refLogMessage = ""; //$NON-NLS-1$ refLogIncludeResult = true; } else { refLogMessage = msg; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java index 4acb3ecd89..8acac42fa6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java @@ -128,7 +128,7 @@ public abstract class RefWriter { r.getPeeledObjectId().copyTo(tmp, w); w.write('\t'); w.write(r.getName()); - w.write("^{}\n"); + w.write("^{}\n"); //$NON-NLS-1$ } } writeFile(Constants.INFO_REFS, Constants.encode(w.toString())); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 10efb9f21a..9b2b8a7f0f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -491,16 +491,16 @@ public abstract class Repository { } i = k; if (item != null) - if (item.equals("tree")) { + if (item.equals("tree")) { //$NON-NLS-1$ rev = rw.parseTree(rev); - } else if (item.equals("commit")) { + } else if (item.equals("commit")) { //$NON-NLS-1$ rev = rw.parseCommit(rev); - } else if (item.equals("blob")) { + } else if (item.equals("blob")) { //$NON-NLS-1$ rev = rw.peel(rev); if (!(rev instanceof RevBlob)) throw new IncorrectObjectTypeException(rev, Constants.TYPE_BLOB); - } else if (item.equals("")) { + } else if (item.equals("")) { //$NON-NLS-1$ rev = rw.peel(rev); } else throw new RevisionSyntaxException(revstr); @@ -596,14 +596,14 @@ public abstract class Repository { } } if (time != null) { - if (time.equals("upstream")) { + if (time.equals("upstream")) { //$NON-NLS-1$ if (name == null) name = new String(revChars, done, i); - if (name.equals("")) + if (name.equals("")) //$NON-NLS-1$ // Currently checked out branch, HEAD if // detached name = Constants.HEAD; - if (!Repository.isValidRefName("x/" + name)) + if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ throw new RevisionSyntaxException(revstr); Ref ref = getRef(name); name = null; @@ -616,7 +616,7 @@ public abstract class Repository { RemoteConfig remoteConfig; try { remoteConfig = new RemoteConfig(getConfig(), - "origin"); + "origin"); //$NON-NLS-1$ } catch (URISyntaxException e) { throw new RevisionSyntaxException(revstr); } @@ -637,7 +637,7 @@ public abstract class Repository { } if (name == null) throw new RevisionSyntaxException(revstr); - } else if (time.matches("^-\\d+$")) { + } else if (time.matches("^-\\d+$")) { //$NON-NLS-1$ if (name != null) throw new RevisionSyntaxException(revstr); else { @@ -651,9 +651,9 @@ public abstract class Repository { } else { if (name == null) name = new String(revChars, done, i); - if (name.equals("")) + if (name.equals("")) //$NON-NLS-1$ name = Constants.HEAD; - if (!Repository.isValidRefName("x/" + name)) + if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ throw new RevisionSyntaxException(revstr); Ref ref = getRef(name); name = null; @@ -674,7 +674,7 @@ public abstract class Repository { if (rev == null) { if (name == null) name = new String(revChars, done, i); - if (name.equals("")) + if (name.equals("")) //$NON-NLS-1$ name = Constants.HEAD; rev = parseSimple(rw, name); name = null; @@ -702,7 +702,7 @@ public abstract class Repository { if (done == revstr.length()) return null; name = revstr.substring(done); - if (!Repository.isValidRefName("x/" + name)) + if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ throw new RevisionSyntaxException(revstr); if (getRef(name) != null) return name; @@ -732,7 +732,7 @@ public abstract class Repository { if (ObjectId.isId(revstr)) return ObjectId.fromString(revstr); - if (Repository.isValidRefName("x/" + revstr)) { + if (Repository.isValidRefName("x/" + revstr)) { //$NON-NLS-1$ Ref r = getRefDatabase().getRef(revstr); if (r != null) return r.getObjectId(); @@ -741,7 +741,7 @@ public abstract class Repository { if (AbbreviatedObjectId.isId(revstr)) return resolveAbbreviation(revstr); - int dashg = revstr.indexOf("-g"); + int dashg = revstr.indexOf("-g"); //$NON-NLS-1$ if ((dashg + 5) < revstr.length() && 0 <= dashg && isHex(revstr.charAt(dashg + 2)) && isHex(revstr.charAt(dashg + 3)) @@ -827,14 +827,15 @@ public abstract class Repository { getRefDatabase().close(); } + @SuppressWarnings("nls") public String toString() { String desc; if (getDirectory() != null) desc = getDirectory().getPath(); else - desc = getClass().getSimpleName() + "-" + desc = getClass().getSimpleName() + "-" //$NON-NLS-1$ + System.identityHashCode(this); - return "Repository[" + desc + "]"; + return "Repository[" + desc + "]"; //$NON-NLS-1$ } /** @@ -1068,22 +1069,22 @@ public abstract class Repository { return RepositoryState.BARE; // Pre Git-1.6 logic - if (new File(getWorkTree(), ".dotest").exists()) + if (new File(getWorkTree(), ".dotest").exists()) //$NON-NLS-1$ return RepositoryState.REBASING; - if (new File(getDirectory(), ".dotest-merge").exists()) + if (new File(getDirectory(), ".dotest-merge").exists()) //$NON-NLS-1$ return RepositoryState.REBASING_INTERACTIVE; // From 1.6 onwards - if (new File(getDirectory(),"rebase-apply/rebasing").exists()) + if (new File(getDirectory(),"rebase-apply/rebasing").exists()) //$NON-NLS-1$ return RepositoryState.REBASING_REBASING; - if (new File(getDirectory(),"rebase-apply/applying").exists()) + if (new File(getDirectory(),"rebase-apply/applying").exists()) //$NON-NLS-1$ return RepositoryState.APPLY; - if (new File(getDirectory(),"rebase-apply").exists()) + if (new File(getDirectory(),"rebase-apply").exists()) //$NON-NLS-1$ return RepositoryState.REBASING; - if (new File(getDirectory(),"rebase-merge/interactive").exists()) + if (new File(getDirectory(),"rebase-merge/interactive").exists()) //$NON-NLS-1$ return RepositoryState.REBASING_INTERACTIVE; - if (new File(getDirectory(),"rebase-merge").exists()) + if (new File(getDirectory(),"rebase-merge").exists()) //$NON-NLS-1$ return RepositoryState.REBASING_MERGE; // Both versions @@ -1102,7 +1103,7 @@ public abstract class Repository { return RepositoryState.MERGING; } - if (new File(getDirectory(), "BISECT_LOG").exists()) + if (new File(getDirectory(), "BISECT_LOG").exists()) //$NON-NLS-1$ return RepositoryState.BISECTING; if (new File(getDirectory(), Constants.CHERRY_PICK_HEAD).exists()) { @@ -1136,7 +1137,7 @@ public abstract class Repository { final int len = refName.length(); if (len == 0) return false; - if (refName.endsWith(".lock")) + if (refName.endsWith(".lock")) //$NON-NLS-1$ return false; int components = 1; @@ -1194,7 +1195,7 @@ public abstract class Repository { File absWd = workDir.isAbsolute() ? workDir : workDir.getAbsoluteFile(); File absFile = file.isAbsolute() ? file : file.getAbsoluteFile(); if (absWd == workDir && absFile == file) - return ""; + return ""; //$NON-NLS-1$ return stripWorkDir(absWd, absFile); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java index dc5eae5173..5132eb90b6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java @@ -354,15 +354,15 @@ public class RepositoryCache { * Git directory. */ public static boolean isGitRepository(final File dir, FS fs) { - return fs.resolve(dir, "objects").exists() - && fs.resolve(dir, "refs").exists() + return fs.resolve(dir, "objects").exists() //$NON-NLS-1$ + && fs.resolve(dir, "refs").exists() //$NON-NLS-1$ && isValidHead(new File(dir, Constants.HEAD)); } private static boolean isValidHead(final File head) { final String ref = readFirstLine(head); return ref != null - && (ref.startsWith("ref: refs/") || ObjectId.isId(ref)); + && (ref.startsWith("ref: refs/") || ObjectId.isId(ref)); //$NON-NLS-1$ } private static String readFirstLine(final File head) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java index d169d61f1c..43b1510f94 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java @@ -102,6 +102,7 @@ public class SymbolicRef implements Ref { return getLeaf().isPeeled(); } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder r = new StringBuilder(); 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 e408be1750..c7e41bce04 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymlinkTreeEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymlinkTreeEntry.java @@ -78,7 +78,7 @@ public class SymlinkTreeEntry extends TreeEntry { public String toString() { final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(getId())); - r.append(" S "); + r.append(" S "); //$NON-NLS-1$ r.append(getFullName()); return r.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java index 82cd0747a4..3490a5bc99 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java @@ -162,20 +162,20 @@ public class TagBuilder { ByteArrayOutputStream os = new ByteArrayOutputStream(); OutputStreamWriter w = new OutputStreamWriter(os, Constants.CHARSET); try { - w.write("object "); + w.write("object "); //$NON-NLS-1$ getObjectId().copyTo(w); w.write('\n'); - w.write("type "); + w.write("type "); //$NON-NLS-1$ w.write(Constants.typeString(getObjectType())); - w.write("\n"); + w.write("\n"); //$NON-NLS-1$ - w.write("tag "); + w.write("tag "); //$NON-NLS-1$ w.write(getTag()); - w.write("\n"); + w.write("\n"); //$NON-NLS-1$ if (getTagger() != null) { - w.write("tagger "); + w.write("tagger "); //$NON-NLS-1$ w.write(getTagger().toExternalString()); w.write('\n'); } @@ -203,6 +203,7 @@ public class TagBuilder { return build(); } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder r = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java index 7e48609070..7675fccb69 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java @@ -81,14 +81,14 @@ public class TextProgressMonitor extends BatchingProgressMonitor { protected void onEndTask(String taskName, int workCurr) { StringBuilder s = new StringBuilder(); format(s, taskName, workCurr); - s.append("\n"); + s.append("\n"); //$NON-NLS-1$ send(s); } private void format(StringBuilder s, String taskName, int workCurr) { - s.append("\r"); + s.append("\r"); //$NON-NLS-1$ s.append(taskName); - s.append(": "); + s.append(": "); //$NON-NLS-1$ while (s.length() < 25) s.append(' '); s.append(workCurr); @@ -105,32 +105,32 @@ public class TextProgressMonitor extends BatchingProgressMonitor { protected void onEndTask(String taskName, int cmp, int totalWork, int pcnt) { StringBuilder s = new StringBuilder(); format(s, taskName, cmp, totalWork, pcnt); - s.append("\n"); + s.append("\n"); //$NON-NLS-1$ send(s); } private void format(StringBuilder s, String taskName, int cmp, int totalWork, int pcnt) { - s.append("\r"); + s.append("\r"); //$NON-NLS-1$ s.append(taskName); - s.append(": "); + s.append(": "); //$NON-NLS-1$ while (s.length() < 25) s.append(' '); String endStr = String.valueOf(totalWork); String curStr = String.valueOf(cmp); while (curStr.length() < endStr.length()) - curStr = " " + curStr; + curStr = " " + curStr; //$NON-NLS-1$ if (pcnt < 100) s.append(' '); if (pcnt < 10) s.append(' '); s.append(pcnt); - s.append("% ("); + s.append("% ("); //$NON-NLS-1$ s.append(curStr); - s.append("/"); + s.append("/"); //$NON-NLS-1$ s.append(endStr); - s.append(")"); + s.append(")"); //$NON-NLS-1$ } private void send(StringBuilder s) { 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 802b966ae7..d257ba93e8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java @@ -593,7 +593,7 @@ public class Tree extends TreeEntry { public String toString() { final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(getId())); - r.append(" T "); + r.append(" T "); //$NON-NLS-1$ r.append(getFullName()); return r.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeFormatter.java index 86c3fc042a..db0694b969 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeFormatter.java @@ -333,6 +333,7 @@ public class TreeFormatter { } } + @SuppressWarnings("nls") @Override public String toString() { byte[] raw = toByteArray(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/UserConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/UserConfig.java index da44a2ef31..60b4819eda 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/UserConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/UserConfig.java @@ -173,7 +173,7 @@ public class UserConfig { private static String getNameInternal(Config rc, String envKey) { // try to get the user name from the local and global configurations. - String username = rc.getString("user", null, "name"); + String username = rc.getString("user", null, "name"); //$NON-NLS-1$ //$NON-NLS-2$ if (username == null) { // try to get the user name for the system property GIT_XXX_NAME @@ -197,7 +197,7 @@ public class UserConfig { private static String getEmailInternal(Config rc, String envKey) { // try to get the email from the local and global configurations. - String email = rc.getString("user", null, "email"); + String email = rc.getString("user", null, "email"); //$NON-NLS-1$ //$NON-NLS-2$ if (email == null) { // try to get the email for the system property GIT_XXX_EMAIL @@ -214,7 +214,7 @@ public class UserConfig { private static String getDefaultEmail() { // try to construct an email String username = getDefaultUserName(); - return username + "@" + system().getHostname(); + return username + "@" + system().getHostname(); //$NON-NLS-1$ } private static SystemReader system() { |