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 | |
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
259 files changed, 1404 insertions, 1329 deletions
diff --git a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java index 3df5e44331..941205af32 100644 --- a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java +++ b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java @@ -66,11 +66,11 @@ public class ConsoleAuthenticator extends CachedAuthenticator { @Override protected PasswordAuthentication promptPasswordAuthentication() { final String realm = formatRealm(); - String username = cons.readLine(MessageFormat.format(ConsoleText.get().usernameFor + " ", realm)); + String username = cons.readLine(MessageFormat.format(ConsoleText.get().usernameFor + " ", realm)); //$NON-NLS-1$ if (username == null || username.isEmpty()) { return null; } - char[] password = cons.readPassword(ConsoleText.get().password + " "); + char[] password = cons.readPassword(ConsoleText.get().password + " "); //$NON-NLS-1$ if (password == null) { password = new char[0]; } @@ -81,10 +81,10 @@ public class ConsoleAuthenticator extends CachedAuthenticator { final StringBuilder realm = new StringBuilder(); if (getRequestorType() == RequestorType.PROXY) { realm.append(getRequestorType()); - realm.append(" "); + realm.append(" "); //$NON-NLS-1$ realm.append(getRequestingHost()); if (getRequestingPort() > 0) { - realm.append(":"); + realm.append(":"); //$NON-NLS-1$ realm.append(getRequestingPort()); } } else { diff --git a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java index 972ce44a4d..91034fd2cc 100644 --- a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java +++ b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java @@ -118,7 +118,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { private boolean get(CredentialItem.StringType item) { if (item.isValueSecure()) { - char[] v = cons.readPassword("%s: ", item.getPromptText()); + char[] v = cons.readPassword("%s: ", item.getPromptText()); //$NON-NLS-1$ if (v != null) { item.setValue(new String(v)); return true; @@ -126,7 +126,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { return false; } } else { - String v = cons.readLine("%s: ", item.getPromptText()); + String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$ if (v != null) { item.setValue(v); return true; @@ -138,7 +138,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { private boolean get(CredentialItem.CharArrayType item) { if (item.isValueSecure()) { - char[] v = cons.readPassword("%s: ", item.getPromptText()); + char[] v = cons.readPassword("%s: ", item.getPromptText()); //$NON-NLS-1$ if (v != null) { item.setValueNoCopy(v); return true; @@ -146,7 +146,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { return false; } } else { - String v = cons.readLine("%s: ", item.getPromptText()); + String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$ if (v != null) { item.setValueNoCopy(v.toCharArray()); return true; @@ -157,13 +157,13 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { } private boolean get(CredentialItem.InformationalMessage item) { - cons.printf("%s\n", item.getPromptText()); + cons.printf("%s\n", item.getPromptText()); //$NON-NLS-1$ cons.flush(); return true; } private boolean get(CredentialItem.YesNoType item) { - String r = cons.readLine("%s [%s/%s]? ", item.getPromptText(), + String r = cons.readLine("%s [%s/%s]? ", item.getPromptText(), //$NON-NLS-1$ ConsoleText.get().answerYes, ConsoleText.get().answerNo); if (r != null) { item.setValue(ConsoleText.get().answerYes.equalsIgnoreCase(r)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java index ed0236b811..e4bca2a496 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java @@ -84,7 +84,7 @@ abstract class AbstractFetchCommand extends TextBuiltin { shownURI = true; } - outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType, + outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType, //$NON-NLS-1$ src, dst); outw.println(); } @@ -150,18 +150,18 @@ abstract class AbstractFetchCommand extends TextBuiltin { if (r == RefUpdate.Result.FORCED) { final String aOld = safeAbbreviate(reader, u.getOldObjectId()); final String aNew = safeAbbreviate(reader, u.getNewObjectId()); - return aOld + "..." + aNew; + return aOld + "..." + aNew; //$NON-NLS-1$ } if (r == RefUpdate.Result.FAST_FORWARD) { final String aOld = safeAbbreviate(reader, u.getOldObjectId()); final String aNew = safeAbbreviate(reader, u.getNewObjectId()); - return aOld + ".." + aNew; + return aOld + ".." + aNew; //$NON-NLS-1$ } if (r == RefUpdate.Result.NO_CHANGE) return "[up to date]"; - return "[" + r.name() + "]"; + return "[" + r.name() + "]"; //$NON-NLS-1$//$NON-NLS-2$ } private String safeAbbreviate(ObjectReader reader, ObjectId id) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java index 8485ab5f38..365d968aa5 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java @@ -83,7 +83,7 @@ class AmazonS3Client extends TextBuiltin { protected void run() throws Exception { final AmazonS3 s3 = new AmazonS3(properties()); - if ("get".equals(op)) { + if ("get".equals(op)) { //$NON-NLS-1$ final URLConnection c = s3.get(bucket, key); int len = c.getContentLength(); final InputStream in = c.getInputStream(); @@ -104,14 +104,14 @@ class AmazonS3Client extends TextBuiltin { in.close(); } - } else if ("ls".equals(op) || "list".equals(op)) { + } else if ("ls".equals(op) || "list".equals(op)) { //$NON-NLS-1$//$NON-NLS-2$ for (final String k : s3.list(bucket, key)) outw.println(k); - } else if ("rm".equals(op) || "delete".equals(op)) { + } else if ("rm".equals(op) || "delete".equals(op)) { //$NON-NLS-1$ //$NON-NLS-2$ s3.delete(bucket, key); - } else if ("put".equals(op)) { + } else if ("put".equals(op)) { //$NON-NLS-1$ final OutputStream os = s3.beginPut(bucket, key, null, null); final byte[] tmp = new byte[2048]; int n; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java index 801e3972fa..341a25b516 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java @@ -143,16 +143,16 @@ class Blame extends TextBuiltin { } if (abbrev == 0) - abbrev = db.getConfig().getInt("core", "abbrev", 7); + abbrev = db.getConfig().getInt("core", "abbrev", 7); //$NON-NLS-1$ //$NON-NLS-2$ if (!showBlankBoundary) - root = db.getConfig().getBoolean("blame", "blankboundary", false); + root = db.getConfig().getBoolean("blame", "blankboundary", false); //$NON-NLS-1$ //$NON-NLS-2$ if (!root) - root = db.getConfig().getBoolean("blame", "showroot", false); + root = db.getConfig().getBoolean("blame", "showroot", false); //$NON-NLS-1$ //$NON-NLS-2$ if (showRawTimestamp) - dateFmt = new SimpleDateFormat("ZZZZ"); + dateFmt = new SimpleDateFormat("ZZZZ"); //$NON-NLS-1$ else - dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZZZ"); + dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZZZ"); //$NON-NLS-1$ BlameGenerator generator = new BlameGenerator(db, file); reader = db.newObjectReader(); @@ -170,7 +170,7 @@ class Blame extends TextBuiltin { } generator.reverse(rangeStart, rangeEnd); } else if (revision != null) { - generator.push(null, db.resolve(revision + "^{commit}")); + generator.push(null, db.resolve(revision + "^{commit}")); //$NON-NLS-1$ } else { generator.push(null, db.resolve(Constants.HEAD)); if (!db.isBare()) { @@ -203,12 +203,12 @@ class Blame extends TextBuiltin { maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line)); } - String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth)); - String numFmt = MessageFormat.format(" %{0}d", + String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth)); //$NON-NLS-1$ + String numFmt = MessageFormat.format(" %{0}d", //$NON-NLS-1$ valueOf(1 + (int) Math.log10(maxSourceLine + 1))); - String lineFmt = MessageFormat.format(" %{0}d) ", + String lineFmt = MessageFormat.format(" %{0}d) ", //$NON-NLS-1$ valueOf(1 + (int) Math.log10(end + 1))); - String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", + String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", //$NON-NLS-1$ valueOf(authorWidth), valueOf(dateWidth)); for (int line = begin; line < end; line++) { @@ -233,8 +233,8 @@ class Blame extends TextBuiltin { private void parseLineRangeOption() { String beginStr, endStr; - if (rangeString.startsWith("/")) { - int c = rangeString.indexOf("/,", 1); + if (rangeString.startsWith("/")) { //$NON-NLS-1$ + int c = rangeString.indexOf("/,", 1); //$NON-NLS-1$ if (c < 0) { beginStr = rangeString; endStr = String.valueOf(end); @@ -249,7 +249,7 @@ class Blame extends TextBuiltin { beginStr = rangeString; endStr = String.valueOf(end); } else if (c == 0) { - beginStr = "0"; + beginStr = "0"; //$NON-NLS-1$ endStr = rangeString.substring(1); } else { beginStr = rangeString.substring(0, c); @@ -257,20 +257,20 @@ class Blame extends TextBuiltin { } } - if (beginStr.equals("")) + if (beginStr.equals("")) //$NON-NLS-1$ begin = 0; - else if (beginStr.startsWith("/")) + else if (beginStr.startsWith("/")) //$NON-NLS-1$ begin = findLine(0, beginStr); else begin = Math.max(0, Integer.parseInt(beginStr) - 1); - if (endStr.equals("")) + if (endStr.equals("")) //$NON-NLS-1$ end = blame.getResultContents().size(); - else if (endStr.startsWith("/")) + else if (endStr.startsWith("/")) //$NON-NLS-1$ end = findLine(begin, endStr); - else if (endStr.startsWith("-")) + else if (endStr.startsWith("-")) //$NON-NLS-1$ end = begin + Integer.parseInt(endStr); - else if (endStr.startsWith("+")) + else if (endStr.startsWith("+")) //$NON-NLS-1$ end = begin + Integer.parseInt(endStr.substring(1)); else end = Math.max(0, Integer.parseInt(endStr) - 1); @@ -278,10 +278,10 @@ class Blame extends TextBuiltin { private int findLine(int b, String regex) { String re = regex.substring(1, regex.length() - 1); - if (!re.startsWith("^")) - re = ".*" + re; - if (!re.endsWith("$")) - re = re + ".*"; + if (!re.startsWith("^")) //$NON-NLS-1$ + re = ".*" + re; //$NON-NLS-1$ + if (!re.endsWith("$")) //$NON-NLS-1$ + re = re + ".*"; //$NON-NLS-1$ Pattern p = Pattern.compile(re); RawText text = blame.getResultContents(); for (int line = b; line < text.size(); line++) { @@ -293,30 +293,30 @@ class Blame extends TextBuiltin { private String path(int line) { String p = blame.getSourcePath(line); - return p != null ? p : ""; + return p != null ? p : ""; //$NON-NLS-1$ } private String author(int line) { PersonIdent author = blame.getSourceAuthor(line); if (author == null) - return ""; + return ""; //$NON-NLS-1$ String name = showAuthorEmail ? author.getEmailAddress() : author .getName(); - return name != null ? name : ""; + return name != null ? name : ""; //$NON-NLS-1$ } private String date(int line) { if (blame.getSourceCommit(line) == null) - return ""; + return ""; //$NON-NLS-1$ PersonIdent author = blame.getSourceAuthor(line); if (author == null) - return ""; + return ""; //$NON-NLS-1$ dateFmt.setTimeZone(author.getTimeZone()); if (!showRawTimestamp) return dateFmt.format(author.getWhen()); - return String.format("%d %s", + return String.format("%d %s", //$NON-NLS-1$ valueOf(author.getWhen().getTime() / 1000L), dateFmt.format(author.getWhen())); } @@ -338,9 +338,9 @@ class Blame extends TextBuiltin { } else if (!root && commit.getParentCount() == 0) { if (showLongRevision) - r = "^" + commit.name().substring(0, OBJECT_ID_STRING_LENGTH - 1); + r = "^" + commit.name().substring(0, OBJECT_ID_STRING_LENGTH - 1); //$NON-NLS-1$ else - r = "^" + reader.abbreviate(commit, abbrev).name(); + r = "^" + reader.abbreviate(commit, abbrev).name(); //$NON-NLS-1$ } else { if (showLongRevision) r = commit.name(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java index c20924d3a6..28e30bcbc2 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java @@ -145,7 +145,7 @@ class Branch extends TextBuiltin { else startBranch = Constants.HEAD; Ref startRef = db.getRef(startBranch); - ObjectId startAt = db.resolve(startBranch + "^0"); + ObjectId startAt = db.resolve(startBranch + "^0"); //$NON-NLS-1$ if (startRef != null) startBranch = startRef.getName(); else @@ -180,7 +180,7 @@ class Branch extends TextBuiltin { if (head != null) { String current = head.getLeaf().getName(); if (current.equals(Constants.HEAD)) - addRef("(no branch)", head); + addRef("(no branch)", head); //$NON-NLS-1$ addRefs(refs, Constants.R_HEADS, !remote); addRefs(refs, Constants.R_REMOTES, remote); @@ -220,7 +220,7 @@ class Branch extends TextBuiltin { outw.print(ref); if (verbose) { final int spaces = maxNameLength - ref.length() + 1; - outw.format("%" + spaces + "s", ""); + outw.format("%" + spaces + "s", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ final ObjectId objectId = refObj.getObjectId(); outw.print(reader.abbreviate(objectId).name()); outw.print(' '); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index 31d8ec8e12..ddae66e72c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -110,7 +110,7 @@ class Clone extends AbstractFetchCommand { dst = new FileRepository(gitdir); dst.create(); final FileBasedConfig dstcfg = dst.getConfig(); - dstcfg.setBoolean("core", null, "bare", false); + dstcfg.setBoolean("core", null, "bare", false); //$NON-NLS-1$ //$NON-NLS-2$ dstcfg.save(); db = dst; @@ -131,8 +131,8 @@ class Clone extends AbstractFetchCommand { final RemoteConfig rc = new RemoteConfig(dstcfg, remoteName); rc.addURI(uri); rc.addFetchRefSpec(new RefSpec().setForceUpdate(true) - .setSourceDestination(Constants.R_HEADS + "*", - Constants.R_REMOTES + remoteName + "/*")); + .setSourceDestination(Constants.R_HEADS + "*", //$NON-NLS-1$ + Constants.R_REMOTES + remoteName + "/*")); //$NON-NLS-1$ rc.update(dstcfg); dstcfg.save(); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java index 700e54118a..2673cc887d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java @@ -132,7 +132,7 @@ public class CommandCatalog { private Enumeration<URL> catalogs() { try { - final String pfx = "META-INF/services/"; + final String pfx = "META-INF/services/"; //$NON-NLS-1$ return ldr.getResources(pfx + TextBuiltin.class.getName()); } catch (IOException err) { return new Vector<URL>().elements(); @@ -143,7 +143,7 @@ public class CommandCatalog { final BufferedReader cIn; try { final InputStream in = cUrl.openStream(); - cIn = new BufferedReader(new InputStreamReader(in, "UTF-8")); + cIn = new BufferedReader(new InputStreamReader(in, "UTF-8")); //$NON-NLS-1$ } catch (IOException err) { // If we cannot read from the service list, go to the next. // @@ -153,7 +153,7 @@ public class CommandCatalog { try { String line; while ((line = cIn.readLine()) != null) { - if (line.length() > 0 && !line.startsWith("#")) + if (line.length() > 0 && !line.startsWith("#")) //$NON-NLS-1$ load(line); } } catch (IOException err) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java index d76a59b60c..f637abad56 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java @@ -76,13 +76,13 @@ public class CommandRef { private CommandRef(final Class<? extends TextBuiltin> clazz, final String cn) { impl = clazz; name = cn; - usage = ""; + usage = ""; //$NON-NLS-1$ } private static String guessName(final Class<? extends TextBuiltin> clazz) { final StringBuilder s = new StringBuilder(); - if (clazz.getName().startsWith("org.eclipse.jgit.pgm.debug.")) - s.append("debug-"); + if (clazz.getName().startsWith("org.eclipse.jgit.pgm.debug.")) //$NON-NLS-1$ + s.append("debug-"); //$NON-NLS-1$ boolean lastWasDash = true; for (final char c : clazz.getSimpleName().toCharArray()) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java index 0963286e9f..a50e744a80 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java @@ -109,7 +109,7 @@ class Commit extends TextBuiltin { if (branchName.startsWith(Constants.R_HEADS)) branchName = branchName.substring(Constants.R_HEADS.length()); } - outw.println("[" + branchName + " " + commit.name() + "] " + outw.println("[" + branchName + " " + commit.name() + "] " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + commit.getShortMessage()); } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java index cf5539f747..0eb220407a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java @@ -103,7 +103,7 @@ class Config extends TextBuiltin { Set<String> names = config.getNames(section); for (String name : names) { for (String value : config.getStringList(section, null, name)) - outw.println(section + "." + name + "=" + value); + outw.println(section + "." + name + "=" + value); //$NON-NLS-1$ //$NON-NLS-2$ } if (names.isEmpty()) { for (String subsection : config.getSubsections(section)) { @@ -111,8 +111,8 @@ class Config extends TextBuiltin { for (String name : names) { for (String value : config.getStringList(section, subsection, name)) - outw.println(section + "." + subsection + "." - + name + "=" + value); + outw.println(section + "." + subsection + "." //$NON-NLS-1$ //$NON-NLS-2$ + + name + "=" + value); //$NON-NLS-1$ } } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java index 465df38407..d38c53ac50 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java @@ -161,8 +161,8 @@ class Diff extends TextBuiltin { @Option(name = "--no-prefix", usage = "usage_noPrefix") void noPrefix(@SuppressWarnings("unused") boolean on) { - diffFmt.setOldPrefix(""); - diffFmt.setNewPrefix(""); + diffFmt.setOldPrefix(""); //$NON-NLS-1$ + diffFmt.setNewPrefix(""); //$NON-NLS-1$ } // END -- Options shared with Log @@ -179,7 +179,7 @@ class Diff extends TextBuiltin { try { if (cached) { if (oldTree == null) { - ObjectId head = db.resolve(HEAD + "^{tree}"); + ObjectId head = db.resolve(HEAD + "^{tree}"); //$NON-NLS-1$ if (head == null) die(MessageFormat.format(CLIText.get().notATree, HEAD)); CanonicalTreeParser p = new CanonicalTreeParser(); @@ -227,21 +227,21 @@ class Diff extends TextBuiltin { for (DiffEntry ent : files) { switch (ent.getChangeType()) { case ADD: - out.println("A\t" + ent.getNewPath()); + out.println("A\t" + ent.getNewPath()); //$NON-NLS-1$ break; case DELETE: - out.println("D\t" + ent.getOldPath()); + out.println("D\t" + ent.getOldPath()); //$NON-NLS-1$ break; case MODIFY: - out.println("M\t" + ent.getNewPath()); + out.println("M\t" + ent.getNewPath()); //$NON-NLS-1$ break; case COPY: - out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // + out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // //$NON-NLS-1$ ent.getOldPath(), ent.getNewPath()); out.println(); break; case RENAME: - out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // + out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // //$NON-NLS-1$ ent.getOldPath(), ent.getNewPath()); out.println(); break; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java index ae11f67317..faaf85f76e 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java @@ -104,7 +104,7 @@ class Glog extends RevWalkTextBuiltin { graphPane.getCommitList().source(walk); graphPane.getCommitList().fillTo(Integer.MAX_VALUE); - frame.setTitle("[" + repoName() + "]"); + frame.setTitle("[" + repoName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ frame.pack(); frame.setVisible(true); return graphPane.getCommitList().size(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java index 6ad27ae41a..eaba6e5138 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java @@ -171,8 +171,8 @@ class Log extends RevWalkTextBuiltin { @Option(name = "--no-prefix", usage = "usage_noPrefix") void noPrefix(@SuppressWarnings("unused") boolean on) { - diffFmt.setOldPrefix(""); - diffFmt.setNewPrefix(""); + diffFmt.setOldPrefix(""); //$NON-NLS-1$ + diffFmt.setNewPrefix(""); //$NON-NLS-1$ } // END -- Options shared with Diff @@ -238,18 +238,18 @@ class Log extends RevWalkTextBuiltin { @Override protected void show(final RevCommit c) throws Exception { outw.print(CLIText.get().commitLabel); - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ c.getId().copyTo(outbuffer, outw); if (decorate) { Collection<Ref> list = allRefsByPeeledObjectId.get(c); if (list != null) { - outw.print(" ("); + outw.print(" ("); //$NON-NLS-1$ for (Iterator<Ref> i = list.iterator(); i.hasNext(); ) { outw.print(i.next().getName()); if (i.hasNext()) - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ } - outw.print(")"); + outw.print(")"); //$NON-NLS-1$ } } outw.println(); @@ -260,9 +260,9 @@ class Log extends RevWalkTextBuiltin { dateFormatter.formatDate(author))); outw.println(); - final String[] lines = c.getFullMessage().split("\n"); + final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$ for (final String s : lines) { - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ outw.print(s); outw.println(); } @@ -324,16 +324,16 @@ class Log extends RevWalkTextBuiltin { outw.println(); outw.print("Notes"); if (label != null) { - outw.print(" ("); + outw.print(" ("); //$NON-NLS-1$ outw.print(label); - outw.print(")"); + outw.print(")"); //$NON-NLS-1$ } - outw.println(":"); + outw.println(":"); //$NON-NLS-1$ try { RawText rawText = new RawText(argWalk.getObjectReader() .open(blobId).getCachedBytes(Integer.MAX_VALUE)); for (int i = 0; i < rawText.size(); i++) { - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ outw.println(rawText.getString(i)); } } catch (LargeObjectException e) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java index d59451c55e..282c79d162 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java @@ -71,7 +71,7 @@ class LsRemote extends TextBuiltin { for (final Ref r : c.getRefs()) { show(r.getObjectId(), r.getName()); if (r.getPeeledObjectId() != null) - show(r.getPeeledObjectId(), r.getName() + "^{}"); + show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$ } } finally { c.close(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index 6c5cd2767c..0d72e639a8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -128,7 +128,7 @@ public class Main { && err instanceof TransportException) System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getCause().getMessage())); - if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { + if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { //$NON-NLS-1$ System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); @@ -163,7 +163,7 @@ public class Main { if (argv.length == 0 || help) { final String ex = clp.printExample(ExampleMode.ALL, CLIText.get().resourceBundle()); - writer.println("jgit" + ex + " command [ARG ...]"); + writer.println("jgit" + ex + " command [ARG ...]"); //$NON-NLS-1$ if (help) { writer.println(); clp.printUsage(writer, CLIText.get().resourceBundle()); @@ -226,8 +226,8 @@ public class Main { private static boolean installConsole() { try { - install("org.eclipse.jgit.console.ConsoleAuthenticator"); - install("org.eclipse.jgit.console.ConsoleCredentialsProvider"); + install("org.eclipse.jgit.console.ConsoleAuthenticator"); //$NON-NLS-1$ + install("org.eclipse.jgit.console.ConsoleCredentialsProvider"); //$NON-NLS-1$ return true; } catch (ClassNotFoundException e) { return false; @@ -253,7 +253,7 @@ public class Main { throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException { try { - Class.forName(name).getMethod("install").invoke(null); + Class.forName(name).getMethod("install").invoke(null); //$NON-NLS-1$ } catch (InvocationTargetException e) { if (e.getCause() instanceof RuntimeException) throw (RuntimeException) e.getCause(); @@ -276,23 +276,23 @@ public class Main { * the value in <code>http_proxy</code> is unsupportable. */ private static void configureHttpProxy() throws MalformedURLException { - final String s = System.getenv("http_proxy"); - if (s == null || s.equals("")) + final String s = System.getenv("http_proxy"); //$NON-NLS-1$ + if (s == null || s.equals("")) //$NON-NLS-1$ return; - final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); - if (!"http".equals(u.getProtocol())) + final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$ + if (!"http".equals(u.getProtocol())) //$NON-NLS-1$ throw new MalformedURLException(MessageFormat.format(CLIText.get().invalidHttpProxyOnlyHttpSupported, s)); final String proxyHost = u.getHost(); final int proxyPort = u.getPort(); - System.setProperty("http.proxyHost", proxyHost); + System.setProperty("http.proxyHost", proxyHost); //$NON-NLS-1$ if (proxyPort > 0) - System.setProperty("http.proxyPort", String.valueOf(proxyPort)); + System.setProperty("http.proxyPort", String.valueOf(proxyPort)); //$NON-NLS-1$ final String userpass = u.getUserInfo(); - if (userpass != null && userpass.contains(":")) { + if (userpass != null && userpass.contains(":")) { //$NON-NLS-1$ final int c = userpass.indexOf(':'); final String user = userpass.substring(0, c); final String pass = userpass.substring(c + 1); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java index 6fe68810a1..7eaa5fa351 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java @@ -103,7 +103,7 @@ class Merge extends TextBuiltin { // determine the other revision we want to merge with HEAD final Ref srcRef = db.getRef(ref); - final ObjectId src = db.resolve(ref + "^{commit}"); + final ObjectId src = db.resolve(ref + "^{commit}"); //$NON-NLS-1$ if (src == null) throw die(MessageFormat.format( CLIText.get().refDoesNotExistOrNoCommit, ref)); @@ -144,11 +144,11 @@ class Merge extends TextBuiltin { case DIRTY_WORKTREE: case DIRTY_INDEX: outw.println(CLIText.get().dontOverwriteLocalChanges); - outw.println(" " + entry.getKey()); + outw.println(" " + entry.getKey()); //$NON-NLS-1$ break; case COULD_NOT_DELETE: outw.println(CLIText.get().cannotDeleteFile); - outw.println(" " + entry.getKey()); + outw.println(" " + entry.getKey()); //$NON-NLS-1$ break; } break; @@ -157,7 +157,7 @@ class Merge extends TextBuiltin { if (!isMergedInto(oldHead, src)) name = mergeStrategy.getName(); else - name = "recursive"; + name = "recursive"; //$NON-NLS-1$ outw.println(MessageFormat.format(CLIText.get().mergeMadeBy, name)); break; case MERGED_SQUASHED: diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java index 534e6de250..8239c96d4c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java @@ -194,7 +194,7 @@ class Push extends TextBuiltin { final char flag = fastForward ? ' ' : '+'; final String summary = safeAbbreviate(reader, oldRef .getObjectId()) - + (fastForward ? ".." : "...") + + (fastForward ? ".." : "...") //$NON-NLS-1$ //$NON-NLS-2$ + safeAbbreviate(reader, rru.getNewObjectId()); final String message = fastForward ? null : CLIText.get().forcedUpdate; printUpdateLine(flag, summary, srcRef, remoteName, message); @@ -252,14 +252,14 @@ class Push extends TextBuiltin { private void printUpdateLine(final char flag, final String summary, final String srcRef, final String destRef, final String message) throws IOException { - outw.format(" %c %-17s", valueOf(flag), summary); + outw.format(" %c %-17s", valueOf(flag), summary); //$NON-NLS-1$ if (srcRef != null) - outw.format(" %s ->", abbreviateRef(srcRef, true)); - outw.format(" %s", abbreviateRef(destRef, true)); + outw.format(" %s ->", abbreviateRef(srcRef, true)); //$NON-NLS-1$ + outw.format(" %s", abbreviateRef(destRef, true)); //$NON-NLS-1$ if (message != null) - outw.format(" (%s)", message); + outw.format(" (%s)", message); //$NON-NLS-1$ outw.println(); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java index 4d877acd5c..4ac7ade537 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java @@ -73,14 +73,14 @@ class Reflog extends TextBuiltin { private String toString(ReflogEntry entry, int i) {
final StringBuilder s = new StringBuilder();
s.append(entry.getNewId().abbreviate(7).name());
- s.append(" ");
+ s.append(" "); //$NON-NLS-1$
s.append(ref == null ? Constants.HEAD : Repository.shortenRefName(ref));
- s.append("@{" + i + "}:");
- s.append(" ");
+ s.append("@{" + i + "}:"); //$NON-NLS-1$ //$NON-NLS-2$
+ s.append(" "); //$NON-NLS-1$
// temporary workaround for bug 393463
if (entry.getOldId().equals(ObjectId.zeroId()))
- s.append(entry.getComment().replaceFirst("^commit:",
- "commit (initial):"));
+ s.append(entry.getComment().replaceFirst("^commit:", //$NON-NLS-1$
+ "commit (initial):")); //$NON-NLS-1$
else
s.append(entry.getComment());
return s.toString();
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java index 13dad7a9a0..7d6a1713bc 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java @@ -154,14 +154,14 @@ class Show extends TextBuiltin { @Option(name = "--no-prefix", usage = "usage_noPrefix") void noPrefix(@SuppressWarnings("unused") boolean on) { - diffFmt.setOldPrefix(""); - diffFmt.setNewPrefix(""); + diffFmt.setOldPrefix(""); //$NON-NLS-1$ + diffFmt.setNewPrefix(""); //$NON-NLS-1$ } // END -- Options shared with Diff Show() { - fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); + fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); //$NON-NLS-1$ } @SuppressWarnings("boxing") @@ -198,7 +198,7 @@ class Show extends TextBuiltin { break; case Constants.OBJ_TREE: - outw.print("tree "); + outw.print("tree "); //$NON-NLS-1$ outw.print(objectName); outw.println(); outw.println(); @@ -225,7 +225,7 @@ class Show extends TextBuiltin { private void show(RevTag tag) throws IOException { outw.print(CLIText.get().tagLabel); - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ outw.print(tag.getTagName()); outw.println(); @@ -241,9 +241,9 @@ class Show extends TextBuiltin { } outw.println(); - final String[] lines = tag.getFullMessage().split("\n"); + final String[] lines = tag.getFullMessage().split("\n"); //$NON-NLS-1$ for (final String s : lines) { - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ outw.print(s); outw.println(); } @@ -261,7 +261,7 @@ class Show extends TextBuiltin { outw.print(walk.getPathString()); final FileMode mode = walk.getFileMode(0); if (mode == FileMode.TREE) - outw.print("/"); + outw.print("/"); //$NON-NLS-1$ outw.println(); } } @@ -270,7 +270,7 @@ class Show extends TextBuiltin { char[] outbuffer = new char[Constants.OBJECT_ID_LENGTH * 2]; outw.print(CLIText.get().commitLabel); - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ c.getId().copyTo(outbuffer, outw); outw.println(); @@ -284,9 +284,9 @@ class Show extends TextBuiltin { fmt.format(author.getWhen()))); outw.println(); - final String[] lines = c.getFullMessage().split("\n"); + final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$ for (final String s : lines) { - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ outw.print(s); outw.println(); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java index 3e0f661097..2c621ac897 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java @@ -60,7 +60,7 @@ class ShowRef extends TextBuiltin { for (final Ref r : getSortedRefs()) { show(r.getObjectId(), r.getName()); if (r.getPeeledObjectId() != null) - show(r.getPeeledObjectId(), r.getName() + "^{}"); + show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java index 6abbfb0354..4d2308e214 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java @@ -99,7 +99,7 @@ class Status extends TextBuiltin { int nbNotStagedForCommit = notStagedForCommit.size(); if (nbNotStagedForCommit > 0) { if (!firstHeader) - printSectionHeader(""); + printSectionHeader(""); //$NON-NLS-1$ printSectionHeader(CLIText.get().changesNotStagedForCommit); printList(CLIText.get().statusModified, CLIText.get().statusRemoved, null, notStagedForCommit, @@ -109,7 +109,7 @@ class Status extends TextBuiltin { int nbUnmerged = unmerged.size(); if (nbUnmerged > 0) { if (!firstHeader) - printSectionHeader(""); + printSectionHeader(""); //$NON-NLS-1$ printSectionHeader(CLIText.get().unmergedPaths); printList(unmerged); firstHeader = false; @@ -117,7 +117,7 @@ class Status extends TextBuiltin { int nbUntracked = untracked.size(); if (nbUntracked > 0) { if (!firstHeader) - printSectionHeader(""); + printSectionHeader(""); //$NON-NLS-1$ printSectionHeader(CLIText.get().untrackedFiles); printList(untracked); } @@ -127,8 +127,8 @@ class Status extends TextBuiltin { throws IOException { outw.println(CLIText.formatLine(MessageFormat .format(pattern, arguments))); - if (!pattern.equals("")) - outw.println(CLIText.formatLine("")); + if (!pattern.equals("")) //$NON-NLS-1$ + outw.println(CLIText.formatLine("")); //$NON-NLS-1$ outw.flush(); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java index 665b79dfa0..23a16ab746 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java @@ -68,7 +68,7 @@ class Tag extends TextBuiltin { private boolean force; @Option(name = "-m", metaVar = "metaVar_message", usage = "usage_tagMessage") - private String message = ""; + private String message = ""; //$NON-NLS-1$ @Argument(index = 0, metaVar = "metaVar_name") private String tagName; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java index 87437107d8..c4e89c3430 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java @@ -134,8 +134,7 @@ public abstract class TextBuiltin { protected void init(final Repository repository, final String gitDir) { try { final String outputEncoding = repository != null ? repository - .getConfig() - .getString("i18n", null, "logOutputEncoding") : null; + .getConfig().getString("i18n", null, "logOutputEncoding") : null; //$NON-NLS-1$ //$NON-NLS-2$ if (outs == null) outs = new FileOutputStream(FileDescriptor.out); BufferedWriter bufw; @@ -208,7 +207,7 @@ public abstract class TextBuiltin { * @param clp */ public void printUsageAndExit(final CmdLineParser clp) { - printUsageAndExit("", clp); + printUsageAndExit("", clp); //$NON-NLS-1$ } /** @@ -220,7 +219,7 @@ public abstract class TextBuiltin { public void printUsageAndExit(final String message, final CmdLineParser clp) { PrintWriter writer = new PrintWriter(System.err); writer.println(message); - writer.print("jgit "); + writer.print("jgit "); //$NON-NLS-1$ writer.print(commandName); clp.printSingleLineUsage(writer, getResourceBundle()); writer.println(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java index 2a67b389ed..663f16c6e4 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java @@ -260,11 +260,11 @@ class DiffAlgorithms extends TextBuiltin { "Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on"); outw.format("%-25s %12s ( %12s %12s )\n", // "", "", "N=" + minN, "N=" + maxN); - outw.println("-----------------------------------------------------" - + "----------------"); + outw.println("-----------------------------------------------------" //$NON-NLS-1$ + + "----------------"); //$NON-NLS-1$ for (Test test : all) { - outw.format("%-25s %12d ( %12d %12d )", // + outw.format("%-25s %12d ( %12d %12d )", // //$NON-NLS-1$ test.algorithm.name, // valueOf(test.runningTimeNanos), // valueOf(test.minN.runningTimeNanos), // diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java index 9f6bcda2a1..ab4ec2f72b 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java @@ -59,7 +59,7 @@ class ReadDirCache extends TextBuiltin { for (int i = 0; i < cnt; i++) db.readDirCache(); final long end = System.currentTimeMillis(); - outw.print(" "); + outw.print(" "); //$NON-NLS-1$ outw.println(MessageFormat.format(CLIText.get().averageMSPerRead, valueOf((end - start) / cnt))); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index b01734e00a..7f1e332ff9 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -95,7 +95,7 @@ import org.kohsuke.args4j.Option; * <p> */ class RebuildCommitGraph extends TextBuiltin { - private static final String REALLY = "--destroy-this-repository"; + private static final String REALLY = "--destroy-this-repository"; //$NON-NLS-1$ @Option(name = REALLY, usage = "usage_approveDestructionOfRepository") boolean really; @@ -138,7 +138,7 @@ class RebuildCommitGraph extends TextBuiltin { try { String line; while ((line = br.readLine()) != null) { - final String[] parts = line.split("[ \t]{1,}"); + final String[] parts = line.split("[ \t]{1,}"); //$NON-NLS-1$ final ObjectId oldId = ObjectId.fromString(parts[0]); try { rw.parseCommit(oldId); @@ -165,8 +165,8 @@ class RebuildCommitGraph extends TextBuiltin { pm.beginTask("Rewriting commits", queue.size()); final ObjectInserter oi = db.newObjectInserter(); final ObjectId emptyTree = oi.insert(Constants.OBJ_TREE, new byte[] {}); - final PersonIdent me = new PersonIdent("jgit rebuild-commitgraph", - "rebuild-commitgraph@localhost"); + final PersonIdent me = new PersonIdent("jgit rebuild-commitgraph", //$NON-NLS-1$ + "rebuild-commitgraph@localhost"); //$NON-NLS-1$ while (!queue.isEmpty()) { final ListIterator<ToRewrite> itr = queue .listIterator(queue.size()); @@ -196,7 +196,7 @@ class RebuildCommitGraph extends TextBuiltin { newc.setAuthor(new PersonIdent(me, new Date(t.commitTime))); newc.setCommitter(newc.getAuthor()); newc.setParentIds(newParents); - newc.setMessage("ORIGINAL " + t.oldId.name() + "\n"); + newc.setMessage("ORIGINAL " + t.oldId.name() + "\n"); //$NON-NLS-2$ t.newId = oi.insert(newc); rewrites.put(t.oldId, t.newId); pm.update(1); @@ -277,7 +277,7 @@ class RebuildCommitGraph extends TextBuiltin { try { String line; while ((line = br.readLine()) != null) { - final String[] parts = line.split("[ \t]{1,}"); + final String[] parts = line.split("[ \t]{1,}"); //$NON-NLS-1$ final ObjectId origId = ObjectId.fromString(parts[0]); final String type = parts[1]; final String name = parts[2]; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java index e96e6543c6..a0b461d4ee 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java @@ -103,7 +103,7 @@ class ShowCommands extends TextBuiltin { final ClassLoader ldr = c.getImplementationClassLoader(); String cn = c.getImplementationClassName(); - cn = cn.replace('.', '/') + ".class"; + cn = cn.replace('.', '/') + ".class"; //$NON-NLS-1$ final URL url = ldr.getResource(cn); if (url == null) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java index 040b2e50e7..e69738c09f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java @@ -71,7 +71,7 @@ class ShowDirCache extends TextBuiltin { final int stage = ent.getStage(); outw.print(mode); - outw.format(" %6d", valueOf(len)); + outw.format(" %6d", valueOf(len)); //$NON-NLS-1$ outw.print(' '); outw.print(fmt.format(mtime)); outw.print(' '); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java index df7058f138..e2da0d5fce 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java @@ -347,19 +347,19 @@ class TextHashFunctions extends TextBuiltin { File parent = db.getDirectory().getParentFile(); if (name.equals(Constants.DOT_GIT) && parent != null) name = parent.getName(); - outw.println(name + ":"); + outw.println(name + ":"); //$NON-NLS-1$ } outw.format(" %6d files; %5d avg. unique lines/file\n", // valueOf(fileCnt), // valueOf(lineCnt / fileCnt)); outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len"); - outw.println("-----------------------------------------------"); + outw.println("-----------------------------------------------"); //$NON-NLS-1$ String lastHashName = null; for (Function fun : all) { String hashName = fun.hash.name; if (hashName.equals(lastHashName)) - hashName = ""; - outw.format("%-20s %-15s %9d\n", // + hashName = ""; //$NON-NLS-1$ + outw.format("%-20s %-15s %9d\n", // //$NON-NLS-1$ hashName, // fun.fold.name, // valueOf(fun.maxChainLength)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java index 6653209a65..a6ec91408d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java @@ -59,7 +59,7 @@ import org.kohsuke.args4j.Option; @Command(name = "eclipse-ipzilla", common = false, usage = "usage_synchronizeIPZillaData") class Ipzilla extends TextBuiltin { @Option(name = "--url", metaVar = "metaVar_url", usage = "usage_IPZillaURL") - private String url = "https://dev.eclipse.org/ipzilla/"; + private String url = "https://dev.eclipse.org/ipzilla/"; //$NON-NLS-1$ @Option(name = "--username", metaVar = "metaVar_user", usage = "usage_IPZillaUsername") private String username; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java index b14130f4aa..cea32099e2 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java @@ -127,13 +127,13 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { final ArrayList<String> tmp = new ArrayList<String>(args.length); for (int argi = 0; argi < args.length; argi++) { final String str = args[argi]; - if (str.equals("--")) { + if (str.equals("--")) { //$NON-NLS-1$ while (argi < args.length) tmp.add(args[argi++]); break; } - if (str.startsWith("--")) { + if (str.startsWith("--")) { //$NON-NLS-1$ final int eq = str.indexOf('='); if (eq > 0) { tmp.add(str.substring(0, eq)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java index bf1753634c..4d917dcbd3 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java @@ -88,12 +88,12 @@ public class RevCommitHandler extends OptionHandler<RevCommit> { String name = params.getParameter(0); boolean interesting = true; - if (name.startsWith("^")) { + if (name.startsWith("^")) { //$NON-NLS-1$ name = name.substring(1); interesting = false; } - final int dot2 = name.indexOf(".."); + final int dot2 = name.indexOf(".."); //$NON-NLS-1$ if (dot2 != -1) { if (!option.isMultiValued()) throw new CmdLineException(MessageFormat.format(CLIText.get().onlyOneMetaVarExpectedIn diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java index e699a72cfa..25d9f97ced 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java @@ -176,7 +176,7 @@ final class AWTPlotRenderer extends AbstractPlotRenderer<SwingLane, Color> g.setBackground(new Color(colorComponents[0],colorComponents[1],colorComponents[2])); } if (txt.length() > 12) - txt = txt.substring(0,11) + "\u2026"; // ellipsis "…" (in UTF-8) + txt = txt.substring(0,11) + "\u2026"; // ellipsis "…" (in UTF-8) //$NON-NLS-1$ final int texth = g.getFontMetrics().getHeight(); int textw = g.getFontMetrics().stringWidth(txt); diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java index 6728d616da..486bbf6ab6 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java @@ -75,13 +75,13 @@ public class AwtAuthenticator extends CachedAuthenticator { final StringBuilder instruction = new StringBuilder(); instruction.append(UIText.get().enterUsernameAndPasswordFor); - instruction.append(" "); + instruction.append(" "); //$NON-NLS-1$ if (getRequestorType() == RequestorType.PROXY) { instruction.append(getRequestorType()); - instruction.append(" "); + instruction.append(" "); //$NON-NLS-1$ instruction.append(getRequestingHost()); if (getRequestingPort() > 0) { - instruction.append(":"); + instruction.append(":"); //$NON-NLS-1$ instruction.append(getRequestingPort()); } } else { diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java index 9c9d1f4a5c..0752dceec4 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java @@ -94,7 +94,8 @@ public class CommitGraphPane extends JTable { int h = 0; for (int i = 0; i<getColumnCount(); ++i) { TableCellRenderer renderer = getDefaultRenderer(getColumnClass(i)); - Component c = renderer.getTableCellRendererComponent(this, "ÅOj", false, false, 0, i); + Component c = renderer.getTableCellRendererComponent(this, + "ÅOj", false, false, 0, i); //$NON-NLS-1$ h = Math.max(h, c.getPreferredSize().height); } setRowHeight(h + getRowMargin()); @@ -129,7 +130,7 @@ public class CommitGraphPane extends JTable { final TableColumn author = cols.getColumn(1); final TableColumn date = cols.getColumn(2); - graph.setHeaderValue(""); + graph.setHeaderValue(""); //$NON-NLS-1$ author.setHeaderValue(UIText.get().author); date.setHeaderValue(UIText.get().date); @@ -186,9 +187,9 @@ public class CommitGraphPane extends JTable { final String valueStr; if (pi != null) - valueStr = pi.getName() + " <" + pi.getEmailAddress() + ">"; + valueStr = pi.getName() + " <" + pi.getEmailAddress() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ else - valueStr = ""; + valueStr = ""; //$NON-NLS-1$ return super.getTableCellRendererComponent(table, valueStr, isSelected, hasFocus, row, column); } @@ -198,7 +199,7 @@ public class CommitGraphPane extends JTable { private static final long serialVersionUID = 1L; private final DateFormat fmt = new SimpleDateFormat( - "yyyy-MM-dd HH:mm:ss"); + "yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$ public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, @@ -209,7 +210,7 @@ public class CommitGraphPane extends JTable { if (pi != null) valueStr = fmt.format(pi.getWhen()); else - valueStr = ""; + valueStr = ""; //$NON-NLS-1$ return super.getTableCellRendererComponent(table, valueStr, isSelected, hasFocus, row, column); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java index f89f3e480c..ef2e987b4e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java @@ -130,7 +130,7 @@ public class AddCommand extends GitCommand<DirCache> { checkCallable(); DirCache dc = null; boolean addAll = false; - if (filepatterns.contains(".")) + if (filepatterns.contains(".")) //$NON-NLS-1$ addAll = true; ObjectInserter inserter = repo.newObjectInserter(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java index e6070eccf8..2bda76c323 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java @@ -227,14 +227,14 @@ public class ApplyCommand extends GitCommand<ApplyResult> { } } if (!isNoNewlineAtEndOfFile(fh)) - newLines.add(""); + newLines.add(""); //$NON-NLS-1$ if (!rt.isMissingNewlineAtEnd()) - oldLines.add(""); + oldLines.add(""); //$NON-NLS-1$ if (!isChanged(oldLines, newLines)) return; // don't touch the file StringBuilder sb = new StringBuilder(); final String eol = rt.size() == 0 - || (rt.size() == 1 && rt.isMissingNewlineAtEnd()) ? "\n" : rt + || (rt.size() == 1 && rt.isMissingNewlineAtEnd()) ? "\n" : rt //$NON-NLS-1$ .getLineDelimiter(); for (String l : newLines) { sb.append(l); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java index ef227dc854..eb447f3142 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java @@ -218,7 +218,7 @@ public class CheckoutCommand extends GitCommand<Ref> { Ref headRef = repo.getRef(Constants.HEAD); String shortHeadRef = getShortBranchName(headRef); - String refLogMessage = "checkout: moving from " + shortHeadRef; + String refLogMessage = "checkout: moving from " + shortHeadRef; //$NON-NLS-1$ ObjectId branch = repo.resolve(name); if (branch == null) throw new RefNotFoundException(MessageFormat.format(JGitText @@ -252,7 +252,7 @@ public class CheckoutCommand extends GitCommand<Ref> { String toName = Repository.shortenRefName(name); RefUpdate refUpdate = repo.updateRef(Constants.HEAD, ref == null); refUpdate.setForceUpdate(force); - refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); + refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); //$NON-NLS-1$ Result updateResult; if (ref != null) updateResult = refUpdate.link(ref.getName()); @@ -469,7 +469,7 @@ public class CheckoutCommand extends GitCommand<Ref> { && (name == null || !Repository .isValidRefName(Constants.R_HEADS + name))) throw new InvalidRefNameException(MessageFormat.format(JGitText - .get().branchNameInvalid, name == null ? "<null>" : name)); + .get().branchNameInvalid, name == null ? "<null>" : name)); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java index 3d3b47d089..dca7197d18 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java @@ -148,7 +148,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { String ourName = calculateOurName(headRef); String cherryPickName = srcCommit.getId().abbreviate(7).name() - + " " + srcCommit.getShortMessage(); + + " " + srcCommit.getShortMessage(); //$NON-NLS-1$ ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE .newMerger(repo); @@ -168,7 +168,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { newHead = new Git(getRepository()).commit() .setMessage(srcCommit.getFullMessage()) .setReflogComment( - "cherry-pick: " + "cherry-pick: " //$NON-NLS-1$ + srcCommit.getShortMessage()) .setAuthor(srcCommit.getAuthorIdent()).call(); cherryPickedRefs.add(src); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java index f76d98afd3..b42c80f67b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java @@ -131,7 +131,7 @@ public class CleanCommand extends GitCommand<Set<String>> { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); - files.add(dir + "/"); + files.add(dir + "/"); //$NON-NLS-1$ } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index e4c55698e0..22bda612fb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -158,7 +158,8 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> { + config.getName(); RefSpec refSpec = new RefSpec(); refSpec = refSpec.setForceUpdate(true); - refSpec = refSpec.setSourceDestination(Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$ + refSpec = refSpec.setSourceDestination( + Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$ config.addFetchRefSpec(refSpec); config.update(clonedRepo.getConfig()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java index eab2e8d4b8..5f559bcbf8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java @@ -159,7 +159,7 @@ public class CommitCommand extends GitCommand<RevCommit> { Git git = new Git(repo); try { git.add() - .addFilepattern(".") + .addFilepattern(".") //$NON-NLS-1$ .setUpdate(true).call(); } catch (NoFilepatternException e) { // should really not happen @@ -173,7 +173,7 @@ public class CommitCommand extends GitCommand<RevCommit> { JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); // determine the current HEAD and the commit it is referring to - ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}"); + ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$ if (headId == null && amend) throw new WrongRepositoryStateException( JGitText.get().commitAmendOnInitialNotPossible); @@ -226,7 +226,7 @@ public class CommitCommand extends GitCommand<RevCommit> { if (reflogComment != null) { ru.setRefLogMessage(reflogComment, false); } else { - String prefix = amend ? "commit (amend): " + String prefix = amend ? "commit (amend): " //$NON-NLS-1$ : "commit: "; ru.setRefLogMessage( prefix + revCommit.getShortMessage(), false); @@ -287,9 +287,9 @@ public class CommitCommand extends GitCommand<RevCommit> { author, committer, message); message = ChangeIdUtil.insertId(message, changeId); if (changeId != null) - message = message.replaceAll("\nChange-Id: I" - + ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" - + changeId.getName() + "\n"); + message = message.replaceAll("\nChange-Id: I" //$NON-NLS-1$ + + ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" //$NON-NLS-1$ //$NON-NLS-2$ + + changeId.getName() + "\n"); //$NON-NLS-1$ } private DirCache createTemporaryIndex(ObjectId headId, DirCache index) @@ -455,7 +455,7 @@ public class CommitCommand extends GitCommand<RevCommit> { while (true) { if (p.equals(o)) return i; - int l = p.lastIndexOf("/"); + int l = p.lastIndexOf("/"); //$NON-NLS-1$ if (l < 1) break; p = p.substring(0, l); @@ -633,8 +633,8 @@ public class CommitCommand extends GitCommand<RevCommit> { checkCallable(); if (!only.isEmpty()) throw new JGitInternalException(MessageFormat.format( - JGitText.get().illegalCombinationOfArguments, "--all", - "--only")); + JGitText.get().illegalCombinationOfArguments, "--all", //$NON-NLS-1$ + "--only")); //$NON-NLS-1$ this.all = all; return this; } @@ -668,9 +668,9 @@ public class CommitCommand extends GitCommand<RevCommit> { checkCallable(); if (all) throw new JGitInternalException(MessageFormat.format( - JGitText.get().illegalCombinationOfArguments, "--only", - "--all")); - String o = only.endsWith("/") ? only.substring(0, only.length() - 1) + JGitText.get().illegalCombinationOfArguments, "--only", //$NON-NLS-1$ + "--all")); //$NON-NLS-1$ + String o = only.endsWith("/") ? only.substring(0, only.length() - 1) //$NON-NLS-1$ : only; // ignore duplicates if (!this.only.contains(o)) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java index 0cd478cd54..aa1484c0f9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java @@ -144,7 +144,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { // determine whether we are based on a commit, // a branch, or a tag and compose the reflog message String refLogMessage; - String baseBranch = ""; + String baseBranch = ""; //$NON-NLS-1$ if (startPointFullName == null) { String baseCommit; if (startCommit != null) @@ -155,26 +155,26 @@ public class CreateBranchCommand extends GitCommand<Ref> { baseCommit = commit.getShortMessage(); } if (exists) - refLogMessage = "branch: Reset start-point to commit " + refLogMessage = "branch: Reset start-point to commit " //$NON-NLS-1$ + baseCommit; else - refLogMessage = "branch: Created from commit " + baseCommit; + refLogMessage = "branch: Created from commit " + baseCommit; //$NON-NLS-1$ } else if (startPointFullName.startsWith(Constants.R_HEADS) || startPointFullName.startsWith(Constants.R_REMOTES)) { baseBranch = startPointFullName; if (exists) - refLogMessage = "branch: Reset start-point to branch " + refLogMessage = "branch: Reset start-point to branch " //$NON-NLS-1$ + startPointFullName; // TODO else - refLogMessage = "branch: Created from branch " + baseBranch; + refLogMessage = "branch: Created from branch " + baseBranch; //$NON-NLS-1$ } else { startAt = revWalk.peel(revWalk.parseAny(startAt)); if (exists) - refLogMessage = "branch: Reset start-point to tag " + refLogMessage = "branch: Reset start-point to tag " //$NON-NLS-1$ + startPointFullName; else - refLogMessage = "branch: Created from tag " + refLogMessage = "branch: Created from tag " //$NON-NLS-1$ + startPointFullName; } @@ -233,9 +233,9 @@ public class CreateBranchCommand extends GitCommand<Ref> { String autosetupflag = repo.getConfig().getString( ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPMERGE); - if ("false".equals(autosetupflag)) { + if ("false".equals(autosetupflag)) { //$NON-NLS-1$ doConfigure = false; - } else if ("always".equals(autosetupflag)) { + } else if ("always".equals(autosetupflag)) { //$NON-NLS-1$ doConfigure = true; } else { // in this case, the default is to configure @@ -246,8 +246,8 @@ public class CreateBranchCommand extends GitCommand<Ref> { if (doConfigure) { StoredConfig config = repo.getConfig(); - String[] tokens = baseBranch.split("/", 4); - boolean isRemote = tokens[1].equals("remotes"); + String[] tokens = baseBranch.split("/", 4); //$NON-NLS-1$ + boolean isRemote = tokens[1].equals("remotes"); //$NON-NLS-1$ if (isRemote) { // refs/remotes/<remote name>/<branch> String remoteName = tokens[2]; @@ -262,7 +262,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { } else { // set "." as remote config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, - name, ConfigConstants.CONFIG_KEY_REMOTE, "."); + name, ConfigConstants.CONFIG_KEY_REMOTE, "."); //$NON-NLS-1$ config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, name, ConfigConstants.CONFIG_KEY_MERGE, baseBranch); } @@ -298,7 +298,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { if (name == null || !Repository.isValidRefName(Constants.R_HEADS + name)) throw new InvalidRefNameException(MessageFormat.format(JGitText - .get().branchNameInvalid, name == null ? "<null>" : name)); + .get().branchNameInvalid, name == null ? "<null>" : name)); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java index 0d03162543..30b27f22c7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java @@ -138,7 +138,7 @@ public class DeleteBranchCommand extends GitCommand<List<String>> { JGitText.get().cannotDeleteCheckedOutBranch, branchName)); RefUpdate update = repo.updateRef(fullName); - update.setRefLogMessage("branch deleted", false); + update.setRefLogMessage("branch deleted", false); //$NON-NLS-1$ update.setForceUpdate(true); Result deleteResult = update.delete(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java index 9b4476d628..f31198f946 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java @@ -120,7 +120,7 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { try { if (cached) { if (oldTree == null) { - ObjectId head = repo.resolve(HEAD + "^{tree}"); + ObjectId head = repo.resolve(HEAD + "^{tree}"); //$NON-NLS-1$ if (head == null) throw new NoHeadException(JGitText.get().cannotReadTree); CanonicalTreeParser p = new CanonicalTreeParser(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java index 8777be5546..bf43e90d42 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java @@ -80,7 +80,7 @@ public class InitCommand implements Callable<Git> { d = new File(d, Constants.DOT_GIT); builder.setGitDir(d); } else if (builder.getGitDir() == null) { - File d = new File("."); + File d = new File("."); //$NON-NLS-1$ if (d.getParentFile() != null) d = d.getParentFile(); if (!bare) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java index c450ea962c..3843dc4a18 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java @@ -161,9 +161,9 @@ public class LsRemoteCommand extends Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1); if (tags) refSpecs.add(new RefSpec( - "refs/tags/*:refs/remotes/origin/tags/*")); + "refs/tags/*:refs/remotes/origin/tags/*")); //$NON-NLS-1$ if (heads) - refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); + refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); //$NON-NLS-1$ Collection<Ref> refs; Map<String, Ref> refmap = new HashMap<String, Ref>(); fc = transport.openFetch(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java index a884c70cb0..04d91af4b0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java @@ -151,7 +151,7 @@ public class MergeCommand extends GitCommand<MergeResult> { if (head == null) throw new NoHeadException( JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); - StringBuilder refLogMessage = new StringBuilder("merge "); + StringBuilder refLogMessage = new StringBuilder("merge "); //$NON-NLS-1$ // Check for FAST_FORWARD, ALREADY_UP_TO_DATE revWalk = new RevWalk(repo); @@ -179,7 +179,7 @@ public class MergeCommand extends GitCommand<MergeResult> { .updateRef(head.getTarget().getName()); refUpdate.setNewObjectId(objectId); refUpdate.setExpectedOldObjectId(null); - refUpdate.setRefLogMessage("initial pull", false); + refUpdate.setRefLogMessage("initial pull", false); //$NON-NLS-1$ if (refUpdate.update() != Result.NEW) throw new NoHeadException( JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); @@ -200,7 +200,7 @@ public class MergeCommand extends GitCommand<MergeResult> { && fastForwardMode == FastForwardMode.FF) { // FAST_FORWARD detected: skip doing a real merge but only // update HEAD - refLogMessage.append(": " + MergeStatus.FAST_FORWARD); + refLogMessage.append(": " + MergeStatus.FAST_FORWARD); //$NON-NLS-1$ dco = new DirCacheCheckout(repo, headCommit.getTree(), repo.lockDirCache(), srcCommit.getTree()); @@ -233,7 +233,7 @@ public class MergeCommand extends GitCommand<MergeResult> { new ObjectId[] { headCommit, srcCommit }, MergeStatus.ABORTED, mergeStrategy, null, null); } - String mergeMessage = ""; + String mergeMessage = ""; //$NON-NLS-1$ if (!squash) { mergeMessage = new MergeMessageFormatter().format( commits, head); @@ -254,7 +254,7 @@ public class MergeCommand extends GitCommand<MergeResult> { if (merger instanceof ResolveMerger) { ResolveMerger resolveMerger = (ResolveMerger) merger; resolveMerger.setCommitNames(new String[] { - "BASE", "HEAD", ref.getName() }); + "BASE", "HEAD", ref.getName() }); //$NON-NLS-1$ resolveMerger.setWorkingTreeIterator(new FileTreeIterator(repo)); noProblems = merger.merge(headCommit, srcCommit); lowLevelResults = resolveMerger @@ -263,11 +263,11 @@ public class MergeCommand extends GitCommand<MergeResult> { unmergedPaths = resolveMerger.getUnmergedPaths(); } else noProblems = merger.merge(headCommit, srcCommit); - refLogMessage.append(": Merge made by "); + refLogMessage.append(": Merge made by "); //$NON-NLS-1$ if (!revWalk.isMergedInto(headCommit, srcCommit)) refLogMessage.append(mergeStrategy.getName()); else - refLogMessage.append("recursive"); + refLogMessage.append("recursive"); //$NON-NLS-1$ refLogMessage.append('.'); if (noProblems) { dco = new DirCacheCheckout(repo, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java index 8485a15440..1c930ebeb3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java @@ -324,6 +324,7 @@ public class MergeResult { return base; } + @SuppressWarnings("nls") @Override public String toString() { boolean first = true; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java index 8179098885..4c935095c3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java @@ -76,7 +76,7 @@ import org.eclipse.jgit.transport.FetchResult; */ public class PullCommand extends TransportCommand<PullCommand, PullResult> { - private final static String DOT = "."; + private final static String DOT = "."; //$NON-NLS-1$ private ProgressMonitor monitor = NullProgressMonitor.INSTANCE; @@ -218,7 +218,7 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { JGitText.get().missingConfigurationForKey, missingKey)); } - final boolean isRemote = !remote.equals("."); + final boolean isRemote = !remote.equals("."); //$NON-NLS-1$ String remoteUri; FetchResult fetchRes; if (isRemote) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java index 49327fc9b9..c1eb89db7f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java @@ -112,6 +112,7 @@ public class PullResult { return true; } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index 0022672744..3f7feb936f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -110,40 +110,40 @@ public class RebaseCommand extends GitCommand<RebaseResult> { /** * The name of the "rebase-merge" folder */ - public static final String REBASE_MERGE = "rebase-merge"; + public static final String REBASE_MERGE = "rebase-merge"; //$NON-NLS-1$ /** * The name of the "stopped-sha" file */ - public static final String STOPPED_SHA = "stopped-sha"; + public static final String STOPPED_SHA = "stopped-sha"; //$NON-NLS-1$ - private static final String AUTHOR_SCRIPT = "author-script"; + private static final String AUTHOR_SCRIPT = "author-script"; //$NON-NLS-1$ - private static final String DONE = "done"; + private static final String DONE = "done"; //$NON-NLS-1$ - private static final String GIT_AUTHOR_DATE = "GIT_AUTHOR_DATE"; + private static final String GIT_AUTHOR_DATE = "GIT_AUTHOR_DATE"; //$NON-NLS-1$ - private static final String GIT_AUTHOR_EMAIL = "GIT_AUTHOR_EMAIL"; + private static final String GIT_AUTHOR_EMAIL = "GIT_AUTHOR_EMAIL"; //$NON-NLS-1$ - private static final String GIT_AUTHOR_NAME = "GIT_AUTHOR_NAME"; + private static final String GIT_AUTHOR_NAME = "GIT_AUTHOR_NAME"; //$NON-NLS-1$ - private static final String GIT_REBASE_TODO = "git-rebase-todo"; + private static final String GIT_REBASE_TODO = "git-rebase-todo"; //$NON-NLS-1$ - private static final String HEAD_NAME = "head-name"; + private static final String HEAD_NAME = "head-name"; //$NON-NLS-1$ - private static final String INTERACTIVE = "interactive"; + private static final String INTERACTIVE = "interactive"; //$NON-NLS-1$ - private static final String MESSAGE = "message"; + private static final String MESSAGE = "message"; //$NON-NLS-1$ - private static final String ONTO = "onto"; + private static final String ONTO = "onto"; //$NON-NLS-1$ - private static final String ONTO_NAME = "onto-name"; + private static final String ONTO_NAME = "onto-name"; //$NON-NLS-1$ - private static final String PATCH = "patch"; + private static final String PATCH = "patch"; //$NON-NLS-1$ - private static final String REBASE_HEAD = "head"; + private static final String REBASE_HEAD = "head"; //$NON-NLS-1$ - private static final String AMEND = "amend"; + private static final String AMEND = "amend"; //$NON-NLS-1$ /** * The available operations @@ -275,9 +275,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> { for (Step step : steps) { sb.setLength(0); sb.append(step.action.token); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(step.commit.name()); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(RawParseUtils.decode(step.shortMessage) .trim()); fw.write(sb.toString()); @@ -398,7 +398,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { } private RevCommit checkoutCurrentHead() throws IOException, NoHeadException { - ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); + ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ if (headTree == null) throw new NoHeadException( JGitText.get().cannotRebaseWithoutCurrentHead); @@ -442,7 +442,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { treeWalk.reset(); treeWalk.setRecursive(true); treeWalk.addTree(new DirCacheIterator(dc)); - ObjectId id = repo.resolve(Constants.HEAD + "^{tree}"); + ObjectId id = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ if (id == null) throw new NoHeadException( JGitText.get().cannotRebaseWithoutCurrentHead); @@ -496,23 +496,23 @@ public class RebaseCommand extends GitCommand<RebaseResult> { String toAuthorScript(PersonIdent author) { StringBuilder sb = new StringBuilder(100); sb.append(GIT_AUTHOR_NAME); - sb.append("='"); + sb.append("='"); //$NON-NLS-1$ sb.append(author.getName()); - sb.append("'\n"); + sb.append("'\n"); //$NON-NLS-1$ sb.append(GIT_AUTHOR_EMAIL); - sb.append("='"); + sb.append("='"); //$NON-NLS-1$ sb.append(author.getEmailAddress()); - sb.append("'\n"); + sb.append("'\n"); //$NON-NLS-1$ // the command line uses the "external String" // representation for date and timezone sb.append(GIT_AUTHOR_DATE); - sb.append("='"); - sb.append("@"); // @ for time in seconds since 1970 + sb.append("='"); //$NON-NLS-1$ + sb.append("@"); // @ for time in seconds since 1970 //$NON-NLS-1$ String externalString = author.toExternalString(); sb .append(externalString.substring(externalString .lastIndexOf('>') + 2)); - sb.append("'\n"); + sb.append("'\n"); //$NON-NLS-1$ return sb.toString(); } @@ -655,7 +655,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { createFile(rebaseDir, HEAD_NAME, headName); createFile(rebaseDir, ONTO, upstreamCommit.name()); createFile(rebaseDir, ONTO_NAME, upstreamCommitName); - createFile(rebaseDir, INTERACTIVE, ""); + createFile(rebaseDir, INTERACTIVE, ""); //$NON-NLS-1$ BufferedWriter fw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(new File(rebaseDir, GIT_REBASE_TODO)), Constants.CHARACTER_ENCODING)); @@ -668,9 +668,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> { for (RevCommit commit : cherryPickList) { sb.setLength(0); sb.append(Action.PICK.toToken()); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(reader.abbreviate(commit).name()); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(commit.getShortMessage()); fw.write(sb.toString()); fw.newLine(); @@ -747,8 +747,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> { RefUpdate rup = repo.updateRef(headName); rup.setExpectedOldObjectId(oldCommit); rup.setNewObjectId(newCommit); - rup.setRefLogMessage("Fast-foward from " + oldCommit.name() - + " to " + newCommit.name(), false); + rup.setRefLogMessage("Fast-foward from " + oldCommit.name() //$NON-NLS-1$ + + " to " + newCommit.name(), false); //$NON-NLS-1$ Result res = rup.update(walk); switch (res) { case FAST_FORWARD: @@ -756,7 +756,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { case FORCED: break; default: - throw new IOException("Could not fast-forward"); + throw new IOException("Could not fast-forward"); //$NON-NLS-1$ } } return newCommit; @@ -1082,11 +1082,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> { */ public static enum Action { /** Use commit */ - PICK("pick", "p"), + PICK("pick", "p"), //$NON-NLS-1$ //$NON-NLS-2$ /** Use commit, but edit the commit message */ - REWORD("reword", "r"), + REWORD("reword", "r"), //$NON-NLS-1$ //$NON-NLS-2$ /** Use commit, but stop for amending */ - EDIT("edit", "e"); // later add SQUASH, FIXUP, etc. + EDIT("edit", "e"); // later add SQUASH, FIXUP, etc. //$NON-NLS-1$ //$NON-NLS-2$ private final String token; @@ -1104,6 +1104,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { return this.token; } + @SuppressWarnings("nls") @Override public String toString() { return "Action[" + token + "]"; @@ -1165,9 +1166,12 @@ public class RebaseCommand extends GitCommand<RebaseResult> { return shortMessage; } + @SuppressWarnings("nls") @Override public String toString() { - return "Step[" + action + ", " + return "Step[" + + action + + ", " + ((commit == null) ? "null" : commit) + ", " + ((shortMessage == null) ? "null" : new String( @@ -1199,7 +1203,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { // the time is saved as <seconds since 1970> <timezone offset> int timeStart = 0; - if (time.startsWith("@")) + if (time.startsWith("@")) //$NON-NLS-1$ timeStart = 1; else timeStart = 0; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java index 22f4ef9862..607253b76d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java @@ -101,7 +101,7 @@ public class RenameBranchCommand extends GitCommand<Ref> { if (newName == null) throw new InvalidRefNameException(MessageFormat.format(JGitText - .get().branchNameInvalid, "<null>")); + .get().branchNameInvalid, "<null>")); //$NON-NLS-1$ try { String fullOldName; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java index 36c3334b82..80abbec2e3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java @@ -153,7 +153,7 @@ public class ResetCommand extends GitCommand<Ref> { // resolve the ref to a commit final ObjectId commitId; try { - commitId = repo.resolve(ref + "^{commit}"); + commitId = repo.resolve(ref + "^{commit}"); //$NON-NLS-1$ if (commitId == null) { // @TODO throw an InvalidRefNameException. We can't do that // now because this would break the API @@ -253,7 +253,7 @@ public class ResetCommand extends GitCommand<Ref> { if (!filepaths.isEmpty()) throw new JGitInternalException(MessageFormat.format( JGitText.get().illegalCombinationOfArguments, - "[--mixed | --soft | --hard]", "<paths>...")); + "[--mixed | --soft | --hard]", "<paths>...")); //$NON-NLS-1$ this.mode = mode; return this; } @@ -267,7 +267,7 @@ public class ResetCommand extends GitCommand<Ref> { if (mode != null) throw new JGitInternalException(MessageFormat.format( JGitText.get().illegalCombinationOfArguments, "<paths>...", - "[--mixed | --soft | --hard]")); + "[--mixed | --soft | --hard]")); //$NON-NLS-1$ filepaths.add(file); return this; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java index fde6b94d2d..910637d0e8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java @@ -164,13 +164,13 @@ public class RevertCommand extends GitCommand<RevCommit> { merger.getResultTreeId()); dco.setFailOnConflict(true); dco.checkout(); - String shortMessage = "Revert \"" + srcCommit.getShortMessage() + "\""; - String newMessage = shortMessage + "\n\n" - + "This reverts commit " - + srcCommit.getId().getName() + ".\n"; + String shortMessage = "Revert \"" + srcCommit.getShortMessage() + "\""; //$NON-NLS-2$ + String newMessage = shortMessage + "\n\n" //$NON-NLS-1$ + + "This reverts commit " //$NON-NLS-1$ + + srcCommit.getId().getName() + ".\n"; //$NON-NLS-1$ newHead = new Git(getRepository()).commit() .setMessage(newMessage) - .setReflogComment("revert: " + shortMessage).call(); + .setReflogComment("revert: " + shortMessage).call(); //$NON-NLS-1$ revertedRefs.add(src); } else { unmergedPaths = merger.getUnmergedPaths(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java index c26a48525d..5a6a4c785b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java @@ -84,7 +84,7 @@ import org.eclipse.jgit.util.FileUtils; */ public class StashApplyCommand extends GitCommand<ObjectId> { - private static final String DEFAULT_REF = Constants.STASH + "@{0}"; + private static final String DEFAULT_REF = Constants.STASH + "@{0}"; //$NON-NLS-1$ /** * Stash diff filter that looks for differences in the first three trees @@ -115,7 +115,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> { @Override public String toString() { - return "STASH_DIFF"; + return "STASH_DIFF"; //$NON-NLS-1$ } } @@ -192,7 +192,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> { private ObjectId getHeadTree() throws GitAPIException { final ObjectId headTree; try { - headTree = repo.resolve(Constants.HEAD + "^{tree}"); + headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ } catch (IOException e) { throw new JGitInternalException(JGitText.get().cannotReadTree, e); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java index 8d887e3548..1784acd79b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java @@ -120,7 +120,7 @@ public class TagCommand extends GitCommand<Ref> { // if no id is set, we should attempt to use HEAD if (id == null) { - ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); + ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$ if (objectId == null) throw new NoHeadException( JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); @@ -142,7 +142,7 @@ public class TagCommand extends GitCommand<Ref> { RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); - tagRef.setRefLogMessage("tagged " + name, false); + tagRef.setRefLogMessage("tagged " + name, false); //$NON-NLS-1$ Result updateResult = tagRef.update(revWalk); switch (updateResult) { case NEW: diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java index a6ab5bc66d..b5e87f1f5c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java @@ -62,7 +62,7 @@ public class ConcurrentRefUpdateException extends GitAPIException { */ public ConcurrentRefUpdateException(String message, Ref ref, RefUpdate.Result rc, Throwable cause) { - super((rc == null) ? message : message + ". " + super((rc == null) ? message : message + ". " //$NON-NLS-1$ + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc), cause); this.rc = rc; this.ref = ref; @@ -75,7 +75,7 @@ public class ConcurrentRefUpdateException extends GitAPIException { */ public ConcurrentRefUpdateException(String message, Ref ref, RefUpdate.Result rc) { - super((rc == null) ? message : message + ". " + super((rc == null) ? message : message + ". " //$NON-NLS-1$ + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc)); this.rc = rc; this.ref = ref; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java index cea719ad70..b7ad9d1a1f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java @@ -177,7 +177,7 @@ public class BlameGenerator { revPool = new RevWalk(getRepository()); revPool.setRetainBody(true); - SEEN = revPool.newFlag("SEEN"); + SEEN = revPool.newFlag("SEEN"); //$NON-NLS-1$ reader = revPool.getObjectReader(); treeWalk = new TreeWalk(reader); treeWalk.setRecursive(true); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java index d7a958feeb..2d445fd7b2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java @@ -321,7 +321,7 @@ public class BlameResult { @Override public String toString() { StringBuilder r = new StringBuilder(); - r.append("BlameResult: "); + r.append("BlameResult: "); //$NON-NLS-1$ r.append(getResultPath()); return r.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java index 2e4e7844b9..95b4cec02c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java @@ -275,6 +275,7 @@ class Candidate { return r; } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder r = new StringBuilder(); @@ -324,7 +325,7 @@ class Candidate { @Override public String toString() { - return "Reverse" + super.toString(); + return "Reverse" + super.toString(); //$NON-NLS-1$ } } @@ -380,7 +381,7 @@ class Candidate { @Override PersonIdent getAuthor() { - return new PersonIdent(description, ""); + return new PersonIdent(description, ""); //$NON-NLS-1$ } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java index cf0dce4ee5..13874004d5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java @@ -78,10 +78,10 @@ public class DiffConfig { private final int renameLimit; private DiffConfig(final Config rc) { - noPrefix = rc.getBoolean("diff", "noprefix", false); - renameDetectionType = parseRenameDetectionType(rc.getString("diff", - null, "renames")); - renameLimit = rc.getInt("diff", "renamelimit", 200); + noPrefix = rc.getBoolean("diff", "noprefix", false); //$NON-NLS-1$ //$NON-NLS-2$ + renameDetectionType = parseRenameDetectionType(rc.getString("diff", //$NON-NLS-1$ + null, "renames")); //$NON-NLS-1$ + renameLimit = rc.getInt("diff", "renamelimit", 200); //$NON-NLS-1$ //$NON-NLS-2$ } /** @return true if the prefix "a/" and "b/" should be suppressed. */ @@ -108,16 +108,16 @@ public class DiffConfig { final String renameString) { if (renameString == null) return RenameDetectionType.FALSE; - else if (StringUtils.equalsIgnoreCase("copy", renameString) - || StringUtils.equalsIgnoreCase("copies", renameString)) + else if (StringUtils.equalsIgnoreCase("copy", renameString) //$NON-NLS-1$ + || StringUtils.equalsIgnoreCase("copies", renameString)) //$NON-NLS-1$ return RenameDetectionType.COPY; else { final Boolean renameBoolean = StringUtils .toBooleanOrNull(renameString); if (renameBoolean == null) throw new IllegalArgumentException(MessageFormat.format( - JGitText.get().enumValueNotSupported2, "diff", - "renames", renameString)); + JGitText.get().enumValueNotSupported2, "diff", //$NON-NLS-1$ + "renames", renameString)); //$NON-NLS-1$ else if (renameBoolean.booleanValue()) return RenameDetectionType.TRUE; else diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java index 5084e9d57c..cc8d285d95 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java @@ -63,7 +63,7 @@ public class DiffEntry { .fromObjectId(ObjectId.zeroId()); /** Magical file name used for file adds or deletes. */ - public static final String DEV_NULL = "/dev/null"; + public static final String DEV_NULL = "/dev/null"; //$NON-NLS-1$ /** General type of change a single file-level patch describes. */ public static enum ChangeType { @@ -407,6 +407,7 @@ public class DiffEntry { return side == Side.OLD ? getOldId() : getNewId(); } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder buf = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java index 4258f74094..4af1084bf4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java @@ -105,7 +105,7 @@ import org.eclipse.jgit.util.io.DisabledOutputStream; public class DiffFormatter { private static final int DEFAULT_BINARY_FILE_THRESHOLD = PackConfig.DEFAULT_BIG_FILE_THRESHOLD; - private static final byte[] noNewLine = encodeASCII("\\ No newline at end of file\n"); + private static final byte[] noNewLine = encodeASCII("\\ No newline at end of file\n"); //$NON-NLS-1$ /** Magic return content indicating it is empty or no content present. */ private static final byte[] EMPTY = new byte[] {}; @@ -129,9 +129,9 @@ public class DiffFormatter { private int binaryFileThreshold = DEFAULT_BINARY_FILE_THRESHOLD; - private String oldPrefix = "a/"; + private String oldPrefix = "a/"; //$NON-NLS-1$ - private String newPrefix = "b/"; + private String newPrefix = "b/"; //$NON-NLS-1$ private TreeFilter pathFilter = TreeFilter.ALL; @@ -179,8 +179,8 @@ public class DiffFormatter { DiffConfig dc = db.getConfig().get(DiffConfig.KEY); if (dc.isNoPrefix()) { - setOldPrefix(""); - setNewPrefix(""); + setOldPrefix(""); //$NON-NLS-1$ + setNewPrefix(""); //$NON-NLS-1$ } setDetectRenames(dc.isRenameDetectionEnabled()); @@ -633,12 +633,12 @@ public class DiffFormatter { private void writeGitLinkDiffText(OutputStream o, DiffEntry ent) throws IOException { if (ent.getOldMode() == GITLINK) { - o.write(encodeASCII("-Subproject commit " + ent.getOldId().name() - + "\n")); + o.write(encodeASCII("-Subproject commit " + ent.getOldId().name() //$NON-NLS-1$ + + "\n")); //$NON-NLS-1$ } if (ent.getNewMode() == GITLINK) { - o.write(encodeASCII("+Subproject commit " + ent.getNewId().name() - + "\n")); + o.write(encodeASCII("+Subproject commit " + ent.getNewId().name() //$NON-NLS-1$ + + "\n")); //$NON-NLS-1$ } } @@ -918,7 +918,7 @@ public class DiffFormatter { if (aRaw == BINARY || bRaw == BINARY // || RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { formatOldNewPaths(buf, ent); - buf.write(encodeASCII("Binary files differ\n")); + buf.write(encodeASCII("Binary files differ\n")); //$NON-NLS-1$ editList = new EditList(); type = PatchType.BINARY; @@ -1016,7 +1016,7 @@ public class DiffFormatter { final FileMode oldMode = ent.getOldMode(); final FileMode newMode = ent.getNewMode(); - o.write(encodeASCII("diff --git ")); + o.write(encodeASCII("diff --git ")); //$NON-NLS-1$ o.write(encode(quotePath(oldPrefix + (type == ADD ? newp : oldp)))); o.write(' '); o.write(encode(quotePath(newPrefix + (type == DELETE ? oldp : newp)))); @@ -1024,40 +1024,40 @@ public class DiffFormatter { switch (type) { case ADD: - o.write(encodeASCII("new file mode ")); + o.write(encodeASCII("new file mode ")); //$NON-NLS-1$ newMode.copyTo(o); o.write('\n'); break; case DELETE: - o.write(encodeASCII("deleted file mode ")); + o.write(encodeASCII("deleted file mode ")); //$NON-NLS-1$ oldMode.copyTo(o); o.write('\n'); break; case RENAME: - o.write(encodeASCII("similarity index " + ent.getScore() + "%")); + o.write(encodeASCII("similarity index " + ent.getScore() + "%")); //$NON-NLS-1$ //$NON-NLS-2$ o.write('\n'); - o.write(encode("rename from " + quotePath(oldp))); + o.write(encode("rename from " + quotePath(oldp))); //$NON-NLS-1$ o.write('\n'); - o.write(encode("rename to " + quotePath(newp))); + o.write(encode("rename to " + quotePath(newp))); //$NON-NLS-1$ o.write('\n'); break; case COPY: - o.write(encodeASCII("similarity index " + ent.getScore() + "%")); + o.write(encodeASCII("similarity index " + ent.getScore() + "%")); //$NON-NLS-1$ //$NON-NLS-2$ o.write('\n'); - o.write(encode("copy from " + quotePath(oldp))); + o.write(encode("copy from " + quotePath(oldp))); //$NON-NLS-1$ o.write('\n'); - o.write(encode("copy to " + quotePath(newp))); + o.write(encode("copy to " + quotePath(newp))); //$NON-NLS-1$ o.write('\n'); if (!oldMode.equals(newMode)) { - o.write(encodeASCII("new file mode ")); + o.write(encodeASCII("new file mode ")); //$NON-NLS-1$ newMode.copyTo(o); o.write('\n'); } @@ -1065,19 +1065,19 @@ public class DiffFormatter { case MODIFY: if (0 < ent.getScore()) { - o.write(encodeASCII("dissimilarity index " - + (100 - ent.getScore()) + "%")); + o.write(encodeASCII("dissimilarity index " //$NON-NLS-1$ + + (100 - ent.getScore()) + "%")); //$NON-NLS-1$ o.write('\n'); } break; } if ((type == MODIFY || type == RENAME) && !oldMode.equals(newMode)) { - o.write(encodeASCII("old mode ")); + o.write(encodeASCII("old mode ")); //$NON-NLS-1$ oldMode.copyTo(o); o.write('\n'); - o.write(encodeASCII("new mode ")); + o.write(encodeASCII("new mode ")); //$NON-NLS-1$ newMode.copyTo(o); o.write('\n'); } @@ -1097,9 +1097,9 @@ public class DiffFormatter { */ protected void formatIndexLine(OutputStream o, DiffEntry ent) throws IOException { - o.write(encodeASCII("index " // + o.write(encodeASCII("index " // //$NON-NLS-1$ + format(ent.getOldId()) // - + ".." // + + ".." // //$NON-NLS-1$ + format(ent.getNewId()))); if (ent.getOldMode().equals(ent.getNewMode())) { o.write(' '); @@ -1133,8 +1133,8 @@ public class DiffFormatter { break; } - o.write(encode("--- " + oldp + "\n")); - o.write(encode("+++ " + newp + "\n")); + o.write(encode("--- " + oldp + "\n")); //$NON-NLS-1$ //$NON-NLS-2$ + o.write(encode("+++ " + newp + "\n")); //$NON-NLS-1$ //$NON-NLS-2$ } private int findCombinedEnd(final List<Edit> edits, final int i) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java index f0c7cdac5f..684c06699b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java @@ -233,6 +233,7 @@ public class Edit { return false; } + @SuppressWarnings("nls") @Override public String toString() { final Type t = getType(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java index be753bee8c..14f7b4293f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java @@ -80,6 +80,6 @@ public class EditList extends ArrayList<Edit> { @Override public String toString() { - return "EditList" + super.toString(); + return "EditList" + super.toString(); //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java index f0bf5c6305..55aece3ca9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java @@ -181,7 +181,7 @@ public class RawText extends Sequence { */ public String getString(int begin, int end, boolean dropLF) { if (begin == end) - return ""; + return ""; //$NON-NLS-1$ int s = getStart(begin); int e = getEnd(end - 1); @@ -290,8 +290,8 @@ public class RawText extends Sequence { if (content[e - 1] != '\n') return null; if (content.length > 1 && content[e - 2] == '\r') - return "\r\n"; + return "\r\n"; //$NON-NLS-1$ else - return "\n"; + return "\n"; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java index 48f2304943..6088d72f3b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java @@ -320,8 +320,8 @@ class SimilarityRenameDetector { } static int nameScore(String a, String b) { - int aDirLen = a.lastIndexOf("/") + 1; - int bDirLen = b.lastIndexOf("/") + 1; + int aDirLen = a.lastIndexOf("/") + 1; //$NON-NLS-1$ + int bDirLen = b.lastIndexOf("/") + 1; //$NON-NLS-1$ int dirMin = Math.min(aDirLen, bDirLen); int dirMax = Math.max(aDirLen, bDirLen); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java index f24c9b2a5b..353c2375c0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java @@ -555,7 +555,7 @@ public class DirCache { private static String formatExtensionName(final byte[] hdr) throws UnsupportedEncodingException { - return "'" + new String(hdr, 0, 4, "ISO-8859-1") + "'"; + return "'" + new String(hdr, 0, 4, "ISO-8859-1") + "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } private static boolean is_DIRC(final byte[] hdr) { @@ -855,8 +855,8 @@ public class DirCache { System.arraycopy(sortedEntries, 0, r, 0, sortedEntries.length); return r; } - if (!path.endsWith("/")) - path += "/"; + if (!path.endsWith("/")) //$NON-NLS-1$ + path += "/"; //$NON-NLS-1$ final byte[] p = Constants.encode(path); final int pLen = p.length; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java index ee8ab22071..6c7a70c52e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java @@ -244,7 +244,7 @@ public class DirCacheBuilder extends BaseDirCacheEditor { private static IllegalStateException bad(final DirCacheEntry a, final String msg) { - return new IllegalStateException(msg + ": " + a.getStage() + " " + return new IllegalStateException(msg + ": " + a.getStage() + " " //$NON-NLS-1$ //$NON-NLS-2$ + a.getPathString()); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index 9780993659..7629de6434 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -417,7 +417,7 @@ public class DirCacheCheckout { builder.finish(); File file = null; - String last = ""; + String last = ""; //$NON-NLS-1$ // when deleting files process them in the opposite order as they have // been reported. This ensures the files are deleted before we delete // their parent folders @@ -965,7 +965,7 @@ public class DirCacheCheckout { ObjectLoader ol = or.open(entry.getObjectId()); File parentDir = f.getParentFile(); parentDir.mkdirs(); - File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir); + File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir); //$NON-NLS-1$ WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY); FileOutputStream rawChannel = new FileOutputStream(tmpFile); OutputStream channel; @@ -1007,10 +1007,10 @@ public class DirCacheCheckout { private static byte[][] forbidden; static { - String[] list = new String[] { "AUX", "COM1", "COM2", "COM3", "COM4", - "COM5", "COM6", "COM7", "COM8", "COM9", "CON", "LPT1", "LPT2", - "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", "NUL", - "PRN" }; + String[] list = new String[] { "AUX", "COM1", "COM2", "COM3", "COM4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "COM5", "COM6", "COM7", "COM8", "COM9", "CON", "LPT1", "LPT2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ + "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", "NUL", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ + "PRN" }; //$NON-NLS-1$ forbidden = new byte[list.length][]; for (int i = 0; i < list.length; ++i) forbidden[i] = Constants.encodeASCII(list[i]); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java index 95bc1129c3..aa48c60414 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java @@ -637,6 +637,7 @@ public class DirCacheEntry { /** * Use for debugging only ! */ + @SuppressWarnings("nls") @Override public String toString() { return getFileMode() + " " + getLength() + " " + getLastModified() diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java index dd46b28a47..db29f3f15b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java @@ -77,7 +77,7 @@ public class CheckoutConflictException extends IOException { private static String buildList(String[] files) { StringBuilder builder = new StringBuilder(); for (String f : files) { - builder.append("\n"); + builder.append("\n"); //$NON-NLS-1$ builder.append(f); } return builder.toString(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java index 53da1ee5d8..55b64eeb90 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java @@ -58,9 +58,9 @@ public class CompoundException extends Exception { final StringBuilder msg = new StringBuilder(); msg.append(JGitText.get().failureDueToOneOfTheFollowing); for (final Throwable c : causes) { - msg.append(" "); + msg.append(" "); //$NON-NLS-1$ msg.append(c.getMessage()); - msg.append("\n"); + msg.append("\n"); //$NON-NLS-1$ } return msg.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java index fab4ca11e2..b545312ae7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java @@ -69,11 +69,11 @@ public class InvalidObjectIdException extends IllegalArgumentException { private static String asAscii(byte[] bytes, int offset, int length) { try { - return ": " + new String(bytes, offset, length, "US-ASCII"); + return ": " + new String(bytes, offset, length, "US-ASCII"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (UnsupportedEncodingException e2) { - return ""; + return ""; //$NON-NLS-1$ } catch (StringIndexOutOfBoundsException e2) { - return ""; + return ""; //$NON-NLS-1$ } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java index e62c65852c..09bb4a914f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java @@ -60,10 +60,10 @@ public class MissingBundlePrerequisiteException extends TransportException { final StringBuilder r = new StringBuilder(); r.append(JGitText.get().missingPrerequisiteCommits); for (final Map.Entry<ObjectId, String> e : missingCommits.entrySet()) { - r.append("\n "); + r.append("\n "); //$NON-NLS-1$ r.append(e.getKey().name()); if (e.getValue() != null) - r.append(" ").append(e.getValue()); + r.append(" ").append(e.getValue()); //$NON-NLS-1$ } return r.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/PackProtocolException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/PackProtocolException.java index 56816a6418..5503bd19e2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/PackProtocolException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/PackProtocolException.java @@ -63,7 +63,7 @@ public class PackProtocolException extends TransportException { * message */ public PackProtocolException(final URIish uri, final String s) { - super(uri + ": " + s); + super(uri + ": " + s); //$NON-NLS-1$ } /** @@ -79,7 +79,7 @@ public class PackProtocolException extends TransportException { */ public PackProtocolException(final URIish uri, final String s, final Throwable cause) { - this(uri + ": " + s, cause); + this(uri + ": " + s, cause); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/RevisionSyntaxException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/RevisionSyntaxException.java index 386d4c9e09..a039c7d14e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/RevisionSyntaxException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/RevisionSyntaxException.java @@ -79,6 +79,6 @@ public class RevisionSyntaxException extends IllegalArgumentException { @Override public String toString() { - return super.toString() + ":" + revstr; + return super.toString() + ":" + revstr; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleLoadingException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleLoadingException.java index 6bfe900481..4f297b982b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleLoadingException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleLoadingException.java @@ -65,8 +65,8 @@ public class TranslationBundleLoadingException extends TranslationBundleExceptio * {@link ResourceBundle#getBundle(String, Locale)} method. */ public TranslationBundleLoadingException(Class bundleClass, Locale locale, Exception cause) { - super("Loading of translation bundle failed for [" - + bundleClass.getName() + ", " + locale.toString() + "]", + super("Loading of translation bundle failed for [" //$NON-NLS-1$ + + bundleClass.getName() + ", " + locale.toString() + "]", //$NON-NLS-1$ //$NON-NLS-2$ bundleClass, locale, cause); } }
\ No newline at end of file diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationStringMissingException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationStringMissingException.java index a3c35b8daf..05c38424ec 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationStringMissingException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationStringMissingException.java @@ -69,8 +69,8 @@ public class TranslationStringMissingException extends TranslationBundleExceptio * {@link ResourceBundle#getString(String)} method. */ public TranslationStringMissingException(Class bundleClass, Locale locale, String key, Exception cause) { - super("Translation missing for [" + bundleClass.getName() + ", " - + locale.toString() + ", " + key + "]", bundleClass, locale, + super("Translation missing for [" + bundleClass.getName() + ", " //$NON-NLS-1$ //$NON-NLS-2$ + + locale.toString() + ", " + key + "]", bundleClass, locale, //$NON-NLS-1$ //$NON-NLS-2$ cause); this.key = key; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TransportException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TransportException.java index dfa035d60b..86dea8284f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TransportException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TransportException.java @@ -65,7 +65,7 @@ public class TransportException extends IOException { * message */ public TransportException(final URIish uri, final String s) { - super(uri.setPass(null) + ": " + s); + super(uri.setPass(null) + ": " + s); //$NON-NLS-1$ } /** @@ -81,7 +81,7 @@ public class TransportException extends IOException { */ public TransportException(final URIish uri, final String s, final Throwable cause) { - this(uri.setPass(null) + ": " + s, cause); + this(uri.setPass(null) + ": " + s, cause); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/UnsupportedCredentialItem.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/UnsupportedCredentialItem.java index eb09588fb5..daba576ca4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/UnsupportedCredentialItem.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/UnsupportedCredentialItem.java @@ -64,6 +64,6 @@ public class UnsupportedCredentialItem extends RuntimeException { * message */ public UnsupportedCredentialItem(final URIish uri, final String s) { - super(uri.setPass(null) + ": " + s); + super(uri.setPass(null) + ": " + s); //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerHandle.java b/org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerHandle.java index ef90b2205c..d8cd756d99 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerHandle.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerHandle.java @@ -64,6 +64,7 @@ public class ListenerHandle { parent.remove(this); } + @SuppressWarnings("nls") @Override public String toString() { return type.getSimpleName() + "[" + listener + "]"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/events/RepositoryEvent.java b/org.eclipse.jgit/src/org/eclipse/jgit/events/RepositoryEvent.java index ba1c81d5d8..1b7d28c333 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/events/RepositoryEvent.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/events/RepositoryEvent.java @@ -85,6 +85,7 @@ public abstract class RepositoryEvent<T extends RepositoryListener> { */ public abstract void dispatch(T listener); + @SuppressWarnings("nls") @Override public String toString() { String type = getClass().getSimpleName(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java index 582123bb5b..22840fb71c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java @@ -86,7 +86,7 @@ public class FileNameMatcher { static final List<Head> EMPTY_HEAD_LIST = Collections.emptyList(); private static final Pattern characterClassStartPattern = Pattern - .compile("\\[[.:=]"); + .compile("\\[[.:=]"); //$NON-NLS-1$ private List<Head> headsStartValue; @@ -185,7 +185,7 @@ public class FileNameMatcher { int firstValidEndBracketIndex = indexOfStartBracket + 2; if (indexOfStartBracket + 1 >= pattern.length()) - throw new NoClosingBracketException(indexOfStartBracket, "[", "]", + throw new NoClosingBracketException(indexOfStartBracket, "[", "]", //$NON-NLS-1$ //$NON-NLS-2$ pattern); if (pattern.charAt(firstValidCharClassIndex) == '!') { @@ -202,8 +202,8 @@ public class FileNameMatcher { final int possibleGroupEnd = pattern.indexOf(']', firstValidEndBracketIndex); if (possibleGroupEnd == -1) - throw new NoClosingBracketException(indexOfStartBracket, "[", - "]", pattern); + throw new NoClosingBracketException(indexOfStartBracket, "[", //$NON-NLS-1$ + "]", pattern); //$NON-NLS-1$ final boolean foundCharClass = charClassStartMatcher .find(firstValidCharClassIndex); @@ -212,7 +212,7 @@ public class FileNameMatcher { && charClassStartMatcher.start() < possibleGroupEnd) { final String classStart = charClassStartMatcher.group(0); - final String classEnd = classStart.charAt(1) + "]"; + final String classEnd = classStart.charAt(1) + "]"; //$NON-NLS-1$ final int classStartIndex = charClassStartMatcher.start(); final int classEndIndex = pattern.indexOf(classEnd, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java index 3911e72f7a..0243bdc211 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java @@ -57,7 +57,7 @@ final class GroupHead extends AbstractHead { private final List<CharacterPattern> characterClasses; private static final Pattern REGEX_PATTERN = Pattern - .compile("([^-][-][^-]|\\[[.:=].*?[.:=]\\])"); + .compile("([^-][-][^-]|\\[[.:=].*?[.:=]\\])"); //$NON-NLS-1$ private final boolean inverse; @@ -65,7 +65,7 @@ final class GroupHead extends AbstractHead { throws InvalidPatternException { super(false); this.characterClasses = new ArrayList<CharacterPattern>(); - this.inverse = pattern.startsWith("!"); + this.inverse = pattern.startsWith("!"); //$NON-NLS-1$ if (inverse) { pattern = pattern.substring(1); } @@ -76,40 +76,40 @@ final class GroupHead extends AbstractHead { final char start = characterClass.charAt(0); final char end = characterClass.charAt(2); characterClasses.add(new CharacterRange(start, end)); - } else if (characterClass.equals("[:alnum:]")) { + } else if (characterClass.equals("[:alnum:]")) { //$NON-NLS-1$ characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE); - } else if (characterClass.equals("[:alpha:]")) { + } else if (characterClass.equals("[:alpha:]")) { //$NON-NLS-1$ characterClasses.add(LetterPattern.INSTANCE); - } else if (characterClass.equals("[:blank:]")) { + } else if (characterClass.equals("[:blank:]")) { //$NON-NLS-1$ characterClasses.add(new OneCharacterPattern(' ')); characterClasses.add(new OneCharacterPattern('\t')); - } else if (characterClass.equals("[:cntrl:]")) { + } else if (characterClass.equals("[:cntrl:]")) { //$NON-NLS-1$ characterClasses.add(new CharacterRange('\u0000', '\u001F')); characterClasses.add(new OneCharacterPattern('\u007F')); - } else if (characterClass.equals("[:digit:]")) { + } else if (characterClass.equals("[:digit:]")) { //$NON-NLS-1$ characterClasses.add(DigitPattern.INSTANCE); - } else if (characterClass.equals("[:graph:]")) { + } else if (characterClass.equals("[:graph:]")) { //$NON-NLS-1$ characterClasses.add(new CharacterRange('\u0021', '\u007E')); characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE); - } else if (characterClass.equals("[:lower:]")) { + } else if (characterClass.equals("[:lower:]")) { //$NON-NLS-1$ characterClasses.add(LowerPattern.INSTANCE); - } else if (characterClass.equals("[:print:]")) { + } else if (characterClass.equals("[:print:]")) { //$NON-NLS-1$ characterClasses.add(new CharacterRange('\u0020', '\u007E')); characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE); - } else if (characterClass.equals("[:punct:]")) { + } else if (characterClass.equals("[:punct:]")) { //$NON-NLS-1$ characterClasses.add(PunctPattern.INSTANCE); - } else if (characterClass.equals("[:space:]")) { + } else if (characterClass.equals("[:space:]")) { //$NON-NLS-1$ characterClasses.add(WhitespacePattern.INSTANCE); - } else if (characterClass.equals("[:upper:]")) { + } else if (characterClass.equals("[:upper:]")) { //$NON-NLS-1$ characterClasses.add(UpperPattern.INSTANCE); - } else if (characterClass.equals("[:xdigit:]")) { + } else if (characterClass.equals("[:xdigit:]")) { //$NON-NLS-1$ characterClasses.add(new CharacterRange('0', '9')); characterClasses.add(new CharacterRange('a', 'f')); characterClasses.add(new CharacterRange('A', 'F')); - } else if (characterClass.equals("[:word:]")) { + } else if (characterClass.equals("[:word:]")) { //$NON-NLS-1$ characterClasses.add(new OneCharacterPattern('_')); characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE); @@ -120,7 +120,7 @@ final class GroupHead extends AbstractHead { throw new InvalidPatternException(message, wholePattern); } - pattern = matcher.replaceFirst(""); + pattern = matcher.replaceFirst(""); //$NON-NLS-1$ matcher.reset(pattern); } // pattern contains now no ranges @@ -219,7 +219,7 @@ final class GroupHead extends AbstractHead { private static final class PunctPattern implements CharacterPattern { static final GroupHead.PunctPattern INSTANCE = new PunctPattern(); - private static String punctCharacters = "-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; + private static String punctCharacters = "-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; //$NON-NLS-1$ public boolean matches(char c) { return punctCharacters.indexOf(c) != -1; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java index 575b9d60a5..fb65e0ce34 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java @@ -102,7 +102,7 @@ public class IgnoreNode { String txt; while ((txt = br.readLine()) != null) { txt = txt.trim(); - if (txt.length() > 0 && !txt.startsWith("#")) + if (txt.length() > 0 && !txt.startsWith("#")) //$NON-NLS-1$ rules.add(new IgnoreRule(txt)); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreRule.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreRule.java index f631bb270c..e0c780feec 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreRule.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreRule.java @@ -82,28 +82,28 @@ public class IgnoreRule { private void setup() { int startIndex = 0; int endIndex = pattern.length(); - if (pattern.startsWith("!")) { + if (pattern.startsWith("!")) { //$NON-NLS-1$ startIndex++; negation = true; } - if (pattern.endsWith("/")) { + if (pattern.endsWith("/")) { //$NON-NLS-1$ endIndex --; dirOnly = true; } pattern = pattern.substring(startIndex, endIndex); - boolean hasSlash = pattern.contains("/"); + boolean hasSlash = pattern.contains("/"); //$NON-NLS-1$ if (!hasSlash) nameOnly = true; - else if (!pattern.startsWith("/")) { + else if (!pattern.startsWith("/")) { //$NON-NLS-1$ //Contains "/" but does not start with one //Adding / to the start should not interfere with matching - pattern = "/" + pattern; + pattern = "/" + pattern; //$NON-NLS-1$ } - if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) { + if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ try { matcher = new FileNameMatcher(pattern, Character.valueOf('/')); } catch (InvalidPatternException e) { @@ -164,8 +164,8 @@ public class IgnoreRule { * the target is ignored. Call {@link IgnoreRule#getResult() getResult()} for the result. */ public boolean isMatch(String target, boolean isDirectory) { - if (!target.startsWith("/")) - target = "/" + target; + if (!target.startsWith("/")) //$NON-NLS-1$ + target = "/" + target; //$NON-NLS-1$ if (matcher == null) { if (target.equals(pattern)) { @@ -183,12 +183,12 @@ public class IgnoreRule { * "/src/new" to /src/newfile" but allows "/src/new" to match * "/src/new/newfile", as is the git standard */ - if ((target).startsWith(pattern + "/")) + if ((target).startsWith(pattern + "/")) //$NON-NLS-1$ return true; if (nameOnly) { //Iterate through each sub-name - final String[] segments = target.split("/"); + final String[] segments = target.split("/"); //$NON-NLS-1$ for (int idx = 0; idx < segments.length; idx++) { final String segmentName = segments[idx]; if (segmentName.equals(pattern) && @@ -202,7 +202,7 @@ public class IgnoreRule { if (matcher.isMatch()) return true; - final String[] segments = target.split("/"); + final String[] segments = target.split("/"); //$NON-NLS-1$ if (nameOnly) { for (int idx = 0; idx < segments.length; idx++) { final String segmentName = segments[idx]; @@ -220,7 +220,7 @@ public class IgnoreRule { for (int idx = 0; idx < segments.length; idx++) { final String segmentName = segments[idx]; if (segmentName.length() > 0) { - matcher.append("/" + segmentName); + matcher.append("/" + segmentName); //$NON-NLS-1$ } if (matcher.isMatch() && 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() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java index 5feb3a859b..1ba80869c2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java @@ -86,13 +86,13 @@ public class MergeFormatter { if (lastConflictingName != null && chunk.getConflictState() != ConflictState.NEXT_CONFLICTING_RANGE) { // found the end of an conflict - out.write((">>>>>>> " + lastConflictingName + "\n").getBytes(charsetName)); + out.write((">>>>>>> " + lastConflictingName + "\n").getBytes(charsetName)); //$NON-NLS-1$ //$NON-NLS-2$ lastConflictingName = null; } if (chunk.getConflictState() == ConflictState.FIRST_CONFLICTING_RANGE) { // found the start of an conflict - out.write(("<<<<<<< " + seqName.get(chunk.getSequenceIndex()) + - "\n").getBytes(charsetName)); + out.write(("<<<<<<< " + seqName.get(chunk.getSequenceIndex()) + //$NON-NLS-1$ + "\n").getBytes(charsetName)); //$NON-NLS-1$ lastConflictingName = seqName.get(chunk.getSequenceIndex()); } else if (chunk.getConflictState() == ConflictState.NEXT_CONFLICTING_RANGE) { // found another conflicting chunk @@ -105,8 +105,8 @@ public class MergeFormatter { * present non-three-way merges - feel free to correct here. */ lastConflictingName = seqName.get(chunk.getSequenceIndex()); - out.write((threeWayMerge ? "=======\n" : "======= " - + lastConflictingName + "\n").getBytes(charsetName)); + out.write((threeWayMerge ? "=======\n" : "======= " //$NON-NLS-1$ //$NON-NLS-2$ + + lastConflictingName + "\n").getBytes(charsetName)); //$NON-NLS-1$ } // the lines with conflict-metadata are written. Now write the chunk for (int i = chunk.getBegin(); i < chunk.getEnd(); i++) { @@ -117,7 +117,7 @@ public class MergeFormatter { // one possible leftover: if the merge result ended with a conflict we // have to close the last conflict here if (lastConflictingName != null) { - out.write((">>>>>>> " + lastConflictingName + "\n").getBytes(charsetName)); + out.write((">>>>>>> " + lastConflictingName + "\n").getBytes(charsetName)); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java index cacaff4c5d..29fa8d65ad 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java @@ -67,7 +67,7 @@ public class MergeMessageFormatter { */ public String format(List<Ref> refsToMerge, Ref target) { StringBuilder sb = new StringBuilder(); - sb.append("Merge "); + sb.append("Merge "); //$NON-NLS-1$ List<String> branches = new ArrayList<String>(); List<String> remoteBranches = new ArrayList<String>(); @@ -76,18 +76,18 @@ public class MergeMessageFormatter { List<String> others = new ArrayList<String>(); for (Ref ref : refsToMerge) { if (ref.getName().startsWith(Constants.R_HEADS)) - branches.add("'" + Repository.shortenRefName(ref.getName()) - + "'"); + branches.add("'" + Repository.shortenRefName(ref.getName()) //$NON-NLS-1$ + + "'"); //$NON-NLS-1$ else if (ref.getName().startsWith(Constants.R_REMOTES)) - remoteBranches.add("'" - + Repository.shortenRefName(ref.getName()) + "'"); + remoteBranches.add("'" //$NON-NLS-1$ + + Repository.shortenRefName(ref.getName()) + "'"); //$NON-NLS-1$ else if (ref.getName().startsWith(Constants.R_TAGS)) - tags.add("'" + Repository.shortenRefName(ref.getName()) + "'"); + tags.add("'" + Repository.shortenRefName(ref.getName()) + "'"); //$NON-NLS-1$ //$NON-NLS-2$ else if (ref.getName().equals(ref.getObjectId().getName())) - commits.add("'" + ref.getName() + "'"); + commits.add("'" + ref.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ else others.add(ref.getName()); @@ -109,9 +109,9 @@ public class MergeMessageFormatter { listings.add(joinNames(commits, "commit", "commits")); if (!others.isEmpty()) - listings.add(StringUtils.join(others, ", ", " and ")); + listings.add(StringUtils.join(others, ", ", " and ")); //$NON-NLS-1$ - sb.append(StringUtils.join(listings, ", ")); + sb.append(StringUtils.join(listings, ", ")); //$NON-NLS-1$ String targetName = target.getLeaf().getName(); if (!targetName.equals(Constants.R_HEADS + Constants.MASTER)) { @@ -134,9 +134,9 @@ public class MergeMessageFormatter { public String formatWithConflicts(String message, List<String> conflictingPaths) { StringBuilder sb = new StringBuilder(message); - if (!message.endsWith("\n") && message.length() != 0) - sb.append("\n"); - sb.append("\n"); + if (!message.endsWith("\n") && message.length() != 0) //$NON-NLS-1$ + sb.append("\n"); //$NON-NLS-1$ + sb.append("\n"); //$NON-NLS-1$ sb.append("Conflicts:\n"); for (String conflictingPath : conflictingPaths) sb.append('\t').append(conflictingPath).append('\n'); @@ -146,8 +146,8 @@ public class MergeMessageFormatter { private static String joinNames(List<String> names, String singular, String plural) { if (names.size() == 1) - return singular + " " + names.get(0); + return singular + " " + names.get(0); //$NON-NLS-1$ else - return plural + " " + StringUtils.join(names, ", ", " and "); + return plural + " " + StringUtils.join(names, ", ", " and "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java index 1301a4b10d..2e6fc41378 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java @@ -58,10 +58,10 @@ import org.eclipse.jgit.lib.Repository; */ public abstract class MergeStrategy { /** Simple strategy that sets the output tree to the first input tree. */ - public static final MergeStrategy OURS = new StrategyOneSided("ours", 0); + public static final MergeStrategy OURS = new StrategyOneSided("ours", 0); //$NON-NLS-1$ /** Simple strategy that sets the output tree to the second input tree. */ - public static final MergeStrategy THEIRS = new StrategyOneSided("theirs", 1); + public static final MergeStrategy THEIRS = new StrategyOneSided("theirs", 1); //$NON-NLS-1$ /** Simple strategy to merge paths, without simultaneous edits. */ public static final ThreeWayMergeStrategy SIMPLE_TWO_WAY_IN_CORE = new StrategySimpleTwoWayInCore(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index 1782bb2ad3..433458a273 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -728,7 +728,7 @@ public class ResolveMerger extends ThreeWayMerger { } else if (!result.containsConflicts()) { // When working inCore, only trivial merges can be handled, // so we generate objects only in conflict free cases - of = File.createTempFile("merge_", "_temp", null); + of = File.createTempFile("merge_", "_temp", null); //$NON-NLS-1$ //$NON-NLS-2$ fos = new FileOutputStream(of); try { fmt.formatMerge(fos, result, Arrays.asList(commitNames), diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/SquashMessageFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/SquashMessageFormatter.java index 6d0ff9ba9c..8931fd65ac 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/SquashMessageFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/SquashMessageFormatter.java @@ -80,11 +80,11 @@ public class SquashMessageFormatter { for (RevCommit c : squashedCommits) { sb.append("\ncommit "); sb.append(c.getName()); - sb.append("\n"); + sb.append("\n"); //$NON-NLS-1$ sb.append(toString(c.getAuthorIdent())); - sb.append("\n\t"); + sb.append("\n\t"); //$NON-NLS-1$ sb.append(c.getShortMessage()); - sb.append("\n"); + sb.append("\n"); //$NON-NLS-1$ } return sb.toString(); } @@ -94,12 +94,12 @@ public class SquashMessageFormatter { a.append("Author: "); a.append(author.getName()); - a.append(" <"); + a.append(" <"); //$NON-NLS-1$ a.append(author.getEmailAddress()); - a.append(">\n"); + a.append(">\n"); //$NON-NLS-1$ a.append("Date: "); a.append(dateFormatter.formatDate(author)); - a.append("\n"); + a.append("\n"); //$NON-NLS-1$ return a.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyResolve.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyResolve.java index e37635eb53..07368e5746 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyResolve.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyResolve.java @@ -62,6 +62,6 @@ public class StrategyResolve extends ThreeWayMergeStrategy { @Override public String getName() { - return "resolve"; + return "resolve"; //$NON-NLS-1$ } }
\ No newline at end of file diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java index d8a9423e8e..f18a522131 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java @@ -75,7 +75,7 @@ public class StrategySimpleTwoWayInCore extends ThreeWayMergeStrategy { @Override public String getName() { - return "simple-two-way-in-core"; + return "simple-two-way-in-core"; //$NON-NLS-1$ } @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java b/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java index 219b0a1631..a768c25a20 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java @@ -69,7 +69,7 @@ import org.eclipse.jgit.errors.TranslationStringMissingException; */ public class NLS { /** The root locale constant. It is defined here because the Locale.ROOT is not defined in Java 5 */ - public static final Locale ROOT_LOCALE = new Locale("", "", ""); + public static final Locale ROOT_LOCALE = new Locale("", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ private static final InheritableThreadLocal<NLS> local = new InheritableThreadLocal<NLS>() { protected NLS initialValue() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/Note.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/Note.java index ddff52e74e..41e9bbeef8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/Note.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/Note.java @@ -72,6 +72,7 @@ public class Note extends ObjectId { data = newData; } + @SuppressWarnings("nls") @Override public String toString() { return "Note[" + name() + " -> " + data.name() + "]"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java index 3c4347823b..25b2ae89e9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java @@ -389,7 +389,7 @@ public class NoteMap implements Iterable<Note> { private void load(ObjectId rootTree) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException { - AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); + AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); //$NON-NLS-1$ root = NoteParser.parse(none, rootTree, reader); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java index b335fbe87b..061447666c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java @@ -329,7 +329,7 @@ public class NoteMapMerger { throw new NotesMergeConflictException(baseList, oursList, theirsList); ObjectId resultTreeId = m.getResultTreeId(); - AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); + AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); //$NON-NLS-1$ return NoteParser.parse(none, resultTreeId, reader).nonNotes; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NotesMergeConflictException.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NotesMergeConflictException.java index 802f1930e6..94fba0fc61 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NotesMergeConflictException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NotesMergeConflictException.java @@ -101,10 +101,10 @@ public class NotesMergeConflictException extends IOException { private static String noteData(Note n) { if (n != null) return n.getData().name(); - return ""; + return ""; //$NON-NLS-1$ } private static String name(NonNoteEntry e) { - return e != null ? e.name() : ""; + return e != null ? e.name() : ""; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java index 340b67456e..d0a6b1f318 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java @@ -51,9 +51,9 @@ import static org.eclipse.jgit.util.RawParseUtils.parseBase10; /** Part of a "GIT binary patch" to describe the pre-image or post-image */ public class BinaryHunk { - private static final byte[] LITERAL = encodeASCII("literal "); + private static final byte[] LITERAL = encodeASCII("literal "); //$NON-NLS-1$ - private static final byte[] DELTA = encodeASCII("delta "); + private static final byte[] DELTA = encodeASCII("delta "); //$NON-NLS-1$ /** Type of information stored in a binary hunk. */ public static enum Type { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java index e95c026ddc..b104a49842 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java @@ -63,7 +63,7 @@ import org.eclipse.jgit.lib.FileMode; * merge which introduces changes not in any ancestor. */ public class CombinedFileHeader extends FileHeader { - private static final byte[] MODE = encodeASCII("mode "); + private static final byte[] MODE = encodeASCII("mode "); //$NON-NLS-1$ private AbbreviatedObjectId[] oldIds; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java index ff30a8cbcb..8171669bc8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java @@ -71,35 +71,35 @@ import org.eclipse.jgit.util.TemporaryBuffer; /** Patch header describing an action for a single file path. */ public class FileHeader extends DiffEntry { - private static final byte[] OLD_MODE = encodeASCII("old mode "); + private static final byte[] OLD_MODE = encodeASCII("old mode "); //$NON-NLS-1$ - private static final byte[] NEW_MODE = encodeASCII("new mode "); + private static final byte[] NEW_MODE = encodeASCII("new mode "); //$NON-NLS-1$ - static final byte[] DELETED_FILE_MODE = encodeASCII("deleted file mode "); + static final byte[] DELETED_FILE_MODE = encodeASCII("deleted file mode "); //$NON-NLS-1$ - static final byte[] NEW_FILE_MODE = encodeASCII("new file mode "); + static final byte[] NEW_FILE_MODE = encodeASCII("new file mode "); //$NON-NLS-1$ - private static final byte[] COPY_FROM = encodeASCII("copy from "); + private static final byte[] COPY_FROM = encodeASCII("copy from "); //$NON-NLS-1$ - private static final byte[] COPY_TO = encodeASCII("copy to "); + private static final byte[] COPY_TO = encodeASCII("copy to "); //$NON-NLS-1$ - private static final byte[] RENAME_OLD = encodeASCII("rename old "); + private static final byte[] RENAME_OLD = encodeASCII("rename old "); //$NON-NLS-1$ - private static final byte[] RENAME_NEW = encodeASCII("rename new "); + private static final byte[] RENAME_NEW = encodeASCII("rename new "); //$NON-NLS-1$ - private static final byte[] RENAME_FROM = encodeASCII("rename from "); + private static final byte[] RENAME_FROM = encodeASCII("rename from "); //$NON-NLS-1$ - private static final byte[] RENAME_TO = encodeASCII("rename to "); + private static final byte[] RENAME_TO = encodeASCII("rename to "); //$NON-NLS-1$ - private static final byte[] SIMILARITY_INDEX = encodeASCII("similarity index "); + private static final byte[] SIMILARITY_INDEX = encodeASCII("similarity index "); //$NON-NLS-1$ - private static final byte[] DISSIMILARITY_INDEX = encodeASCII("dissimilarity index "); + private static final byte[] DISSIMILARITY_INDEX = encodeASCII("dissimilarity index "); //$NON-NLS-1$ - static final byte[] INDEX = encodeASCII("index "); + static final byte[] INDEX = encodeASCII("index "); //$NON-NLS-1$ - static final byte[] OLD_NAME = encodeASCII("--- "); + static final byte[] OLD_NAME = encodeASCII("--- "); //$NON-NLS-1$ - static final byte[] NEW_NAME = encodeASCII("+++ "); + static final byte[] NEW_NAME = encodeASCII("+++ "); //$NON-NLS-1$ /** Type of patch used by this file. */ public static enum PatchType { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FormatError.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FormatError.java index 13046137dc..245b3ee599 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FormatError.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FormatError.java @@ -103,12 +103,12 @@ public class FormatError { public String toString() { final StringBuilder r = new StringBuilder(); r.append(getSeverity().name().toLowerCase()); - r.append(": at offset "); + r.append(": at offset "); //$NON-NLS-1$ r.append(getOffset()); - r.append(": "); + r.append(": "); //$NON-NLS-1$ r.append(getMessage()); - r.append("\n"); - r.append(" in "); + r.append("\n"); //$NON-NLS-1$ + r.append(" in "); //$NON-NLS-1$ r.append(getLineText()); return r.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java index b7a93933f2..d72b9bb83a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java @@ -311,8 +311,8 @@ public class HunkHeader { } else if (nContext + old.nDeleted > old.lineCount || nContext + old.nAdded > newLineCount) { - final String oldcnt = old.lineCount + ":" + newLineCount; - final String newcnt = (nContext + old.nDeleted) + ":" + final String oldcnt = old.lineCount + ":" + newLineCount; //$NON-NLS-1$ + final String newcnt = (nContext + old.nDeleted) + ":" //$NON-NLS-1$ + (nContext + old.nAdded); script.warn(buf, startOffset, MessageFormat.format( JGitText.get().hunkHeaderDoesNotMatchBodyLineCountOf, oldcnt, newcnt)); @@ -404,6 +404,7 @@ public class HunkHeader { offsets[fileIdx] = end < 0 ? s.length() : end + 1; } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder buf = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java index 8a09de7122..7b48473523 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java @@ -60,20 +60,20 @@ import org.eclipse.jgit.util.TemporaryBuffer; /** A parsed collection of {@link FileHeader}s from a unified diff patch file */ public class Patch { - static final byte[] DIFF_GIT = encodeASCII("diff --git "); + static final byte[] DIFF_GIT = encodeASCII("diff --git "); //$NON-NLS-1$ - private static final byte[] DIFF_CC = encodeASCII("diff --cc "); + private static final byte[] DIFF_CC = encodeASCII("diff --cc "); //$NON-NLS-1$ - private static final byte[] DIFF_COMBINED = encodeASCII("diff --combined "); + private static final byte[] DIFF_COMBINED = encodeASCII("diff --combined "); //$NON-NLS-1$ private static final byte[][] BIN_HEADERS = new byte[][] { - encodeASCII("Binary files "), encodeASCII("Files "), }; + encodeASCII("Binary files "), encodeASCII("Files "), }; //$NON-NLS-1$ //$NON-NLS-2$ - private static final byte[] BIN_TRAILER = encodeASCII(" differ\n"); + private static final byte[] BIN_TRAILER = encodeASCII(" differ\n"); //$NON-NLS-1$ - private static final byte[] GIT_BINARY = encodeASCII("GIT binary patch\n"); + private static final byte[] GIT_BINARY = encodeASCII("GIT binary patch\n"); //$NON-NLS-1$ - static final byte[] SIG_FOOTER = encodeASCII("-- \n"); + static final byte[] SIG_FOOTER = encodeASCII("-- \n"); //$NON-NLS-1$ /** The files, in the order they were parsed out of the input. */ private final List<FileHeader> files; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthWalk.java index 9c5eaffd7d..89d05dba59 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthWalk.java @@ -101,8 +101,8 @@ public interface DepthWalk { super(repo); this.depth = depth; - this.UNSHALLOW = newFlag("UNSHALLOW"); - this.REINTERESTING = newFlag("REINTERESTING"); + this.UNSHALLOW = newFlag("UNSHALLOW"); //$NON-NLS-1$ + this.REINTERESTING = newFlag("REINTERESTING"); //$NON-NLS-1$ } /** @@ -113,8 +113,8 @@ public interface DepthWalk { super(or); this.depth = depth; - this.UNSHALLOW = newFlag("UNSHALLOW"); - this.REINTERESTING = newFlag("REINTERESTING"); + this.UNSHALLOW = newFlag("UNSHALLOW"); //$NON-NLS-1$ + this.REINTERESTING = newFlag("REINTERESTING"); //$NON-NLS-1$ } /** @@ -167,8 +167,8 @@ public interface DepthWalk { super(repo); this.depth = depth; - this.UNSHALLOW = newFlag("UNSHALLOW"); - this.REINTERESTING = newFlag("REINTERESTING"); + this.UNSHALLOW = newFlag("UNSHALLOW"); //$NON-NLS-1$ + this.REINTERESTING = newFlag("REINTERESTING"); //$NON-NLS-1$ } /** @@ -179,8 +179,8 @@ public interface DepthWalk { super(or); this.depth = depth; - this.UNSHALLOW = newFlag("UNSHALLOW"); - this.REINTERESTING = newFlag("REINTERESTING"); + this.UNSHALLOW = newFlag("UNSHALLOW"); //$NON-NLS-1$ + this.REINTERESTING = newFlag("REINTERESTING"); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FollowFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FollowFilter.java index d3c8d5b706..ab2cf2bccb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FollowFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FollowFilter.java @@ -115,6 +115,7 @@ public class FollowFilter extends TreeFilter { return new FollowFilter(path.clone()); } + @SuppressWarnings("nls") @Override public String toString() { return "(FOLLOW(" + path.toString() + ")" // diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterKey.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterKey.java index 97a8ab2ad2..319b819a79 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterKey.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterKey.java @@ -48,13 +48,13 @@ import org.eclipse.jgit.lib.Constants; /** Case insensitive key for a {@link FooterLine}. */ public final class FooterKey { /** Standard {@code Signed-off-by} */ - public static final FooterKey SIGNED_OFF_BY = new FooterKey("Signed-off-by"); + public static final FooterKey SIGNED_OFF_BY = new FooterKey("Signed-off-by"); //$NON-NLS-1$ /** Standard {@code Acked-by} */ - public static final FooterKey ACKED_BY = new FooterKey("Acked-by"); + public static final FooterKey ACKED_BY = new FooterKey("Acked-by"); //$NON-NLS-1$ /** Standard {@code CC} */ - public static final FooterKey CC = new FooterKey("CC"); + public static final FooterKey CC = new FooterKey("CC"); //$NON-NLS-1$ private final String name; @@ -76,6 +76,7 @@ public final class FooterKey { return name; } + @SuppressWarnings("nls") @Override public String toString() { return "FooterKey[" + name + "]"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java index 530200b0ca..f233923d7d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java @@ -146,6 +146,6 @@ public final class FooterLine { @Override public String toString() { - return getKey() + ": " + getValue(); + return getKey() + ": " + getValue(); //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java index 18e26da66a..730fde9574 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java @@ -351,7 +351,7 @@ public class ObjectWalk extends RevWalk { default: throw new CorruptObjectException(MessageFormat.format( JGitText.get().corruptObjectInvalidMode3, - String.format("%o", Integer.valueOf(mode)), + String.format("%o", Integer.valueOf(mode)), //$NON-NLS-1$ idBuffer.name(), RawParseUtils.decode(buf, tv.namePtr, tv.nameEnd), tv.obj)); @@ -705,8 +705,8 @@ public class ObjectWalk extends RevWalk { idBuffer.fromRaw(raw, ptr); throw new CorruptObjectException(MessageFormat.format( JGitText.get().corruptObjectInvalidMode3, - String.format("%o", Integer.valueOf(mode)), - idBuffer.name(), "", tree)); + String.format("%o", Integer.valueOf(mode)), //$NON-NLS-1$ + idBuffer.name(), "", tree)); //$NON-NLS-1$ } ptr += ID_SZ; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java index 6363014415..9f2ccfd97e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java @@ -391,7 +391,7 @@ public class RevCommit extends RevObject { final byte[] raw = buffer; final int msgB = RawParseUtils.commitMessage(raw, 0); if (msgB < 0) - return ""; + return ""; //$NON-NLS-1$ final Charset enc = RawParseUtils.parseEncoding(raw); return RawParseUtils.decode(enc, raw, msgB, raw.length); } @@ -415,7 +415,7 @@ public class RevCommit extends RevObject { final byte[] raw = buffer; final int msgB = RawParseUtils.commitMessage(raw, 0); if (msgB < 0) - return ""; + return ""; //$NON-NLS-1$ final Charset enc = RawParseUtils.parseEncoding(raw); final int msgE = RawParseUtils.endOfParagraph(raw, msgB); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java index 8cc5227e93..85982c7a0a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java @@ -64,7 +64,7 @@ public class RevFlag { * This is a static flag. Its RevWalk is not available. */ public static final RevFlag UNINTERESTING = new StaticRevFlag( - "UNINTERESTING", RevWalk.UNINTERESTING); + "UNINTERESTING", RevWalk.UNINTERESTING); //$NON-NLS-1$ final RevWalk walker; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java index bc53c28cc9..269b6c104f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java @@ -204,7 +204,7 @@ public class RevTag extends RevObject { final byte[] raw = buffer; final int msgB = RawParseUtils.tagMessage(raw, 0); if (msgB < 0) - return ""; + return ""; //$NON-NLS-1$ final Charset enc = RawParseUtils.parseEncoding(raw); return RawParseUtils.decode(enc, raw, msgB, raw.length); } @@ -228,7 +228,7 @@ public class RevTag extends RevObject { final byte[] raw = buffer; final int msgB = RawParseUtils.tagMessage(raw, 0); if (msgB < 0) - return ""; + return ""; //$NON-NLS-1$ final Charset enc = RawParseUtils.parseEncoding(raw); final int msgE = RawParseUtils.endOfParagraph(raw, msgB); 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 da3e619dc6..4a91493dc0 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 @@ -146,9 +146,10 @@ public abstract class AndRevFilter extends RevFilter { return new Binary(a.clone(), b.clone()); } + @SuppressWarnings("nls") @Override public String toString() { - return "(" + a.toString() + " AND " + b.toString() + ")"; + return "(" + a.toString() + " AND " + b.toString() + ")"; //$NON-NLS-1$ } } @@ -190,6 +191,7 @@ public abstract class AndRevFilter extends RevFilter { return new List(s); } + @SuppressWarnings("nls") @Override public String toString() { final StringBuilder r = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java index 14c03a4bcd..5bf9366ded 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java @@ -151,6 +151,7 @@ public abstract class CommitTimeRevFilter extends RevFilter { return cmit.getCommitTime() <= when; } + @SuppressWarnings("nls") @Override public String toString() { return super.toString() + "(" + new Date(when * 1000L) + ")"; @@ -175,6 +176,7 @@ public abstract class CommitTimeRevFilter extends RevFilter { return true; } + @SuppressWarnings("nls") @Override public String toString() { return super.toString() + "(" + new Date(when * 1000L) + ")"; @@ -196,9 +198,11 @@ public abstract class CommitTimeRevFilter extends RevFilter { return cmit.getCommitTime() <= until && cmit.getCommitTime() >= when; } + @SuppressWarnings("nls") @Override public String toString() { - return super.toString() + "(" + new Date(when * 1000L) + " - " + new Date(until * 1000L) + ")"; + return super.toString() + "(" + new Date(when * 1000L) + " - " + + new Date(until * 1000L) + ")"; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/NotRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/NotRevFilter.java index 6d1a49cb58..d3388021ba 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/NotRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/NotRevFilter.java @@ -93,6 +93,6 @@ public class NotRevFilter extends RevFilter { @Override public String toString() { - return "NOT " + a.toString(); + return "NOT " + a.toString(); //$NON-NLS-1$ } } 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 e9050f31ed..4c7b3bf47e 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 @@ -144,6 +144,7 @@ public abstract class OrRevFilter extends RevFilter { return new Binary(a.clone(), b.clone()); } + @SuppressWarnings("nls") @Override public String toString() { return "(" + a.toString() + " OR " + b.toString() + ")"; @@ -191,13 +192,13 @@ public abstract class OrRevFilter extends RevFilter { @Override public String toString() { final StringBuilder r = new StringBuilder(); - r.append("("); + r.append("("); //$NON-NLS-1$ for (int i = 0; i < subfilters.length; i++) { if (i > 0) - r.append(" OR "); + r.append(" OR "); //$NON-NLS-1$ r.append(subfilters[i].toString()); } - r.append(")"); + r.append(")"); //$NON-NLS-1$ return r.toString(); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java index 51de1d577d..1dd4555e5a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java @@ -106,13 +106,13 @@ public abstract class PatternMatchRevFilter extends RevFilter { patternText = pattern; if (innerString) { - if (!pattern.startsWith("^") && !pattern.startsWith(".*")) - pattern = ".*" + pattern; - if (!pattern.endsWith("$") && !pattern.endsWith(".*")) - pattern = pattern + ".*"; + if (!pattern.startsWith("^") && !pattern.startsWith(".*")) //$NON-NLS-1$ //$NON-NLS-2$ + pattern = ".*" + pattern; //$NON-NLS-1$ + if (!pattern.endsWith("$") && !pattern.endsWith(".*")) //$NON-NLS-1$ //$NON-NLS-2$ + pattern = pattern + ".*"; //$NON-NLS-1$ } final String p = rawEncoding ? forceToRaw(pattern) : pattern; - compiledPattern = Pattern.compile(p, flags).matcher(""); + compiledPattern = Pattern.compile(p, flags).matcher(""); //$NON-NLS-1$ } /** @@ -145,6 +145,7 @@ public abstract class PatternMatchRevFilter extends RevFilter { */ protected abstract CharSequence text(RevCommit cmit); + @SuppressWarnings("nls") @Override public String toString() { return super.toString() + "(\"" + patternText + "\")"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java index 1f9226f06b..2a5cb2b2ac 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java @@ -114,7 +114,7 @@ public abstract class RevFilter { @Override public String toString() { - return "ALL"; + return "ALL"; //$NON-NLS-1$ } } @@ -139,7 +139,7 @@ public abstract class RevFilter { @Override public String toString() { - return "NONE"; + return "NONE"; //$NON-NLS-1$ } } @@ -164,7 +164,7 @@ public abstract class RevFilter { @Override public String toString() { - return "NO_MERGES"; + return "NO_MERGES"; //$NON-NLS-1$ } } @@ -196,7 +196,7 @@ public abstract class RevFilter { @Override public String toString() { - return "MERGE_BASE"; + return "MERGE_BASE"; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java index 20d867fd58..ce3a022293 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java @@ -123,6 +123,7 @@ public abstract class SubStringRevFilter extends RevFilter { return this; // Typically we are actually thread-safe. } + @SuppressWarnings("nls") @Override public String toString() { return super.toString() + "(\"" + pattern.pattern() + "\")"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCacheConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCacheConfig.java index 14c96987c1..45994aaf74 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCacheConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCacheConfig.java @@ -194,13 +194,13 @@ public class DfsBlockCacheConfig { 60, TimeUnit.SECONDS, // Idle threads wait this long before ending. new ArrayBlockingQueue<Runnable>(1), // Do not queue deeply. new ThreadFactory() { - private final String name = "JGit-DFS-ReadAhead"; + private final String name = "JGit-DFS-ReadAhead"; //$NON-NLS-1$ private final AtomicInteger cnt = new AtomicInteger(); private final ThreadGroup group = new ThreadGroup(name); public Thread newThread(Runnable body) { int id = cnt.incrementAndGet(); - Thread thread = new Thread(group, body, name + "-" + id); + Thread thread = new Thread(group, body, name + "-" + id); //$NON-NLS-1$ thread.setDaemon(true); thread.setContextClassLoader(getClass().getClassLoader()); return thread; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackCompactor.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackCompactor.java index cbe9bfa6d0..773366722c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackCompactor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackCompactor.java @@ -238,7 +238,7 @@ public class DfsPackCompactor { }); RevWalk rw = new RevWalk(ctx); - RevFlag added = rw.newFlag("ADDED"); + RevFlag added = rw.newFlag("ADDED"); //$NON-NLS-1$ pm.beginTask(JGitText.get().countingObjects, ProgressMonitor.UNKNOWN); for (DfsPackFile src : srcPacks) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java index 6b90454b97..79cd04f308 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java @@ -114,7 +114,7 @@ public class DfsPackDescription implements Comparable<DfsPackDescription> { int dot = name.lastIndexOf('.'); if (dot < 0) dot = name.length(); - return name.substring(0, dot) + ".idx"; + return name.substring(0, dot) + ".idx"; //$NON-NLS-1$ } /** @return the source of the pack. */ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepository.java index 71262bbe25..ce33f6c8fd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepository.java @@ -97,7 +97,7 @@ public abstract class DfsRepository extends Repository { public void create(boolean bare) throws IOException { if (exists()) throw new IOException(MessageFormat.format( - JGitText.get().repositoryAlreadyExists, "")); + JGitText.get().repositoryAlreadyExists, "")); //$NON-NLS-1$ String master = Constants.R_HEADS + Constants.MASTER; RefUpdate.Result result = updateRef(Constants.HEAD, true).link(master); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepositoryDescription.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepositoryDescription.java index f51a03a07c..d0816ff606 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepositoryDescription.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsRepositoryDescription.java @@ -84,6 +84,7 @@ public class DfsRepositoryDescription { return false; } + @SuppressWarnings("nls") @Override public String toString() { return "DfsRepositoryDescription[" + getRepositoryName() + "]"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java index d1ceae00c9..1783a60327 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java @@ -77,7 +77,7 @@ public class InMemoryRepository extends DfsRepository { protected DfsPackDescription newPack(PackSource source) { int id = packId.incrementAndGet(); DfsPackDescription desc = new MemPack( - "pack-" + id + "-" + source.name(), + "pack-" + id + "-" + source.name(), //$NON-NLS-1$ //$NON-NLS-2$ getRepository().getDescription()); return desc.setPackSource(source); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CheckoutEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CheckoutEntry.java index 401794bc52..6bd9f805c5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CheckoutEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CheckoutEntry.java @@ -47,7 +47,7 @@ package org.eclipse.jgit.storage.file; * Parsed information about a checkout. */ public class CheckoutEntry { - static final String CHECKOUT_MOVING_FROM = "checkout: moving from "; + static final String CHECKOUT_MOVING_FROM = "checkout: moving from "; //$NON-NLS-1$ private String from; @@ -56,10 +56,10 @@ public class CheckoutEntry { CheckoutEntry(ReflogEntry reflogEntry) { String comment = reflogEntry.getComment(); int p1 = CHECKOUT_MOVING_FROM.length(); - int p2 = comment.indexOf(" to ", p1); + int p2 = comment.indexOf(" to ", p1); //$NON-NLS-1$ int p3 = comment.length(); from = comment.substring(p1,p2); - to = comment.substring(p2 + " to ".length(), p3); + to = comment.substring(p2 + " to ".length(), p3); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java index 15637e7ac3..a9a86dc823 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java @@ -225,6 +225,7 @@ public class FileBasedConfig extends StoredConfig { return ObjectId.fromRaw(Constants.newMessageDigest().digest(rawText)); } + @SuppressWarnings("nls") @Override public String toString() { return getClass().getSimpleName() + "[" + getFile().getPath() + "]"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java index 2393e607e2..6ab1b3fd37 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java @@ -249,8 +249,8 @@ public class FileRepository extends Repository { refs.create(); objectDatabase.create(); - FileUtils.mkdir(new File(getDirectory(), "branches")); - FileUtils.mkdir(new File(getDirectory(), "hooks")); + FileUtils.mkdir(new File(getDirectory(), "branches")); //$NON-NLS-1$ + FileUtils.mkdir(new File(getDirectory(), "hooks")); //$NON-NLS-1$ RefUpdate head = updateRef(Constants.HEAD); head.disableRefLog(); @@ -258,7 +258,7 @@ public class FileRepository extends Repository { final boolean fileMode; if (getFS().supportsExecute()) { - File tmp = File.createTempFile("try", "execute", getDirectory()); + File tmp = File.createTempFile("try", "execute", getDirectory()); //$NON-NLS-1$ //$NON-NLS-2$ getFS().setExecute(tmp, true); final boolean on = getFS().canExecute(tmp); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java index b0fab6f4b8..72b150961c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java @@ -96,7 +96,7 @@ import org.eclipse.jgit.util.GitDateParser; * adapted to FileRepositories. */ public class GC { - private static final String PRUNE_EXPIRE_DEFAULT = "2.weeks.ago"; + private static final String PRUNE_EXPIRE_DEFAULT = "2.weeks.ago"; //$NON-NLS-1$ private final FileRepository repo; @@ -190,8 +190,8 @@ public class GC { if (!oldPack.shouldBeKept()) { oldPack.close(); - FileUtils.delete(nameFor(oldName, ".pack"), deleteOptions); - FileUtils.delete(nameFor(oldName, ".idx"), deleteOptions); + FileUtils.delete(nameFor(oldName, ".pack"), deleteOptions); //$NON-NLS-1$ + FileUtils.delete(nameFor(oldName, ".idx"), deleteOptions); //$NON-NLS-1$ } } // close the complete object database. Thats my only chance to force @@ -614,9 +614,9 @@ public class GC { default: throw new IOException(MessageFormat.format( JGitText.get().corruptObjectInvalidMode3, String - .format("%o", Integer.valueOf(treeWalk + .format("%o", Integer.valueOf(treeWalk //$NON-NLS-1$ .getRawMode(0)), - (objectId == null) ? "null" + (objectId == null) ? "null" //$NON-NLS-1$ : objectId.name(), treeWalk .getPathString(), repo .getIndexFile()))); @@ -651,11 +651,11 @@ public class GC { // create temporary files String id = pw.computeName().getName(); - File packdir = new File(repo.getObjectsDirectory(), "pack"); - tmpPack = File.createTempFile("gc_", ".pack_tmp", packdir); + File packdir = new File(repo.getObjectsDirectory(), "pack"); //$NON-NLS-1$ + tmpPack = File.createTempFile("gc_", ".pack_tmp", packdir); //$NON-NLS-1$ //$NON-NLS-2$ tmpIdx = new File(packdir, tmpPack.getName().substring(0, tmpPack.getName().lastIndexOf('.')) - + ".idx_tmp"); + + ".idx_tmp"); //$NON-NLS-1$ if (!tmpIdx.createNewFile()) throw new IOException(MessageFormat.format( @@ -686,9 +686,9 @@ public class GC { } // rename the temporary files to real files - File realPack = nameFor(id, ".pack"); + File realPack = nameFor(id, ".pack"); //$NON-NLS-1$ tmpPack.setReadOnly(); - File realIdx = nameFor(id, ".idx"); + File realIdx = nameFor(id, ".idx"); //$NON-NLS-1$ realIdx.setReadOnly(); boolean delete = true; try { @@ -697,7 +697,7 @@ public class GC { delete = false; if (!tmpIdx.renameTo(realIdx)) { File newIdx = new File(realIdx.getParentFile(), - realIdx.getName() + ".new"); + realIdx.getName() + ".new"); //$NON-NLS-1$ if (!tmpIdx.renameTo(newIdx)) newIdx = tmpIdx; throw new IOException(MessageFormat.format( @@ -721,8 +721,8 @@ public class GC { } private File nameFor(String name, String ext) { - File packdir = new File(repo.getObjectsDirectory(), "pack"); - return new File(packdir, "pack-" + name + ext); + File packdir = new File(repo.getObjectsDirectory(), "pack"); //$NON-NLS-1$ + return new File(packdir, "pack-" + name + ext); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalCachedPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalCachedPack.java index ee2ebc1b23..82503b6d1e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalCachedPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalCachedPack.java @@ -129,7 +129,7 @@ class LocalCachedPack extends CachedPack { } private String getPackFilePath(String packName) { - final File packDir = new File(odb.getDirectory(), "pack"); - return new File(packDir, "pack-" + packName + ".pack").getPath(); + final File packDir = new File(odb.getDirectory(), "pack"); //$NON-NLS-1$ + return new File(packDir, "pack-" + packName + ".pack").getPath(); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LockFile.java index 9218121917..4877f02b94 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LockFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LockFile.java @@ -538,6 +538,7 @@ public class LockFile { } } + @SuppressWarnings("nls") @Override public String toString() { return "LockFile[" + lck + ", haveLck=" + haveLck + "]"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java index 7b5d3a63c7..a20f10af47 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java @@ -155,10 +155,10 @@ public class ObjectDirectory extends FileObjectDatabase { File[] alternatePaths, FS fs, File shallowFile) throws IOException { config = cfg; objects = dir; - infoDirectory = new File(objects, "info"); - packDirectory = new File(objects, "pack"); - alternatesFile = new File(infoDirectory, "alternates"); - cachedPacksFile = new File(infoDirectory, "cached-packs"); + infoDirectory = new File(objects, "info"); //$NON-NLS-1$ + packDirectory = new File(objects, "pack"); //$NON-NLS-1$ + alternatesFile = new File(infoDirectory, "alternates"); //$NON-NLS-1$ + cachedPacksFile = new File(infoDirectory, "cached-packs"); //$NON-NLS-1$ packList = new AtomicReference<PackList>(NO_PACKS); cachedPacks = new AtomicReference<CachedPackList>(); unpackedObjectCache = new UnpackedObjectCache(); @@ -339,10 +339,10 @@ public class ObjectDirectory extends FileObjectDatabase { final String p = pack.getName(); final String i = idx.getName(); - if (p.length() != 50 || !p.startsWith("pack-") || !p.endsWith(".pack")) + if (p.length() != 50 || !p.startsWith("pack-") || !p.endsWith(".pack")) //$NON-NLS-1$ throw new IOException(MessageFormat.format(JGitText.get().notAValidPack, pack)); - if (i.length() != 49 || !i.startsWith("pack-") || !i.endsWith(".idx")) + if (i.length() != 49 || !i.startsWith("pack-") || !i.endsWith(".idx")) //$NON-NLS-1$ throw new IOException(MessageFormat.format(JGitText.get().notAValidPack, idx)); if (!p.substring(0, 45).equals(i.substring(0, 45))) @@ -355,7 +355,7 @@ public class ObjectDirectory extends FileObjectDatabase { @Override public String toString() { - return "ObjectDirectory[" + getDirectory() + "]"; + return "ObjectDirectory[" + getDirectory() + "]"; //$NON-NLS-1$ } boolean hasObject1(final AnyObjectId objectId) { @@ -727,11 +727,11 @@ public class ObjectDirectory extends FileObjectDatabase { for (final String indexName : names) { // Must match "pack-[0-9a-f]{40}.idx" to be an index. // - if (indexName.length() != 49 || !indexName.endsWith(".idx")) + if (indexName.length() != 49 || !indexName.endsWith(".idx")) //$NON-NLS-1$ continue; final String base = indexName.substring(0, indexName.length() - 4); - final String packName = base + ".pack"; + final String packName = base + ".pack"; //$NON-NLS-1$ if (!names.contains(packName)) { // Sometimes C Git's HTTP fetch transport leaves a // .idx file behind and does not download the .pack. @@ -806,7 +806,7 @@ public class ObjectDirectory extends FileObjectDatabase { return Collections.emptySet(); final Set<String> nameSet = new HashSet<String>(nameList.length << 1); for (final String name : nameList) { - if (name.startsWith("pack-")) + if (name.startsWith("pack-")) //$NON-NLS-1$ nameSet.add(name); } return nameSet; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java index a9e403a168..75a1a2c1b7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java @@ -224,7 +224,7 @@ class ObjectDirectoryInserter extends ObjectInserter { } File newTempFile() throws IOException { - return File.createTempFile("noz", null, db.getDirectory()); + return File.createTempFile("noz", null, db.getDirectory()); //$NON-NLS-1$ } DeflaterOutputStream compress(final OutputStream out) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryPackParser.java index ce4c54342b..518bccf71b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryPackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryPackParser.java @@ -171,10 +171,10 @@ public class ObjectDirectoryPackParser extends PackParser { @Override public PackLock parse(ProgressMonitor receiving, ProgressMonitor resolving) throws IOException { - tmpPack = File.createTempFile("incoming_", ".pack", db.getDirectory()); - tmpIdx = new File(db.getDirectory(), baseName(tmpPack) + ".idx"); + tmpPack = File.createTempFile("incoming_", ".pack", db.getDirectory()); //$NON-NLS-1$ //$NON-NLS-2$ + tmpIdx = new File(db.getDirectory(), baseName(tmpPack) + ".idx"); //$NON-NLS-1$ try { - out = new RandomAccessFile(tmpPack, "rw"); + out = new RandomAccessFile(tmpPack, "rw"); //$NON-NLS-1$ super.parse(receiving, resolving); @@ -425,9 +425,9 @@ public class ObjectDirectoryPackParser extends PackParser { } final String name = ObjectId.fromRaw(d.digest()).name(); - final File packDir = new File(db.getDirectory(), "pack"); - final File finalPack = new File(packDir, "pack-" + name + ".pack"); - final File finalIdx = new File(packDir, "pack-" + name + ".idx"); + final File packDir = new File(db.getDirectory(), "pack"); //$NON-NLS-1$ + final File finalPack = new File(packDir, "pack-" + name + ".pack"); //$NON-NLS-1$ //$NON-NLS-2$ + final File finalIdx = new File(packDir, "pack-" + name + ".idx"); //$NON-NLS-1$ //$NON-NLS-2$ final PackLock keep = new PackLock(finalPack, db.getFS()); if (!packDir.exists() && !packDir.mkdir() && !packDir.exists()) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java index 1fe4c05968..a32acfc451 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java @@ -192,10 +192,10 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> { String name = packName; if (name == null) { name = getPackFile().getName(); - if (name.startsWith("pack-")) - name = name.substring("pack-".length()); - if (name.endsWith(".pack")) - name = name.substring(0, name.length() - ".pack".length()); + if (name.startsWith("pack-")) //$NON-NLS-1$ + name = name.substring("pack-".length()); //$NON-NLS-1$ + if (name.endsWith(".pack")) //$NON-NLS-1$ + name = name.substring(0, name.length() - ".pack".length()); //$NON-NLS-1$ packName = name; } return name; @@ -226,7 +226,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> { */ public boolean shouldBeKept() { if (keepFile == null) - keepFile = new File(packFile.getPath() + ".keep"); + keepFile = new File(packFile.getPath() + ".keep"); //$NON-NLS-1$ return keepFile.exists(); } @@ -589,7 +589,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> { if (invalid) throw new PackInvalidException(packFile); synchronized (readLock) { - fd = new RandomAccessFile(packFile, "r"); + fd = new RandomAccessFile(packFile, "r"); //$NON-NLS-1$ length = fd.length(); onOpenPack(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackLock.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackLock.java index a6e0a5a053..f98618aa5b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackLock.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackLock.java @@ -66,7 +66,7 @@ public class PackLock { public PackLock(final File packFile, final FS fs) { final File p = packFile.getParentFile(); final String n = packFile.getName(); - keepFile = new File(p, n.substring(0, n.length() - 5) + ".keep"); + keepFile = new File(p, n.substring(0, n.length() - 5) + ".keep"); //$NON-NLS-1$ this.fs = fs; } @@ -82,8 +82,8 @@ public class PackLock { public boolean lock(String msg) throws IOException { if (msg == null) return false; - if (!msg.endsWith("\n")) - msg += "\n"; + if (!msg.endsWith("\n")) //$NON-NLS-1$ + msg += "\n"; //$NON-NLS-1$ final LockFile lf = new LockFile(keepFile, fs); if (!lf.lock()) return false; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java index 6ae3f8cc8b..e0ce909d92 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java @@ -268,7 +268,7 @@ public class RefDirectory extends RefDatabase { break; } } catch (IOException e) { - if (!(!needle.contains("/") && "".equals(prefix) && e + if (!(!needle.contains("/") && "".equals(prefix) && e //$NON-NLS-1$ //$NON-NLS-2$ .getCause() instanceof InvalidObjectIdException)) { throw e; } @@ -356,7 +356,7 @@ public class RefDirectory extends RefDatabase { if (newLoose == null && curIdx < curLoose.size()) newLoose = curLoose.copy(curIdx); - } else if (prefix.startsWith(R_REFS) && prefix.endsWith("/")) { + } else if (prefix.startsWith(R_REFS) && prefix.endsWith("/")) { //$NON-NLS-1$ curIdx = -(curLoose.find(prefix) + 1); File dir = new File(refsDir, prefix.substring(R_REFS.length())); scanTree(prefix, dir); @@ -980,7 +980,7 @@ public class RefDirectory extends RefDatabase { * a temporary name cannot be allocated. */ RefDirectoryUpdate newTemporaryUpdate() throws IOException { - File tmp = File.createTempFile("renamed_", "_ref", refsDir); + File tmp = File.createTempFile("renamed_", "_ref", refsDir); //$NON-NLS-1$ //$NON-NLS-2$ String name = Constants.R_REFS + tmp.getName(); Ref ref = new ObjectIdRef.Unpeeled(NEW, name, null); return new RefDirectoryUpdate(this, ref); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java index b9f0e14efc..f336ea0089 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java @@ -112,7 +112,7 @@ class RefDirectoryUpdate extends RefUpdate { String strResult = toResultString(status); if (strResult != null) { if (msg.length() > 0) - msg = msg + ": " + strResult; + msg = msg + ": " + strResult; //$NON-NLS-1$ else msg = strResult; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ReflogEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ReflogEntry.java index 4b15807729..e995dcd217 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ReflogEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ReflogEntry.java @@ -81,10 +81,10 @@ public class ReflogEntry implements Serializable { who = RawParseUtils.parsePersonIdentOnly(raw, pos); int p0 = RawParseUtils.next(raw, pos, '\t'); if (p0 >= raw.length) - comment = ""; // personident has no \t, no comment present + comment = ""; // personident has no \t, no comment present //$NON-NLS-1$ else { int p1 = RawParseUtils.nextLF(raw, p0); - comment = p1 > p0 ? RawParseUtils.decode(raw, p0, p1 - 1) : ""; + comment = p1 > p0 ? RawParseUtils.decode(raw, p0, p1 - 1) : ""; //$NON-NLS-1$ } } @@ -116,10 +116,11 @@ public class ReflogEntry implements Serializable { return comment; } + @SuppressWarnings("nls") @Override public String toString() { - return "Entry[" + oldId.name() + ", " + newId.name() + ", " + getWho() + ", " - + getComment() + "]"; + return "Entry[" + oldId.name() + ", " + newId.name() + ", " + getWho() + + ", " + getComment() + "]"; } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCacheConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCacheConfig.java index c8e0d5584e..8060af791a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCacheConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCacheConfig.java @@ -189,14 +189,20 @@ public class WindowCacheConfig { * @param rc configuration to read properties from. */ public void fromConfig(final Config rc) { - setPackedGitOpenFiles(rc.getInt("core", null, "packedgitopenfiles", getPackedGitOpenFiles())); - setPackedGitLimit(rc.getLong("core", null, "packedgitlimit", getPackedGitLimit())); - setPackedGitWindowSize(rc.getInt("core", null, "packedgitwindowsize", getPackedGitWindowSize())); - setPackedGitMMAP(rc.getBoolean("core", null, "packedgitmmap", isPackedGitMMAP())); - setDeltaBaseCacheLimit(rc.getInt("core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); + setPackedGitOpenFiles(rc.getInt( + "core", null, "packedgitopenfiles", getPackedGitOpenFiles())); //$NON-NLS-1$ //$NON-NLS-2$ + setPackedGitLimit(rc.getLong( + "core", null, "packedgitlimit", getPackedGitLimit())); //$NON-NLS-1$ //$NON-NLS-2$ + setPackedGitWindowSize(rc.getInt( + "core", null, "packedgitwindowsize", getPackedGitWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ + setPackedGitMMAP(rc.getBoolean( + "core", null, "packedgitmmap", isPackedGitMMAP())); //$NON-NLS-1$ //$NON-NLS-2$ + setDeltaBaseCacheLimit(rc.getInt( + "core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$ long maxMem = Runtime.getRuntime().maxMemory(); - long sft = rc.getLong("core", null, "streamfilethreshold", getStreamFileThreshold()); + long sft = rc.getLong( + "core", null, "streamfilethreshold", getStreamFileThreshold()); //$NON-NLS-1$ //$NON-NLS-2$ sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length setStreamFileThreshold((int) sft); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WriteConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WriteConfig.java index fd467a5554..82a2a528b6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WriteConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WriteConfig.java @@ -63,8 +63,8 @@ class WriteConfig { private WriteConfig(final Config rc) { compression = rc.get(CoreConfig.KEY).getCompression(); - fsyncObjectFiles = rc.getBoolean("core", "fsyncobjectfiles", false); - fsyncRefFiles = rc.getBoolean("core", "fsyncreffiles", false); + fsyncObjectFiles = rc.getBoolean("core", "fsyncobjectfiles", false); //$NON-NLS-1$ //$NON-NLS-2$ + fsyncRefFiles = rc.getBoolean("core", "fsyncreffiles", false); //$NON-NLS-1$ //$NON-NLS-2$ } int getCompression() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java index 9e1cbd0e16..9971b79440 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java @@ -256,7 +256,7 @@ public class BinaryDelta { } while ((c & 0x80) != 0); if (includeHeader) - r.append("DELTA( BASE=" + baseLen + " RESULT=" + resLen + " )\n"); + r.append("DELTA( BASE=" + baseLen + " RESULT=" + resLen + " )\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ while (deltaPtr < delta.length) { final int cmd = delta[deltaPtr++] & 0xff; @@ -285,16 +285,16 @@ public class BinaryDelta { if (copySize == 0) copySize = 0x10000; - r.append(" COPY (" + copyOffset + ", " + copySize + ")\n"); + r.append(" COPY (" + copyOffset + ", " + copySize + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else if (cmd != 0) { // Anything else the data is literal within the delta // itself. // - r.append(" INSERT("); + r.append(" INSERT("); //$NON-NLS-1$ r.append(QuotedString.GIT_PATH.quote(RawParseUtils.decode( delta, deltaPtr, deltaPtr + cmd))); - r.append(")\n"); + r.append(")\n"); //$NON-NLS-1$ deltaPtr += cmd; } else { // cmd == 0 has been reserved for future encoding but diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaIndex.java index e548cc9365..4f2d5c7411 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaIndex.java @@ -421,6 +421,7 @@ public class DeltaIndex { return start - resPtr; } + @SuppressWarnings("nls") public String toString() { String[] units = { "bytes", "KiB", "MiB", "GiB" }; long sz = getIndexSize(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java index 9c50f8d015..1b8a9bf600 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java @@ -393,6 +393,7 @@ public class ObjectToPack extends PackedObjectInfo { // Empty by default. } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder buf = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java index 91275dc098..58ee985ff5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java @@ -624,21 +624,27 @@ public class PackConfig { * configuration to read properties from. */ public void fromConfig(final Config rc) { - setMaxDeltaDepth(rc.getInt("pack", "depth", getMaxDeltaDepth())); - setDeltaSearchWindowSize(rc.getInt("pack", "window", getDeltaSearchWindowSize())); - setDeltaSearchMemoryLimit(rc.getLong("pack", "windowmemory", getDeltaSearchMemoryLimit())); - setDeltaCacheSize(rc.getLong("pack", "deltacachesize", getDeltaCacheSize())); - setDeltaCacheLimit(rc.getInt("pack", "deltacachelimit", getDeltaCacheLimit())); - setCompressionLevel(rc.getInt("pack", "compression", - rc.getInt("core", "compression", getCompressionLevel()))); - setIndexVersion(rc.getInt("pack", "indexversion", getIndexVersion())); - setBigFileThreshold(rc.getInt("core", "bigfilethreshold", getBigFileThreshold())); - setThreads(rc.getInt("pack", "threads", getThreads())); + setMaxDeltaDepth(rc.getInt("pack", "depth", getMaxDeltaDepth())); //$NON-NLS-1$ //$NON-NLS-2$ + setDeltaSearchWindowSize(rc.getInt( + "pack", "window", getDeltaSearchWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ + setDeltaSearchMemoryLimit(rc.getLong( + "pack", "windowmemory", getDeltaSearchMemoryLimit())); //$NON-NLS-1$ //$NON-NLS-2$ + setDeltaCacheSize(rc.getLong( + "pack", "deltacachesize", getDeltaCacheSize())); //$NON-NLS-1$ //$NON-NLS-2$ + setDeltaCacheLimit(rc.getInt( + "pack", "deltacachelimit", getDeltaCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$ + setCompressionLevel(rc.getInt("pack", "compression", //$NON-NLS-1$ //$NON-NLS-2$ + rc.getInt("core", "compression", getCompressionLevel()))); //$NON-NLS-1$ //$NON-NLS-2$ + setIndexVersion(rc.getInt("pack", "indexversion", getIndexVersion())); //$NON-NLS-1$ //$NON-NLS-2$ + setBigFileThreshold(rc.getInt( + "core", "bigfilethreshold", getBigFileThreshold())); //$NON-NLS-1$ //$NON-NLS-2$ + setThreads(rc.getInt("pack", "threads", getThreads())); //$NON-NLS-1$ //$NON-NLS-2$ // These variables aren't standardized // - setReuseDeltas(rc.getBoolean("pack", "reusedeltas", isReuseDeltas())); - setReuseObjects(rc.getBoolean("pack", "reuseobjects", isReuseObjects())); - setDeltaCompress(rc.getBoolean("pack", "deltacompression", isDeltaCompress())); + setReuseDeltas(rc.getBoolean("pack", "reusedeltas", isReuseDeltas())); //$NON-NLS-1$ //$NON-NLS-2$ + setReuseObjects(rc.getBoolean("pack", "reuseobjects", isReuseObjects())); //$NON-NLS-1$ //$NON-NLS-2$ + setDeltaCompress(rc.getBoolean( + "pack", "deltacompression", isDeltaCompress())); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java index 99ec75cf92..bfb6c652d9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java @@ -1379,7 +1379,7 @@ public class PackWriter { // Object writing already started, we cannot recover. // CorruptObjectException coe; - coe = new CorruptObjectException(otp, ""); + coe = new CorruptObjectException(otp, ""); //$NON-NLS-1$ coe.initCause(gone); throw coe; } @@ -1504,9 +1504,9 @@ public class PackWriter { all.addAll(have); final Map<ObjectId, CachedPack> tipToPack = new HashMap<ObjectId, CachedPack>(); - final RevFlag inCachedPack = walker.newFlag("inCachedPack"); - final RevFlag include = walker.newFlag("include"); - final RevFlag added = walker.newFlag("added"); + final RevFlag inCachedPack = walker.newFlag("inCachedPack"); //$NON-NLS-1$ + final RevFlag include = walker.newFlag("include"); //$NON-NLS-1$ + final RevFlag added = walker.newFlag("added"); //$NON-NLS-1$ final RevFlagSet keepOnRestart = new RevFlagSet(); keepOnRestart.add(inCachedPack); @@ -2279,6 +2279,7 @@ public class PackWriter { return bytesUsed; } + @SuppressWarnings("nls") @Override public String toString() { return "PackWriter.State[" + phase + ", memory=" + bytesUsed + "]"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java index e8022b69de..c31ffd1f7d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java @@ -232,7 +232,7 @@ public class SubmoduleWalk { */ public static String getSubmoduleRemoteUrl(final Repository parent, final String url) throws IOException { - if (!url.startsWith("./") && !url.startsWith("../")) + if (!url.startsWith("./") && !url.startsWith("../")) //$NON-NLS-1$ //$NON-NLS-2$ return url; String remoteName = null; @@ -270,9 +270,9 @@ public class SubmoduleWalk { char separator = '/'; String submoduleUrl = url; while (submoduleUrl.length() > 0) { - if (submoduleUrl.startsWith("./")) + if (submoduleUrl.startsWith("./")) //$NON-NLS-1$ submoduleUrl = submoduleUrl.substring(2); - else if (submoduleUrl.startsWith("../")) { + else if (submoduleUrl.startsWith("../")) { //$NON-NLS-1$ int lastSeparator = remoteUrl.lastIndexOf('/'); if (lastSeparator < 1) { lastSeparator = remoteUrl.lastIndexOf(':'); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index 8a595db336..99d8b09d87 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -113,24 +113,24 @@ import org.xml.sax.helpers.XMLReaderFactory; public class AmazonS3 { private static final Set<String> SIGNED_HEADERS; - private static final String HMAC = "HmacSHA1"; + private static final String HMAC = "HmacSHA1"; //$NON-NLS-1$ - private static final String DOMAIN = "s3.amazonaws.com"; + private static final String DOMAIN = "s3.amazonaws.com"; //$NON-NLS-1$ - private static final String X_AMZ_ACL = "x-amz-acl"; + private static final String X_AMZ_ACL = "x-amz-acl"; //$NON-NLS-1$ - private static final String X_AMZ_META = "x-amz-meta-"; + private static final String X_AMZ_META = "x-amz-meta-"; //$NON-NLS-1$ static { SIGNED_HEADERS = new HashSet<String>(); - SIGNED_HEADERS.add("content-type"); - SIGNED_HEADERS.add("content-md5"); - SIGNED_HEADERS.add("date"); + SIGNED_HEADERS.add("content-type"); //$NON-NLS-1$ + SIGNED_HEADERS.add("content-md5"); //$NON-NLS-1$ + SIGNED_HEADERS.add("date"); //$NON-NLS-1$ } private static boolean isSignedHeader(final String name) { final String nameLC = StringUtils.toLowerCase(name); - return SIGNED_HEADERS.contains(nameLC) || nameLC.startsWith("x-amz-"); + return SIGNED_HEADERS.contains(nameLC) || nameLC.startsWith("x-amz-"); //$NON-NLS-1$ } private static String toCleanString(final List<String> list) { @@ -138,27 +138,27 @@ public class AmazonS3 { for (final String v : list) { if (s.length() > 0) s.append(','); - s.append(v.replaceAll("\n", "").trim()); + s.append(v.replaceAll("\n", "").trim()); //$NON-NLS-1$ //$NON-NLS-2$ } return s.toString(); } private static String remove(final Map<String, String> m, final String k) { final String r = m.remove(k); - return r != null ? r : ""; + return r != null ? r : ""; //$NON-NLS-1$ } private static String httpNow() { - final String tz = "GMT"; + final String tz = "GMT"; //$NON-NLS-1$ final SimpleDateFormat fmt; - fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.US); + fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.US); //$NON-NLS-1$ fmt.setTimeZone(TimeZone.getTimeZone(tz)); - return fmt.format(new Date()) + " " + tz; + return fmt.format(new Date()) + " " + tz; //$NON-NLS-1$ } private static MessageDigest newMD5() { try { - return MessageDigest.getInstance("MD5"); + return MessageDigest.getInstance("MD5"); //$NON-NLS-1$ } catch (NoSuchAlgorithmException e) { throw new RuntimeException(JGitText.get().JRELacksMD5Implementation, e); } @@ -211,33 +211,33 @@ public class AmazonS3 { * */ public AmazonS3(final Properties props) { - publicKey = props.getProperty("accesskey"); + publicKey = props.getProperty("accesskey"); //$NON-NLS-1$ if (publicKey == null) throw new IllegalArgumentException(JGitText.get().missingAccesskey); - final String secret = props.getProperty("secretkey"); + final String secret = props.getProperty("secretkey"); //$NON-NLS-1$ if (secret == null) throw new IllegalArgumentException(JGitText.get().missingSecretkey); privateKey = new SecretKeySpec(Constants.encodeASCII(secret), HMAC); - final String pacl = props.getProperty("acl", "PRIVATE"); - if (StringUtils.equalsIgnoreCase("PRIVATE", pacl)) - acl = "private"; - else if (StringUtils.equalsIgnoreCase("PUBLIC", pacl)) - acl = "public-read"; - else if (StringUtils.equalsIgnoreCase("PUBLIC-READ", pacl)) - acl = "public-read"; - else if (StringUtils.equalsIgnoreCase("PUBLIC_READ", pacl)) - acl = "public-read"; + final String pacl = props.getProperty("acl", "PRIVATE"); //$NON-NLS-1$ //$NON-NLS-2$ + if (StringUtils.equalsIgnoreCase("PRIVATE", pacl)) //$NON-NLS-1$ + acl = "private"; //$NON-NLS-1$ + else if (StringUtils.equalsIgnoreCase("PUBLIC", pacl)) //$NON-NLS-1$ + acl = "public-read"; //$NON-NLS-1$ + else if (StringUtils.equalsIgnoreCase("PUBLIC-READ", pacl)) //$NON-NLS-1$ + acl = "public-read"; //$NON-NLS-1$ + else if (StringUtils.equalsIgnoreCase("PUBLIC_READ", pacl)) //$NON-NLS-1$ + acl = "public-read"; //$NON-NLS-1$ else - throw new IllegalArgumentException("Invalid acl: " + pacl); + throw new IllegalArgumentException("Invalid acl: " + pacl); //$NON-NLS-1$ try { - final String cPas = props.getProperty("password"); + final String cPas = props.getProperty("password"); //$NON-NLS-1$ if (cPas != null) { - String cAlg = props.getProperty("crypto.algorithm"); + String cAlg = props.getProperty("crypto.algorithm"); //$NON-NLS-1$ if (cAlg == null) - cAlg = "PBEWithMD5AndDES"; + cAlg = "PBEWithMD5AndDES"; //$NON-NLS-1$ encryption = new WalkEncryption.ObjectEncryptionV2(cAlg, cPas); } else { encryption = WalkEncryption.NONE; @@ -249,7 +249,7 @@ public class AmazonS3 { } maxAttempts = Integer.parseInt(props.getProperty( - "httpclient.retry-max", "3")); + "httpclient.retry-max", "3")); //$NON-NLS-1$ //$NON-NLS-2$ proxySelector = ProxySelector.getDefault(); } @@ -269,7 +269,7 @@ public class AmazonS3 { public URLConnection get(final String bucket, final String key) throws IOException { for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) { - final HttpURLConnection c = open("GET", bucket, key); + final HttpURLConnection c = open("GET", bucket, key); //$NON-NLS-1$ authorize(c); switch (HttpSupport.response(c)) { case HttpURLConnection.HTTP_OK: @@ -321,8 +321,8 @@ public class AmazonS3 { */ public List<String> list(final String bucket, String prefix) throws IOException { - if (prefix.length() > 0 && !prefix.endsWith("/")) - prefix += "/"; + if (prefix.length() > 0 && !prefix.endsWith("/")) //$NON-NLS-1$ + prefix += "/"; //$NON-NLS-1$ final ListParser lp = new ListParser(bucket, prefix); do { lp.list(); @@ -345,7 +345,7 @@ public class AmazonS3 { public void delete(final String bucket, final String key) throws IOException { for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) { - final HttpURLConnection c = open("DELETE", bucket, key); + final HttpURLConnection c = open("DELETE", bucket, key); //$NON-NLS-1$ authorize(c); switch (HttpSupport.response(c)) { case HttpURLConnection.HTTP_NO_CONTENT: @@ -394,9 +394,9 @@ public class AmazonS3 { final String md5str = Base64.encodeBytes(newMD5().digest(data)); final String lenstr = String.valueOf(data.length); for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) { - final HttpURLConnection c = open("PUT", bucket, key); - c.setRequestProperty("Content-Length", lenstr); - c.setRequestProperty("Content-MD5", md5str); + final HttpURLConnection c = open("PUT", bucket, key); //$NON-NLS-1$ + c.setRequestProperty("Content-Length", lenstr); //$NON-NLS-1$ + c.setRequestProperty("Content-MD5", md5str); //$NON-NLS-1$ c.setRequestProperty(X_AMZ_ACL, acl); authorize(c); c.setDoOutput(true); @@ -479,9 +479,9 @@ public class AmazonS3 { final long len = buf.length(); final String lenstr = String.valueOf(len); for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) { - final HttpURLConnection c = open("PUT", bucket, key); - c.setRequestProperty("Content-Length", lenstr); - c.setRequestProperty("Content-MD5", md5str); + final HttpURLConnection c = open("PUT", bucket, key); //$NON-NLS-1$ + c.setRequestProperty("Content-Length", lenstr); //$NON-NLS-1$ + c.setRequestProperty("Content-MD5", md5str); //$NON-NLS-1$ c.setRequestProperty(X_AMZ_ACL, acl); encryption.request(c, X_AMZ_META); authorize(c); @@ -529,7 +529,7 @@ public class AmazonS3 { } buf = b.toByteArray(); if (buf.length > 0) - err.initCause(new IOException("\n" + new String(buf))); + err.initCause(new IOException("\n" + new String(buf))); //$NON-NLS-1$ return err; } @@ -549,7 +549,7 @@ public class AmazonS3 { final String key, final Map<String, String> args) throws IOException { final StringBuilder urlstr = new StringBuilder(); - urlstr.append("http://"); + urlstr.append("http://"); //$NON-NLS-1$ urlstr.append(bucket); urlstr.append('.'); urlstr.append(DOMAIN); @@ -577,8 +577,8 @@ public class AmazonS3 { c = (HttpURLConnection) url.openConnection(proxy); c.setRequestMethod(method); - c.setRequestProperty("User-Agent", "jgit/1.0"); - c.setRequestProperty("Date", httpNow()); + c.setRequestProperty("User-Agent", "jgit/1.0"); //$NON-NLS-1$ //$NON-NLS-2$ + c.setRequestProperty("Date", httpNow()); //$NON-NLS-1$ return c; } @@ -595,13 +595,13 @@ public class AmazonS3 { s.append(c.getRequestMethod()); s.append('\n'); - s.append(remove(sigHdr, "content-md5")); + s.append(remove(sigHdr, "content-md5")); //$NON-NLS-1$ s.append('\n'); - s.append(remove(sigHdr, "content-type")); + s.append(remove(sigHdr, "content-type")); //$NON-NLS-1$ s.append('\n'); - s.append(remove(sigHdr, "date")); + s.append(remove(sigHdr, "date")); //$NON-NLS-1$ s.append('\n'); for (final Map.Entry<String, String> e : sigHdr.entrySet()) { @@ -620,13 +620,13 @@ public class AmazonS3 { try { final Mac m = Mac.getInstance(HMAC); m.init(privateKey); - sec = Base64.encodeBytes(m.doFinal(s.toString().getBytes("UTF-8"))); + sec = Base64.encodeBytes(m.doFinal(s.toString().getBytes("UTF-8"))); //$NON-NLS-1$ } catch (NoSuchAlgorithmException e) { throw new IOException(MessageFormat.format(JGitText.get().noHMACsupport, HMAC, e.getMessage())); } catch (InvalidKeyException e) { throw new IOException(MessageFormat.format(JGitText.get().invalidKey, e.getMessage())); } - c.setRequestProperty("Authorization", "AWS " + publicKey + ":" + sec); + c.setRequestProperty("Authorization", "AWS " + publicKey + ":" + sec); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } static Properties properties(final File authFile) @@ -660,12 +660,12 @@ public class AmazonS3 { void list() throws IOException { final Map<String, String> args = new TreeMap<String, String>(); if (prefix.length() > 0) - args.put("prefix", prefix); + args.put("prefix", prefix); //$NON-NLS-1$ if (!entries.isEmpty()) - args.put("marker", prefix + entries.get(entries.size() - 1)); + args.put("marker", prefix + entries.get(entries.size() - 1)); //$NON-NLS-1$ for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) { - final HttpURLConnection c = open("GET", bucket, "", args); + final HttpURLConnection c = open("GET", bucket, "", args); //$NON-NLS-1$ //$NON-NLS-2$ authorize(c); switch (HttpSupport.response(c)) { case HttpURLConnection.HTTP_OK: @@ -696,17 +696,17 @@ public class AmazonS3 { continue; default: - throw AmazonS3.this.error("Listing", prefix, c); + throw AmazonS3.this.error("Listing", prefix, c); //$NON-NLS-1$ } } - throw maxAttempts("Listing", prefix); + throw maxAttempts("Listing", prefix); //$NON-NLS-1$ } @Override public void startElement(final String uri, final String name, final String qName, final Attributes attributes) throws SAXException { - if ("Key".equals(name) || "IsTruncated".equals(name)) + if ("Key".equals(name) || "IsTruncated".equals(name)) //$NON-NLS-1$ //$NON-NLS-2$ data = new StringBuilder(); } @@ -727,10 +727,10 @@ public class AmazonS3 { @Override public void endElement(final String uri, final String name, final String qName) throws SAXException { - if ("Key".equals(name)) + if ("Key".equals(name)) //$NON-NLS-1$ entries.add(data.toString().substring(prefix.length())); - else if ("IsTruncated".equals(name)) - truncated = StringUtils.equalsIgnoreCase("true", data.toString()); + else if ("IsTruncated".equals(name)) //$NON-NLS-1$ + truncated = StringUtils.equalsIgnoreCase("true", data.toString()); //$NON-NLS-1$ data = null; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java index 37b347bbc1..1072d58ada 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java @@ -82,7 +82,7 @@ public abstract class BaseConnection implements Connection { } public String getMessages() { - return messageWriter != null ? messageWriter.toString() : ""; + return messageWriter != null ? messageWriter.toString() : ""; //$NON-NLS-1$ } public abstract void close(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java index c7cee1ee61..8f825ea14f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java @@ -141,7 +141,7 @@ abstract class BasePackConnection extends BaseConnection { final int timeout = transport.getTimeout(); if (timeout > 0) { final Thread caller = Thread.currentThread(); - myTimer = new InterruptTimer(caller.getName() + "-Timer"); + myTimer = new InterruptTimer(caller.getName() + "-Timer"); //$NON-NLS-1$ timeoutIn = new TimeoutInputStream(myIn, myTimer); timeoutOut = new TimeoutOutputStream(myOut, myTimer); timeoutIn.setTimeout(timeout * 1000); @@ -201,7 +201,7 @@ abstract class BasePackConnection extends BaseConnection { if (line == PacketLineIn.END) break; - if (line.startsWith("ERR ")) { + if (line.startsWith("ERR ")) { //$NON-NLS-1$ // This is a customized remote service error. // Users should be informed about it. throw new RemoteRepositoryException(uri, line.substring(4)); @@ -212,23 +212,23 @@ abstract class BasePackConnection extends BaseConnection { if (nul >= 0) { // The first line (if any) may contain "hidden" // capability values after a NUL byte. - for (String c : line.substring(nul + 1).split(" ")) + for (String c : line.substring(nul + 1).split(" ")) //$NON-NLS-1$ remoteCapablities.add(c); line = line.substring(0, nul); } } String name = line.substring(41, line.length()); - if (avail.isEmpty() && name.equals("capabilities^{}")) { + if (avail.isEmpty() && name.equals("capabilities^{}")) { //$NON-NLS-1$ // special line from git-receive-pack to show // capabilities when there are no refs to advertise continue; } final ObjectId id = ObjectId.fromString(line.substring(0, 40)); - if (name.equals(".have")) { + if (name.equals(".have")) { //$NON-NLS-1$ additionalHaves.add(id); - } else if (name.endsWith("^{}")) { + } else if (name.endsWith("^{}")) { //$NON-NLS-1$ name = name.substring(0, name.length() - 3); final Ref prior = avail.get(name); if (prior == null) @@ -236,7 +236,7 @@ abstract class BasePackConnection extends BaseConnection { JGitText.get().advertisementCameBefore, name, name)); if (prior.getPeeledObjectId() != null) - throw duplicateAdvertisement(name + "^{}"); + throw duplicateAdvertisement(name + "^{}"); //$NON-NLS-1$ avail.put(name, new ObjectIdRef.PeeledTag( Ref.Storage.NETWORK, name, prior.getObjectId(), id)); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index 582b75a252..8a6140513f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -124,61 +124,61 @@ public abstract class BasePackFetchConnection extends BasePackConnection * Include tags if we are also including the referenced objects. * @since 2.0 */ - public static final String OPTION_INCLUDE_TAG = "include-tag"; + public static final String OPTION_INCLUDE_TAG = "include-tag"; //$NON-NLS-1$ /** * Mutli-ACK support for improved negotiation. * @since 2.0 */ - public static final String OPTION_MULTI_ACK = "multi_ack"; + public static final String OPTION_MULTI_ACK = "multi_ack"; //$NON-NLS-1$ /** * Mutli-ACK detailed support for improved negotiation. * @since 2.0 */ - public static final String OPTION_MULTI_ACK_DETAILED = "multi_ack_detailed"; + public static final String OPTION_MULTI_ACK_DETAILED = "multi_ack_detailed"; //$NON-NLS-1$ /** * The client supports packs with deltas but not their bases. * @since 2.0 */ - public static final String OPTION_THIN_PACK = "thin-pack"; + public static final String OPTION_THIN_PACK = "thin-pack"; //$NON-NLS-1$ /** * The client supports using the side-band for progress messages. * @since 2.0 */ - public static final String OPTION_SIDE_BAND = "side-band"; + public static final String OPTION_SIDE_BAND = "side-band"; //$NON-NLS-1$ /** * The client supports using the 64K side-band for progress messages. * @since 2.0 */ - public static final String OPTION_SIDE_BAND_64K = "side-band-64k"; + public static final String OPTION_SIDE_BAND_64K = "side-band-64k"; //$NON-NLS-1$ /** * The client supports packs with OFS deltas. * @since 2.0 */ - public static final String OPTION_OFS_DELTA = "ofs-delta"; + public static final String OPTION_OFS_DELTA = "ofs-delta"; //$NON-NLS-1$ /** * The client supports shallow fetches. * @since 2.0 */ - public static final String OPTION_SHALLOW = "shallow"; + public static final String OPTION_SHALLOW = "shallow"; //$NON-NLS-1$ /** * The client does not want progress messages and will ignore them. * @since 2.0 */ - public static final String OPTION_NO_PROGRESS = "no-progress"; + public static final String OPTION_NO_PROGRESS = "no-progress"; //$NON-NLS-1$ /** * The client supports receiving a pack before it has sent "done". * @since 2.0 */ - public static final String OPTION_NO_DONE = "no-done"; + public static final String OPTION_NO_DONE = "no-done"; //$NON-NLS-1$ static enum MultiAck { OFF, CONTINUE, DETAILED; @@ -238,10 +238,10 @@ public abstract class BasePackFetchConnection extends BasePackConnection walk = new RevWalk(local); reachableCommits = new RevCommitList<RevCommit>(); - REACHABLE = walk.newFlag("REACHABLE"); - COMMON = walk.newFlag("COMMON"); - STATE = walk.newFlag("STATE"); - ADVERTISED = walk.newFlag("ADVERTISED"); + REACHABLE = walk.newFlag("REACHABLE"); //$NON-NLS-1$ + COMMON = walk.newFlag("COMMON"); //$NON-NLS-1$ + STATE = walk.newFlag("STATE"); //$NON-NLS-1$ + ADVERTISED = walk.newFlag("ADVERTISED"); //$NON-NLS-1$ walk.carry(COMMON); walk.carry(REACHABLE); @@ -258,7 +258,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection final boolean allowOfsDelta; FetchConfig(final Config c) { - allowOfsDelta = c.getBoolean("repack", "usedeltabaseoffset", true); + allowOfsDelta = c.getBoolean("repack", "usedeltabaseoffset", true); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -429,7 +429,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection } final StringBuilder line = new StringBuilder(46); - line.append("want "); + line.append("want "); //$NON-NLS-1$ line.append(r.getObjectId().name()); if (first) { line.append(enableCapabilities()); @@ -500,7 +500,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection if (c == null) break SEND_HAVES; - pckOut.writeString("have " + c.getId().name() + "\n"); + pckOut.writeString("have " + c.getId().name() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ havesSent++; havesSinceLastContinue++; @@ -595,7 +595,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection // loop above while in the middle of a request. This allows us // to just write done immediately. // - pckOut.writeString("done\n"); + pckOut.writeString("done\n"); //$NON-NLS-1$ pckOut.flush(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java index 119b266161..e97f03c3f1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java @@ -87,25 +87,25 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen * The client expects a status report after the server processes the pack. * @since 2.0 */ - public static final String CAPABILITY_REPORT_STATUS = "report-status"; + public static final String CAPABILITY_REPORT_STATUS = "report-status"; //$NON-NLS-1$ /** * The server supports deleting refs. * @since 2.0 */ - public static final String CAPABILITY_DELETE_REFS = "delete-refs"; + public static final String CAPABILITY_DELETE_REFS = "delete-refs"; //$NON-NLS-1$ /** * The server supports packs with OFS deltas. * @since 2.0 */ - public static final String CAPABILITY_OFS_DELTA = "ofs-delta"; + public static final String CAPABILITY_OFS_DELTA = "ofs-delta"; //$NON-NLS-1$ /** * The client supports using the 64K side-band for progress messages. * @since 2.0 */ - public static final String CAPABILITY_SIDE_BAND_64K = "side-band-64k"; + public static final String CAPABILITY_SIDE_BAND_64K = "side-band-64k"; //$NON-NLS-1$ private final boolean thinPack; @@ -291,10 +291,10 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen private void readStatusReport(final Map<String, RemoteRefUpdate> refUpdates) throws IOException { final String unpackLine = readStringLongTimeout(); - if (!unpackLine.startsWith("unpack ")) + if (!unpackLine.startsWith("unpack ")) //$NON-NLS-1$ throw new PackProtocolException(uri, MessageFormat.format(JGitText.get().unexpectedReportLine, unpackLine)); - final String unpackStatus = unpackLine.substring("unpack ".length()); - if (!unpackStatus.equals("ok")) + final String unpackStatus = unpackLine.substring("unpack ".length()); //$NON-NLS-1$ + if (!unpackStatus.equals("ok")) //$NON-NLS-1$ throw new TransportException(uri, MessageFormat.format( JGitText.get().errorOccurredDuringUnpackingOnTheRemoteEnd, unpackStatus)); @@ -302,12 +302,12 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen while ((refLine = pckIn.readString()) != PacketLineIn.END) { boolean ok = false; int refNameEnd = -1; - if (refLine.startsWith("ok ")) { + if (refLine.startsWith("ok ")) { //$NON-NLS-1$ ok = true; refNameEnd = refLine.length(); - } else if (refLine.startsWith("ng ")) { + } else if (refLine.startsWith("ng ")) { //$NON-NLS-1$ ok = false; - refNameEnd = refLine.indexOf(" ", 3); + refNameEnd = refLine.indexOf(" ", 3); //$NON-NLS-1$ } if (refNameEnd == -1) throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedReportLine2 diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index 57ccdccfda..26cf903434 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -115,7 +115,7 @@ public abstract class BaseReceivePack { final HashSet<String> caps = new HashSet<String>(); final int nul = line.indexOf('\0'); if (nul >= 0) { - for (String c : line.substring(nul + 1).split(" ")) + for (String c : line.substring(nul + 1).split(" ")) //$NON-NLS-1$ caps.add(c); this.line = line.substring(0, nul); } else @@ -274,13 +274,13 @@ public abstract class BaseReceivePack { final boolean allowOfsDelta; ReceiveConfig(final Config config) { - checkReceivedObjects = config.getBoolean("receive", "fsckobjects", + checkReceivedObjects = config.getBoolean("receive", "fsckobjects", //$NON-NLS-1$ //$NON-NLS-2$ false); allowCreates = true; - allowDeletes = !config.getBoolean("receive", "denydeletes", false); - allowNonFastForwards = !config.getBoolean("receive", - "denynonfastforwards", false); - allowOfsDelta = config.getBoolean("repack", "usedeltabaseoffset", + allowDeletes = !config.getBoolean("receive", "denydeletes", false); //$NON-NLS-1$ //$NON-NLS-2$ + allowNonFastForwards = !config.getBoolean("receive", //$NON-NLS-1$ + "denynonfastforwards", false); //$NON-NLS-1$ + allowOfsDelta = config.getBoolean("repack", "usedeltabaseoffset", //$NON-NLS-1$ //$NON-NLS-2$ true); } } @@ -673,7 +673,7 @@ public abstract class BaseReceivePack { advertiseError = new StringBuilder(); advertiseError.append(what).append('\n'); } else { - msgOutWrapper.write(Constants.encode("error: " + what + "\n")); + msgOutWrapper.write(Constants.encode("error: " + what + "\n")); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -688,7 +688,7 @@ public abstract class BaseReceivePack { * string must not end with an LF, and must not contain an LF. */ public void sendMessage(final String what) { - msgOutWrapper.write(Constants.encode(what + "\n")); + msgOutWrapper.write(Constants.encode(what + "\n")); //$NON-NLS-1$ } /** @return an underlying stream for sending messages to the client. */ @@ -732,7 +732,7 @@ public abstract class BaseReceivePack { if (timeout > 0) { final Thread caller = Thread.currentThread(); - timer = new InterruptTimer(caller.getName() + "-Timer"); + timer = new InterruptTimer(caller.getName() + "-Timer"); //$NON-NLS-1$ timeoutIn = new TimeoutInputStream(rawIn, timer); TimeoutOutputStream o = new TimeoutOutputStream(rawOut, timer); timeoutIn.setTimeout(timeout * 1000); @@ -795,7 +795,7 @@ public abstract class BaseReceivePack { public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { - adv.writeOne("ERR " + advertiseError); + adv.writeOne("ERR " + advertiseError); //$NON-NLS-1$ return; } @@ -803,7 +803,7 @@ public abstract class BaseReceivePack { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { - adv.writeOne("ERR " + fail.getMessage()); + adv.writeOne("ERR " + fail.getMessage()); //$NON-NLS-1$ fail.setOutput(); } throw fail; @@ -819,7 +819,7 @@ public abstract class BaseReceivePack { for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) - adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); + adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); //$NON-NLS-1$ adv.end(); } @@ -921,9 +921,9 @@ public abstract class BaseReceivePack { ObjectInserter ins = db.newObjectInserter(); try { - String lockMsg = "jgit receive-pack"; + String lockMsg = "jgit receive-pack"; //$NON-NLS-1$ if (getRefLogIdent() != null) - lockMsg += " from " + getRefLogIdent().toExternalString(); + lockMsg += " from " + getRefLogIdent().toExternalString(); //$NON-NLS-1$ parser = ins.newPackParser(rawIn); parser.setAllowThin(true); @@ -1167,7 +1167,7 @@ public abstract class BaseReceivePack { BatchRefUpdate batch = db.getRefDatabase().newBatchUpdate(); batch.setAllowNonFastForwards(isAllowNonFastForwards()); batch.setRefLogIdent(getRefLogIdent()); - batch.setRefLogMessage("push", true); + batch.setRefLogMessage("push", true); //$NON-NLS-1$ batch.addCommand(toApply); try { batch.execute(walk, updating); @@ -1195,70 +1195,70 @@ public abstract class BaseReceivePack { protected void sendStatusReport(final boolean forClient, final Throwable unpackError, final Reporter out) throws IOException { if (unpackError != null) { - out.sendString("unpack error " + unpackError.getMessage()); + out.sendString("unpack error " + unpackError.getMessage()); //$NON-NLS-1$ if (forClient) { for (final ReceiveCommand cmd : commands) { - out.sendString("ng " + cmd.getRefName() - + " n/a (unpacker error)"); + out.sendString("ng " + cmd.getRefName() //$NON-NLS-1$ + + " n/a (unpacker error)"); //$NON-NLS-1$ } } return; } if (forClient) - out.sendString("unpack ok"); + out.sendString("unpack ok"); //$NON-NLS-1$ for (final ReceiveCommand cmd : commands) { if (cmd.getResult() == Result.OK) { if (forClient) - out.sendString("ok " + cmd.getRefName()); + out.sendString("ok " + cmd.getRefName()); //$NON-NLS-1$ continue; } final StringBuilder r = new StringBuilder(); if (forClient) - r.append("ng ").append(cmd.getRefName()).append(" "); + r.append("ng ").append(cmd.getRefName()).append(" "); //$NON-NLS-1$ //$NON-NLS-2$ else - r.append(" ! [rejected] ").append(cmd.getRefName()).append(" ("); + r.append(" ! [rejected] ").append(cmd.getRefName()).append(" ("); //$NON-NLS-1$ //$NON-NLS-2$ switch (cmd.getResult()) { case NOT_ATTEMPTED: - r.append("server bug; ref not processed"); + r.append("server bug; ref not processed"); //$NON-NLS-1$ break; case REJECTED_NOCREATE: - r.append("creation prohibited"); + r.append("creation prohibited"); //$NON-NLS-1$ break; case REJECTED_NODELETE: - r.append("deletion prohibited"); + r.append("deletion prohibited"); //$NON-NLS-1$ break; case REJECTED_NONFASTFORWARD: - r.append("non-fast forward"); + r.append("non-fast forward"); //$NON-NLS-1$ break; case REJECTED_CURRENT_BRANCH: - r.append("branch is currently checked out"); + r.append("branch is currently checked out"); //$NON-NLS-1$ break; case REJECTED_MISSING_OBJECT: if (cmd.getMessage() == null) - r.append("missing object(s)"); + r.append("missing object(s)"); //$NON-NLS-1$ else if (cmd.getMessage().length() == Constants.OBJECT_ID_STRING_LENGTH) - r.append("object " + cmd.getMessage() + " missing"); + r.append("object " + cmd.getMessage() + " missing"); //$NON-NLS-1$ //$NON-NLS-2$ else r.append(cmd.getMessage()); break; case REJECTED_OTHER_REASON: if (cmd.getMessage() == null) - r.append("unspecified reason"); + r.append("unspecified reason"); //$NON-NLS-1$ else r.append(cmd.getMessage()); break; case LOCK_FAILURE: - r.append("failed to lock"); + r.append("failed to lock"); //$NON-NLS-1$ break; case OK: @@ -1266,7 +1266,7 @@ public abstract class BaseReceivePack { continue; } if (!forClient) - r.append(")"); + r.append(")"); //$NON-NLS-1$ out.sendString(r.toString()); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java index 5f3fc404cc..10af0554e8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java @@ -217,8 +217,8 @@ class BundleFetchConnection extends BaseFetchConnection { final RevWalk rw = new RevWalk(transport.local); try { - final RevFlag PREREQ = rw.newFlag("PREREQ"); - final RevFlag SEEN = rw.newFlag("SEEN"); + final RevFlag PREREQ = rw.newFlag("PREREQ"); //$NON-NLS-1$ + final RevFlag SEEN = rw.newFlag("SEEN"); //$NON-NLS-1$ final Map<ObjectId, String> missing = new HashMap<ObjectId, String>(); final List<RevObject> commits = new ArrayList<RevObject>(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java index 927822bd8b..6757aaf108 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java @@ -78,7 +78,7 @@ public class CredentialsProviderUserInfo implements UserInfo, private static URIish createURI(Session session) { URIish uri = new URIish(); - uri = uri.setScheme("ssh"); + uri = uri.setScheme("ssh"); //$NON-NLS-1$ uri = uri.setUser(session.getUserName()); uri = uri.setHost(session.getHost()); uri = uri.setPort(session.getPort()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java index 78306766d8..89f0764a5e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java @@ -105,7 +105,7 @@ public class Daemon { */ public Daemon(final InetSocketAddress addr) { myAddress = addr; - processors = new ThreadGroup("Git-Daemon"); + processors = new ThreadGroup("Git-Daemon"); //$NON-NLS-1$ repositoryResolver = (RepositoryResolver<DaemonClient>) RepositoryResolver.NONE; @@ -130,8 +130,8 @@ public class Daemon { String host = peer.getCanonicalHostName(); if (host == null) host = peer.getHostAddress(); - String name = "anonymous"; - String email = name + "@" + host; + String name = "anonymous"; //$NON-NLS-1$ + String email = name + "@" + host; //$NON-NLS-1$ rp.setRefLogIdent(new PersonIdent(name, email)); rp.setTimeout(getTimeout()); @@ -140,7 +140,7 @@ public class Daemon { }; services = new DaemonService[] { - new DaemonService("upload-pack", "uploadpack") { + new DaemonService("upload-pack", "uploadpack") { //$NON-NLS-1$ //$NON-NLS-2$ { setEnabled(true); } @@ -155,7 +155,7 @@ public class Daemon { OutputStream out = dc.getOutputStream(); up.upload(in, out, null); } - }, new DaemonService("receive-pack", "receivepack") { + }, new DaemonService("receive-pack", "receivepack") { //$NON-NLS-1$ //$NON-NLS-2$ { setEnabled(false); } @@ -188,8 +188,8 @@ public class Daemon { * the requested service type. */ public synchronized DaemonService getService(String name) { - if (!name.startsWith("git-")) - name = "git-" + name; + if (!name.startsWith("git-")) //$NON-NLS-1$ + name = "git-" + name; //$NON-NLS-1$ for (final DaemonService s : services) { if (s.getCommandName().equals(name)) return s; @@ -286,7 +286,7 @@ public class Daemon { myAddress = (InetSocketAddress) listenSock.getLocalSocketAddress(); run = true; - acceptThread = new Thread(processors, "Git-Daemon-Accept") { + acceptThread = new Thread(processors, "Git-Daemon-Accept") { //$NON-NLS-1$ public void run() { while (isRunning()) { try { @@ -332,7 +332,7 @@ public class Daemon { if (peer instanceof InetSocketAddress) dc.setRemoteAddress(((InetSocketAddress) peer).getAddress()); - new Thread(processors, "Git-Daemon-Client " + peer.toString()) { + new Thread(processors, "Git-Daemon-Client " + peer.toString()) { //$NON-NLS-1$ public void run() { try { dc.execute(s); @@ -375,7 +375,7 @@ public class Daemon { // git://thishost/path should always be name="/path" here // - if (!name.startsWith("/")) + if (!name.startsWith("/")) //$NON-NLS-1$ return null; try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java index a9481c4d22..4e7e12399c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java @@ -63,7 +63,7 @@ public abstract class DaemonService { private boolean overridable; DaemonService(final String cmdName, final String cfgName) { - command = cmdName.startsWith("git-") ? cmdName : "git-" + cmdName; + command = cmdName.startsWith("git-") ? cmdName : "git-" + cmdName; //$NON-NLS-1$ //$NON-NLS-2$ configKey = new SectionParser<ServiceConfig>() { public ServiceConfig parse(final Config cfg) { return new ServiceConfig(DaemonService.this, cfg, cfgName); @@ -77,7 +77,7 @@ public abstract class DaemonService { ServiceConfig(final DaemonService service, final Config cfg, final String name) { - enabled = cfg.getBoolean("daemon", name, service.isEnabled()); + enabled = cfg.getBoolean("daemon", name, service.isEnabled()); //$NON-NLS-1$ } } @@ -137,7 +137,7 @@ public abstract class DaemonService { // An error when opening the repo means the client is expecting a ref // advertisement, so use that style of error. PacketLineOut pktOut = new PacketLineOut(client.getOutputStream()); - pktOut.writeString("ERR " + e.getMessage() + "\n"); + pktOut.writeString("ERR " + e.getMessage() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ db = null; } if (db == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchHeadRecord.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchHeadRecord.java index e2ec71030c..421ef21073 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchHeadRecord.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchHeadRecord.java @@ -67,29 +67,29 @@ class FetchHeadRecord { final String type; final String name; if (sourceName.startsWith(R_HEADS)) { - type = "branch"; + type = "branch"; //$NON-NLS-1$ name = sourceName.substring(R_HEADS.length()); } else if (sourceName.startsWith(R_TAGS)) { - type = "tag"; + type = "tag"; //$NON-NLS-1$ name = sourceName.substring(R_TAGS.length()); } else if (sourceName.startsWith(R_REMOTES)) { - type = "remote branch"; + type = "remote branch"; //$NON-NLS-1$ name = sourceName.substring(R_REMOTES.length()); } else { - type = ""; + type = ""; //$NON-NLS-1$ name = sourceName; } pw.write(newValue.name()); pw.write('\t'); if (notForMerge) - pw.write("not-for-merge"); + pw.write("not-for-merge"); //$NON-NLS-1$ pw.write('\t'); pw.write(type); - pw.write(" '"); + pw.write(" '"); //$NON-NLS-1$ pw.write(name); - pw.write("' of "); + pw.write("' of "); //$NON-NLS-1$ pw.write(sourceURI.toString()); - pw.write("\n"); + pw.write("\n"); //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java index 66d0c62dd9..a50b0b98db 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java @@ -195,7 +195,7 @@ class FetchProcess { BatchRefUpdate batch = transport.local.getRefDatabase() .newBatchUpdate() .setAllowNonFastForwards(true) - .setRefLogMessage("fetch", true); + .setRefLogMessage("fetch", true); //$NON-NLS-1$ final RevWalk walk = new RevWalk(transport.local); try { if (monitor instanceof BatchingProgressMonitor) { @@ -243,7 +243,7 @@ class FetchProcess { private void fetchObjects(final ProgressMonitor monitor) throws TransportException { try { - conn.setPackLockMessage("jgit fetch " + transport.uri); + conn.setPackLockMessage("jgit fetch " + transport.uri); //$NON-NLS-1$ conn.fetch(monitor, askFor.values(), have); } finally { packLocks.addAll(conn.getPackLocks()); @@ -316,7 +316,7 @@ class FetchProcess { File meta = transport.local.getDirectory(); if (meta == null) return; - final LockFile lock = new LockFile(new File(meta, "FETCH_HEAD"), + final LockFile lock = new LockFile(new File(meta, "FETCH_HEAD"), //$NON-NLS-1$ transport.local.getFS()); try { if (lock.lock()) { @@ -510,6 +510,6 @@ class FetchProcess { if (cmd.getResult() != ReceiveCommand.Result.OK) return cmd.getRefName(); } - return ""; + return ""; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java index bcf0a8ba21..4ab7998f5c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java @@ -164,7 +164,7 @@ abstract class HttpAuthMethod { /** Performs HTTP basic authentication (plaintext username/password). */ private static class Basic extends HttpAuthMethod { - static final String NAME = "Basic"; + static final String NAME = "Basic"; //$NON-NLS-1$ private String user; @@ -178,15 +178,15 @@ abstract class HttpAuthMethod { @Override void configureRequest(final HttpURLConnection conn) throws IOException { - String ident = user + ":" + pass; - String enc = Base64.encodeBytes(ident.getBytes("UTF-8")); - conn.setRequestProperty(HDR_AUTHORIZATION, NAME + " " + enc); + String ident = user + ":" + pass; //$NON-NLS-1$ + String enc = Base64.encodeBytes(ident.getBytes("UTF-8")); //$NON-NLS-1$ + conn.setRequestProperty(HDR_AUTHORIZATION, NAME + " " + enc); //$NON-NLS-1$ } } /** Performs HTTP digest authentication. */ private static class Digest extends HttpAuthMethod { - static final String NAME = "Digest"; + static final String NAME = "Digest"; //$NON-NLS-1$ private static final Random PRNG = new Random(); @@ -201,11 +201,11 @@ abstract class HttpAuthMethod { Digest(String hdr) { params = parse(hdr); - final String qop = params.get("qop"); - if ("auth".equals(qop)) { + final String qop = params.get("qop"); //$NON-NLS-1$ + if ("auth".equals(qop)) { //$NON-NLS-1$ final byte[] bin = new byte[8]; PRNG.nextBytes(bin); - params.put("cnonce", Base64.encodeBytes(bin)); + params.put("cnonce", Base64.encodeBytes(bin)); //$NON-NLS-1$ } } @@ -220,67 +220,66 @@ abstract class HttpAuthMethod { void configureRequest(final HttpURLConnection conn) throws IOException { final Map<String, String> r = new LinkedHashMap<String, String>(); - final String realm = params.get("realm"); - final String nonce = params.get("nonce"); - final String cnonce = params.get("cnonce"); + final String realm = params.get("realm"); //$NON-NLS-1$ + final String nonce = params.get("nonce"); //$NON-NLS-1$ + final String cnonce = params.get("cnonce"); //$NON-NLS-1$ final String uri = uri(conn.getURL()); - final String qop = params.get("qop"); + final String qop = params.get("qop"); //$NON-NLS-1$ final String method = conn.getRequestMethod(); - final String A1 = user + ":" + realm + ":" + pass; - final String A2 = method + ":" + uri; + final String A1 = user + ":" + realm + ":" + pass; //$NON-NLS-1$ //$NON-NLS-2$ + final String A2 = method + ":" + uri; //$NON-NLS-1$ - r.put("username", user); - r.put("realm", realm); - r.put("nonce", nonce); - r.put("uri", uri); + r.put("username", user); //$NON-NLS-1$ + r.put("realm", realm); //$NON-NLS-1$ + r.put("nonce", nonce); //$NON-NLS-1$ + r.put("uri", uri); //$NON-NLS-1$ final String response, nc; - if ("auth".equals(qop)) { - nc = String.format("%08x", ++requestCount); - response = KD(H(A1), nonce + ":" + nc + ":" + cnonce + ":" - + qop - + ":" + if ("auth".equals(qop)) { //$NON-NLS-1$ + nc = String.format("%08x", ++requestCount); //$NON-NLS-1$ + response = KD(H(A1), nonce + ":" + nc + ":" + cnonce + ":" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + qop + ":" //$NON-NLS-1$ + H(A2)); } else { nc = null; - response = KD(H(A1), nonce + ":" + H(A2)); + response = KD(H(A1), nonce + ":" + H(A2)); //$NON-NLS-1$ } - r.put("response", response); - if (params.containsKey("algorithm")) - r.put("algorithm", "MD5"); + r.put("response", response); //$NON-NLS-1$ + if (params.containsKey("algorithm")) //$NON-NLS-1$ + r.put("algorithm", "MD5"); //$NON-NLS-1$ //$NON-NLS-2$ if (cnonce != null && qop != null) - r.put("cnonce", cnonce); - if (params.containsKey("opaque")) - r.put("opaque", params.get("opaque")); + r.put("cnonce", cnonce); //$NON-NLS-1$ + if (params.containsKey("opaque")) //$NON-NLS-1$ + r.put("opaque", params.get("opaque")); //$NON-NLS-1$ //$NON-NLS-2$ if (qop != null) - r.put("qop", qop); + r.put("qop", qop); //$NON-NLS-1$ if (nc != null) - r.put("nc", nc); + r.put("nc", nc); //$NON-NLS-1$ StringBuilder v = new StringBuilder(); for (Map.Entry<String, String> e : r.entrySet()) { if (v.length() > 0) - v.append(", "); + v.append(", "); //$NON-NLS-1$ v.append(e.getKey()); v.append('='); v.append('"'); v.append(e.getValue()); v.append('"'); } - conn.setRequestProperty(HDR_AUTHORIZATION, NAME + " " + v); + conn.setRequestProperty(HDR_AUTHORIZATION, NAME + " " + v); //$NON-NLS-1$ } private static String uri(URL u) { StringBuilder r = new StringBuilder(); r.append(u.getProtocol()); - r.append("://"); + r.append("://"); //$NON-NLS-1$ r.append(u.getHost()); if (0 < u.getPort()) { - if (u.getPort() == 80 && "http".equals(u.getProtocol())) { + if (u.getPort() == 80 && "http".equals(u.getProtocol())) { //$NON-NLS-1$ /* nothing */ } else if (u.getPort() == 443 - && "https".equals(u.getProtocol())) { + && "https".equals(u.getProtocol())) { //$NON-NLS-1$ /* nothing */ } else { r.append(':').append(u.getPort()); @@ -295,30 +294,30 @@ abstract class HttpAuthMethod { private static String H(String data) { try { MessageDigest md = newMD5(); - md.update(data.getBytes("UTF-8")); + md.update(data.getBytes("UTF-8")); //$NON-NLS-1$ return LHEX(md.digest()); } catch (UnsupportedEncodingException e) { - throw new RuntimeException("UTF-8 encoding not available", e); + throw new RuntimeException("UTF-8 encoding not available", e); //$NON-NLS-1$ } } private static String KD(String secret, String data) { try { MessageDigest md = newMD5(); - md.update(secret.getBytes("UTF-8")); + md.update(secret.getBytes("UTF-8")); //$NON-NLS-1$ md.update((byte) ':'); - md.update(data.getBytes("UTF-8")); + md.update(data.getBytes("UTF-8")); //$NON-NLS-1$ return LHEX(md.digest()); } catch (UnsupportedEncodingException e) { - throw new RuntimeException("UTF-8 encoding not available", e); + throw new RuntimeException("UTF-8 encoding not available", e); //$NON-NLS-1$ } } private static MessageDigest newMD5() { try { - return MessageDigest.getInstance("MD5"); + return MessageDigest.getInstance("MD5"); //$NON-NLS-1$ } catch (NoSuchAlgorithmException e) { - throw new RuntimeException("No MD5 available", e); + throw new RuntimeException("No MD5 available", e); //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java index 917ad531b5..d70148861e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java @@ -120,7 +120,7 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory { // if authentication failed maybe credentials changed at the // remote end therefore reset credentials and retry if (credentialsProvider != null && e.getCause() == null - && e.getMessage().equals("Auth fail") + && e.getMessage().equals("Auth fail") //$NON-NLS-1$ && retries < 3) { credentialsProvider.reset(uri); session = createSession(credentialsProvider, fs, user, @@ -153,11 +153,11 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory { final String strictHostKeyCheckingPolicy = hc .getStrictHostKeyChecking(); if (strictHostKeyCheckingPolicy != null) - session.setConfig("StrictHostKeyChecking", + session.setConfig("StrictHostKeyChecking", //$NON-NLS-1$ strictHostKeyCheckingPolicy); final String pauth = hc.getPreferredAuthentications(); if (pauth != null) - session.setConfig("PreferredAuthentications", pauth); + session.setConfig("PreferredAuthentications", pauth); //$NON-NLS-1$ if (credentialsProvider != null && (!hc.isBatchMode() || !credentialsProvider.isInteractive())) { session.setUserInfo(new CredentialsProviderUserInfo(session, @@ -255,7 +255,7 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory { final File home = fs.userHome(); if (home == null) return; - final File known_hosts = new File(new File(home, ".ssh"), "known_hosts"); + final File known_hosts = new File(new File(home, ".ssh"), "known_hosts"); //$NON-NLS-1$ //$NON-NLS-2$ try { final FileInputStream in = new FileInputStream(known_hosts); try { @@ -274,11 +274,11 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory { final File home = fs.userHome(); if (home == null) return; - final File sshdir = new File(home, ".ssh"); + final File sshdir = new File(home, ".ssh"); //$NON-NLS-1$ if (sshdir.isDirectory()) { - loadIdentity(sch, new File(sshdir, "identity")); - loadIdentity(sch, new File(sshdir, "id_rsa")); - loadIdentity(sch, new File(sshdir, "id_dsa")); + loadIdentity(sch, new File(sshdir, "identity")); //$NON-NLS-1$ + loadIdentity(sch, new File(sshdir, "id_rsa")); //$NON-NLS-1$ + loadIdentity(sch, new File(sshdir, "id_dsa")); //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java index 9dc0da6146..e5d59b579b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java @@ -106,7 +106,7 @@ public class JschSession implements RemoteSession { * on problems getting the channel. */ public Channel getSftpChannel() throws JSchException { - return sock.openChannel("sftp"); + return sock.openChannel("sftp"); //$NON-NLS-1$ } /** @@ -144,7 +144,7 @@ public class JschSession implements RemoteSession { throws TransportException, IOException { timeout = tms; try { - channel = (ChannelExec) sock.openChannel("exec"); + channel = (ChannelExec) sock.openChannel("exec"); //$NON-NLS-1$ channel.setCommand(commandName); setupStreams(); channel.connect(timeout > 0 ? timeout * 1000 : 0); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java index a97c09bfe9..01716da70a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java @@ -91,9 +91,9 @@ public class OpenSshConfig { public static OpenSshConfig get(FS fs) { File home = fs.userHome(); if (home == null) - home = new File(".").getAbsoluteFile(); + home = new File(".").getAbsoluteFile(); //$NON-NLS-1$ - final File config = new File(new File(home, ".ssh"), Constants.CONFIG); + final File config = new File(new File(home, ".ssh"), Constants.CONFIG); //$NON-NLS-1$ final OpenSshConfig osc = new OpenSshConfig(home, config); osc.refresh(); return osc; @@ -180,16 +180,16 @@ public class OpenSshConfig { while ((line = br.readLine()) != null) { line = line.trim(); - if (line.length() == 0 || line.startsWith("#")) + if (line.length() == 0 || line.startsWith("#")) //$NON-NLS-1$ continue; - final String[] parts = line.split("[ \t]*[= \t]", 2); + final String[] parts = line.split("[ \t]*[= \t]", 2); //$NON-NLS-1$ final String keyword = parts[0].trim(); final String argValue = parts[1].trim(); - if (StringUtils.equalsIgnoreCase("Host", keyword)) { + if (StringUtils.equalsIgnoreCase("Host", keyword)) { //$NON-NLS-1$ current.clear(); - for (final String pattern : argValue.split("[ \t]")) { + for (final String pattern : argValue.split("[ \t]")) { //$NON-NLS-1$ final String name = dequote(pattern); Host c = m.get(name); if (c == null) { @@ -208,15 +208,15 @@ public class OpenSshConfig { continue; } - if (StringUtils.equalsIgnoreCase("HostName", keyword)) { + if (StringUtils.equalsIgnoreCase("HostName", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.hostName == null) c.hostName = dequote(argValue); - } else if (StringUtils.equalsIgnoreCase("User", keyword)) { + } else if (StringUtils.equalsIgnoreCase("User", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.user == null) c.user = dequote(argValue); - } else if (StringUtils.equalsIgnoreCase("Port", keyword)) { + } else if (StringUtils.equalsIgnoreCase("Port", keyword)) { //$NON-NLS-1$ try { final int port = Integer.parseInt(dequote(argValue)); for (final Host c : current) @@ -225,19 +225,21 @@ public class OpenSshConfig { } catch (NumberFormatException nfe) { // Bad port number. Don't set it. } - } else if (StringUtils.equalsIgnoreCase("IdentityFile", keyword)) { + } else if (StringUtils.equalsIgnoreCase("IdentityFile", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.identityFile == null) c.identityFile = toFile(dequote(argValue)); - } else if (StringUtils.equalsIgnoreCase("PreferredAuthentications", keyword)) { + } else if (StringUtils.equalsIgnoreCase( + "PreferredAuthentications", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.preferredAuthentications == null) c.preferredAuthentications = nows(dequote(argValue)); - } else if (StringUtils.equalsIgnoreCase("BatchMode", keyword)) { + } else if (StringUtils.equalsIgnoreCase("BatchMode", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.batchMode == null) c.batchMode = yesno(dequote(argValue)); - } else if (StringUtils.equalsIgnoreCase("StrictHostKeyChecking", keyword)) { + } else if (StringUtils.equalsIgnoreCase( + "StrictHostKeyChecking", keyword)) { //$NON-NLS-1$ String value = dequote(argValue); for (final Host c : current) if (c.strictHostKeyChecking == null) @@ -264,7 +266,7 @@ public class OpenSshConfig { } private static String dequote(final String value) { - if (value.startsWith("\"") && value.endsWith("\"")) + if (value.startsWith("\"") && value.endsWith("\"")) //$NON-NLS-1$ //$NON-NLS-2$ return value.substring(1, value.length() - 1); return value; } @@ -279,13 +281,13 @@ public class OpenSshConfig { } private static Boolean yesno(final String value) { - if (StringUtils.equalsIgnoreCase("yes", value)) + if (StringUtils.equalsIgnoreCase("yes", value)) //$NON-NLS-1$ return Boolean.TRUE; return Boolean.FALSE; } private File toFile(final String path) { - if (path.startsWith("~/")) + if (path.startsWith("~/")) //$NON-NLS-1$ return new File(home, path.substring(2)); File ret = new File(path); if (ret.isAbsolute()) @@ -296,7 +298,7 @@ public class OpenSshConfig { static String userName() { return AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { - return System.getProperty("user.name"); + return System.getProperty("user.name"); //$NON-NLS-1$ } }); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java index 115cfbcc81..b4a48b0165 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java @@ -153,7 +153,7 @@ public abstract class OperationResult { * remote produced no additional messages. */ public String getMessages() { - return messageBuffer != null ? messageBuffer.toString() : ""; + return messageBuffer != null ? messageBuffer.toString() : ""; //$NON-NLS-1$ } void addMessages(final String msg) { @@ -161,7 +161,7 @@ public abstract class OperationResult { if (messageBuffer == null) messageBuffer = new StringBuilder(); messageBuffer.append(msg); - if (!msg.endsWith("\n")) + if (!msg.endsWith("\n")) //$NON-NLS-1$ messageBuffer.append('\n'); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java index 0c035e547d..7b55768e6f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java @@ -846,13 +846,13 @@ public abstract class PackParser { if (bAvail != 0 && !expectDataAfterPackFooter) throw new CorruptObjectException(MessageFormat.format( JGitText.get().expectedEOFReceived, - "\\x" + Integer.toHexString(buf[bOffset] & 0xff))); + "\\x" + Integer.toHexString(buf[bOffset] & 0xff))); //$NON-NLS-1$ if (isCheckEofAfterPackFooter()) { int eof = in.read(); if (0 <= eof) throw new CorruptObjectException(MessageFormat.format( JGitText.get().expectedEOFReceived, - "\\x" + Integer.toHexString(eof))); + "\\x" + Integer.toHexString(eof))); //$NON-NLS-1$ } else if (bAvail > 0 && expectDataAfterPackFooter) { in.reset(); IO.skipFully(in, bOffset); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java index 5030ed142c..e1769f84ed 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java @@ -102,22 +102,22 @@ public class PacketLineIn { final String line = readString(); if (line.length() == 0) throw new PackProtocolException(JGitText.get().expectedACKNAKFoundEOF); - if ("NAK".equals(line)) + if ("NAK".equals(line)) //$NON-NLS-1$ return AckNackResult.NAK; - if (line.startsWith("ACK ")) { + if (line.startsWith("ACK ")) { //$NON-NLS-1$ returnedId.fromString(line.substring(4, 44)); if (line.length() == 44) return AckNackResult.ACK; final String arg = line.substring(44); - if (arg.equals(" continue")) + if (arg.equals(" continue")) //$NON-NLS-1$ return AckNackResult.ACK_CONTINUE; - else if (arg.equals(" common")) + else if (arg.equals(" common")) //$NON-NLS-1$ return AckNackResult.ACK_COMMON; - else if (arg.equals(" ready")) + else if (arg.equals(" ready")) //$NON-NLS-1$ return AckNackResult.ACK_READY; } - if (line.startsWith("ERR ")) + if (line.startsWith("ERR ")) //$NON-NLS-1$ throw new PackProtocolException(line.substring(4)); throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedACKNAKGot, line)); } @@ -141,7 +141,7 @@ public class PacketLineIn { len -= 4; // length header (4 bytes) if (len == 0) - return ""; + return ""; //$NON-NLS-1$ byte[] raw; if (len <= lineBuffer.length) @@ -191,7 +191,7 @@ public class PacketLineIn { return len; } catch (ArrayIndexOutOfBoundsException err) { throw new IOException(MessageFormat.format(JGitText.get().invalidPacketLineHeader, - "" + (char) lineBuffer[0] + (char) lineBuffer[1] + "" + (char) lineBuffer[0] + (char) lineBuffer[1] //$NON-NLS-1$ + (char) lineBuffer[2] + (char) lineBuffer[3])); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java index 4c7ffeccee..37da6c6462 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java @@ -332,7 +332,7 @@ public class ReceiveCommand { ru.setForceUpdate(rp.isAllowNonFastForwards()); ru.setExpectedOldObjectId(getOldId()); ru.setNewObjectId(getNewId()); - ru.setRefLogMessage("push", true); + ru.setRefLogMessage("push", true); //$NON-NLS-1$ setResult(ru.update(rp.getRevWalk())); break; } @@ -397,6 +397,7 @@ public class ReceiveCommand { JGitText.get().lockError, err.getMessage())); } + @SuppressWarnings("nls") @Override public String toString() { return getType().name() + ": " + getOldId().name() + " " diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index fb30d99fc5..d17abf78c4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -209,7 +209,7 @@ public class ReceivePack extends BaseReceivePack { if (echoCommandFailures && msgOut != null) { sendStatusReport(false, unpackError, new Reporter() { void sendString(final String s) throws IOException { - msgOut.write(Constants.encode(s + "\n")); + msgOut.write(Constants.encode(s + "\n")); //$NON-NLS-1$ } }); msgOut.flush(); @@ -221,14 +221,14 @@ public class ReceivePack extends BaseReceivePack { } sendStatusReport(true, unpackError, new Reporter() { void sendString(final String s) throws IOException { - pckOut.writeString(s + "\n"); + pckOut.writeString(s + "\n"); //$NON-NLS-1$ } }); pckOut.end(); } else if (msgOut != null) { sendStatusReport(false, unpackError, new Reporter() { void sendString(final String s) throws IOException { - msgOut.write(Constants.encode(s + "\n")); + msgOut.write(Constants.encode(s + "\n")); //$NON-NLS-1$ } }); } @@ -242,6 +242,6 @@ public class ReceivePack extends BaseReceivePack { @Override protected String getLockMessageProcessName() { - return "jgit receive-pack"; + return "jgit receive-pack"; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java index b04311659f..581a44b1dc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java @@ -174,7 +174,7 @@ public abstract class RefAdvertiser { } if (ref.getPeeledObjectId() != null) - advertiseAny(ref.getPeeledObjectId(), ref.getName() + "^{}"); + advertiseAny(ref.getPeeledObjectId(), ref.getName() + "^{}"); //$NON-NLS-1$ } return sent; } @@ -201,7 +201,7 @@ public abstract class RefAdvertiser { * advertisement record. */ public void advertiseHave(AnyObjectId id) throws IOException { - advertiseAnyOnce(id, ".have"); + advertiseAnyOnce(id, ".have"); //$NON-NLS-1$ } /** @return true if no advertisements have been sent yet. */ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java index 98574b0fa1..53a7b02be3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java @@ -63,7 +63,7 @@ public class RefSpec implements Serializable { * Suffix for wildcard ref spec component, that indicate matching all refs * with specified prefix. */ - public static final String WILDCARD_SUFFIX = "/*"; + public static final String WILDCARD_SUFFIX = "/*"; //$NON-NLS-1$ /** * Check whether provided string is a wildcard ref spec component. @@ -122,7 +122,7 @@ public class RefSpec implements Serializable { */ public RefSpec(final String spec) { String s = spec; - if (s.startsWith("+")) { + if (s.startsWith("+")) { //$NON-NLS-1$ force = true; s = s.substring(1); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java index f75ac703a3..ba0931b9ba 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java @@ -67,37 +67,37 @@ import org.eclipse.jgit.lib.Config; public class RemoteConfig implements Serializable { private static final long serialVersionUID = 1L; - private static final String SECTION = "remote"; + private static final String SECTION = "remote"; //$NON-NLS-1$ - private static final String KEY_URL = "url"; + private static final String KEY_URL = "url"; //$NON-NLS-1$ - private static final String KEY_PUSHURL = "pushurl"; + private static final String KEY_PUSHURL = "pushurl"; //$NON-NLS-1$ - private static final String KEY_FETCH = "fetch"; + private static final String KEY_FETCH = "fetch"; //$NON-NLS-1$ - private static final String KEY_PUSH = "push"; + private static final String KEY_PUSH = "push"; //$NON-NLS-1$ - private static final String KEY_UPLOADPACK = "uploadpack"; + private static final String KEY_UPLOADPACK = "uploadpack"; //$NON-NLS-1$ - private static final String KEY_RECEIVEPACK = "receivepack"; + private static final String KEY_RECEIVEPACK = "receivepack"; //$NON-NLS-1$ - private static final String KEY_TAGOPT = "tagopt"; + private static final String KEY_TAGOPT = "tagopt"; //$NON-NLS-1$ - private static final String KEY_MIRROR = "mirror"; + private static final String KEY_MIRROR = "mirror"; //$NON-NLS-1$ - private static final String KEY_TIMEOUT = "timeout"; + private static final String KEY_TIMEOUT = "timeout"; //$NON-NLS-1$ - private static final String KEY_INSTEADOF = "insteadof"; + private static final String KEY_INSTEADOF = "insteadof"; //$NON-NLS-1$ - private static final String KEY_PUSHINSTEADOF = "pushinsteadof"; + private static final String KEY_PUSHINSTEADOF = "pushinsteadof"; //$NON-NLS-1$ private static final boolean DEFAULT_MIRROR = false; /** Default value for {@link #getUploadPack()} if not specified. */ - public static final String DEFAULT_UPLOAD_PACK = "git-upload-pack"; + public static final String DEFAULT_UPLOAD_PACK = "git-upload-pack"; //$NON-NLS-1$ /** Default value for {@link #getReceivePack()} if not specified. */ - public static final String DEFAULT_RECEIVE_PACK = "git-receive-pack"; + public static final String DEFAULT_RECEIVE_PACK = "git-receive-pack"; //$NON-NLS-1$ /** * Parse all remote blocks in an existing configuration file, looking for diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java index 421830202e..1b82a36105 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java @@ -305,7 +305,7 @@ public class RemoteRefUpdate { if (localName != null && localDb != null) { localUpdate = localDb.updateRef(localName); localUpdate.setForceUpdate(true); - localUpdate.setRefLogMessage("push", true); + localUpdate.setRefLogMessage("push", true); //$NON-NLS-1$ localUpdate.setNewObjectId(newObjectId); trackingRefUpdate = new TrackingRefUpdate( true, @@ -467,13 +467,20 @@ public class RemoteRefUpdate { trackingRefUpdate.setResult(localUpdate.update(walk)); } + @SuppressWarnings("nls") @Override public String toString() { - return "RemoteRefUpdate[remoteName=" + remoteName + ", " + status - + ", " + (expectedOldObjectId!=null ? expectedOldObjectId.name() : "(null)") - + "..." + (newObjectId != null ? newObjectId.name() : "(null)") + return "RemoteRefUpdate[remoteName=" + + remoteName + + ", " + + status + + ", " + + (expectedOldObjectId != null ? expectedOldObjectId.name() + : "(null)") + "..." + + (newObjectId != null ? newObjectId.name() : "(null)") + (fastForward ? ", fastForward" : "") - + ", srcRef=" + srcRef + (forceUpdate ? ", forceUpdate" : "") + ", message=" + (message != null ? "\"" - + message + "\"" : "null") + "]"; + + ", srcRef=" + srcRef + + (forceUpdate ? ", forceUpdate" : "") + ", message=" + + (message != null ? "\"" + message + "\"" : "null") + "]"; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java index bc9f649959..b48a8a5f09 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java @@ -86,10 +86,10 @@ class SideBandInputStream extends InputStream { static final int CH_ERROR = 3; private static Pattern P_UNBOUNDED = Pattern - .compile("^([\\w ]+): +(\\d+)(?:, done\\.)? *[\r\n]$"); + .compile("^([\\w ]+): +(\\d+)(?:, done\\.)? *[\r\n]$"); //$NON-NLS-1$ private static Pattern P_BOUNDED = Pattern - .compile("^([\\w ]+): +\\d+% +\\( *(\\d+)/ *(\\d+)\\)(?:, done\\.)? *[\r\n]$"); + .compile("^([\\w ]+): +\\d+% +\\( *(\\d+)/ *(\\d+)\\)(?:, done\\.)? *[\r\n]$"); //$NON-NLS-1$ private final InputStream rawIn; @@ -99,7 +99,7 @@ class SideBandInputStream extends InputStream { private final Writer messages; - private String progressBuffer = ""; + private String progressBuffer = ""; //$NON-NLS-1$ private String currentTask; @@ -117,7 +117,7 @@ class SideBandInputStream extends InputStream { pckIn = new PacketLineIn(rawIn); monitor = progress; messages = messageStream; - currentTask = ""; + currentTask = ""; //$NON-NLS-1$ } @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java index c7b22bdabf..aa800657e1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java @@ -64,7 +64,7 @@ class SideBandProgressMonitor extends BatchingProgressMonitor { protected void onUpdate(String taskName, int workCurr) { StringBuilder s = new StringBuilder(); format(s, taskName, workCurr); - s.append(" \r"); + s.append(" \r"); //$NON-NLS-1$ send(s); } @@ -72,13 +72,13 @@ class SideBandProgressMonitor extends BatchingProgressMonitor { protected void onEndTask(String taskName, int workCurr) { StringBuilder s = new StringBuilder(); format(s, taskName, workCurr); - s.append(", done\n"); + s.append(", done\n"); //$NON-NLS-1$ send(s); } private void format(StringBuilder s, String taskName, int workCurr) { s.append(taskName); - s.append(": "); + s.append(": "); //$NON-NLS-1$ s.append(workCurr); } @@ -86,7 +86,7 @@ class SideBandProgressMonitor extends BatchingProgressMonitor { protected void onUpdate(String taskName, int cmp, int totalWork, int pcnt) { StringBuilder s = new StringBuilder(); format(s, taskName, cmp, totalWork, pcnt); - s.append(" \r"); + s.append(" \r"); //$NON-NLS-1$ send(s); } @@ -94,24 +94,24 @@ class SideBandProgressMonitor 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(taskName); - s.append(": "); + s.append(": "); //$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(cmp); - s.append("/"); + s.append("/"); //$NON-NLS-1$ s.append(totalWork); - s.append(")"); + s.append(")"); //$NON-NLS-1$ } private void send(StringBuilder s) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java index 3b25870d93..384e9fc4b2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java @@ -59,7 +59,7 @@ public enum TagOpt { * prove that we already have (or will have when the fetch completes) the * object the annotated tag peels (dereferences) to. */ - AUTO_FOLLOW(""), + AUTO_FOLLOW(""), //$NON-NLS-1$ /** * Never fetch tags, even if we have the thing it points at. @@ -69,7 +69,7 @@ public enum TagOpt { * publishes annotated tags, but you are not interested in the tags and only * want their branches. */ - NO_TAGS("--no-tags"), + NO_TAGS("--no-tags"), //$NON-NLS-1$ /** * Always fetch tags, even if we do not have the thing it points at. @@ -78,7 +78,7 @@ public enum TagOpt { * hundreds of megabytes of objects to be fetched if the receiving * repository does not yet have the necessary dependencies. */ - FETCH_TAGS("--tags"); + FETCH_TAGS("--tags"); //$NON-NLS-1$ private final String option; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java index d6dcb3208f..54b3066d88 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java @@ -194,6 +194,7 @@ public class TrackingRefUpdate { } } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java index 492365ad3f..c3e39868dd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java @@ -60,7 +60,7 @@ public class TransferConfig { private final boolean fsckObjects; private TransferConfig(final Config rc) { - fsckObjects = rc.getBoolean("receive", "fsckobjects", false); + fsckObjects = rc.getBoolean("receive", "fsckobjects", false); //$NON-NLS-1$ //$NON-NLS-2$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java index affccf947a..5a7c0a194e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java @@ -127,7 +127,7 @@ public abstract class Transport { private static Enumeration<URL> catalogs(ClassLoader ldr) { try { - String prefix = "META-INF/services/"; + String prefix = "META-INF/services/"; //$NON-NLS-1$ String name = prefix + Transport.class.getName(); return ldr.getResources(name); } catch (IOException err) { @@ -139,7 +139,7 @@ public abstract class Transport { BufferedReader br; try { InputStream urlIn = url.openStream(); - br = new BufferedReader(new InputStreamReader(urlIn, "UTF-8")); + br = new BufferedReader(new InputStreamReader(urlIn, "UTF-8")); //$NON-NLS-1$ } catch (IOException err) { // If we cannot read from the service list, go to the next. // @@ -687,14 +687,14 @@ public abstract class Transport { * Acts as --tags. */ public static final RefSpec REFSPEC_TAGS = new RefSpec( - "refs/tags/*:refs/tags/*"); + "refs/tags/*:refs/tags/*"); //$NON-NLS-1$ /** * Specification for push operation, to push all refs under refs/heads. Acts * as --all. */ public static final RefSpec REFSPEC_PUSH_ALL = new RefSpec( - "refs/heads/*:refs/heads/*"); + "refs/heads/*:refs/heads/*"); //$NON-NLS-1$ /** The repository this transport fetches into, or pushes out of. */ protected final Repository local; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java index 01b845b151..0a50fe2d29 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java @@ -98,11 +98,11 @@ import org.eclipse.jgit.lib.SymbolicRef; * @see WalkPushConnection */ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { - static final String S3_SCHEME = "amazon-s3"; + static final String S3_SCHEME = "amazon-s3"; //$NON-NLS-1$ static final TransportProtocol PROTO_S3 = new TransportProtocol() { public String getName() { - return "Amazon S3"; + return "Amazon S3"; //$NON-NLS-1$ } public Set<String> getSchemes() { @@ -151,9 +151,9 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { bucket = uri.getHost(); String p = uri.getPath(); - if (p.startsWith("/")) + if (p.startsWith("/")) //$NON-NLS-1$ p = p.substring(1); - if (p.endsWith("/")) + if (p.endsWith("/")) //$NON-NLS-1$ p = p.substring(0, p.length() - 1); keyPrefix = p; } @@ -170,8 +170,8 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { return loadPropertiesFile(propsFile); Properties props = new Properties(); - props.setProperty("accesskey", uri.getUser()); - props.setProperty("secretkey", uri.getPass()); + props.setProperty("accesskey", uri.getUser()); //$NON-NLS-1$ + props.setProperty("secretkey", uri.getPass()); //$NON-NLS-1$ return props; } @@ -187,7 +187,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { @Override public FetchConnection openFetch() throws TransportException { - final DatabaseS3 c = new DatabaseS3(bucket, keyPrefix + "/objects"); + final DatabaseS3 c = new DatabaseS3(bucket, keyPrefix + "/objects"); //$NON-NLS-1$ final WalkFetchConnection r = new WalkFetchConnection(this, c); r.available(c.readAdvertisedRefs()); return r; @@ -195,7 +195,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { @Override public PushConnection openPush() throws TransportException { - final DatabaseS3 c = new DatabaseS3(bucket, keyPrefix + "/objects"); + final DatabaseS3 c = new DatabaseS3(bucket, keyPrefix + "/objects"); //$NON-NLS-1$ final WalkPushConnection r = new WalkPushConnection(this, c); r.available(c.readAdvertisedRefs()); return r; @@ -217,14 +217,14 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { } private String resolveKey(String subpath) { - if (subpath.endsWith("/")) + if (subpath.endsWith("/")) //$NON-NLS-1$ subpath = subpath.substring(0, subpath.length() - 1); String k = objectsKey; while (subpath.startsWith(ROOT_DIR)) { k = k.substring(0, k.lastIndexOf('/')); subpath = subpath.substring(3); } - return k + "/" + subpath; + return k + "/" + subpath; //$NON-NLS-1$ } @Override @@ -232,7 +232,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { URIish u = new URIish(); u = u.setScheme(S3_SCHEME); u = u.setHost(bucketName); - u = u.setPath("/" + objectsKey); + u = u.setPath("/" + objectsKey); //$NON-NLS-1$ return u; } @@ -255,14 +255,14 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { @Override Collection<String> getPackNames() throws IOException { final HashSet<String> have = new HashSet<String>(); - have.addAll(s3.list(bucket, resolveKey("pack"))); + have.addAll(s3.list(bucket, resolveKey("pack"))); //$NON-NLS-1$ final Collection<String> packs = new ArrayList<String>(); for (final String n : have) { - if (!n.startsWith("pack-") || !n.endsWith(".pack")) + if (!n.startsWith("pack-") || !n.endsWith(".pack")) //$NON-NLS-1$ //$NON-NLS-2$ continue; - final String in = n.substring(0, n.length() - 5) + ".idx"; + final String in = n.substring(0, n.length() - 5) + ".idx"; //$NON-NLS-1$ if (have.contains(in)) packs.add(n); } @@ -307,8 +307,8 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { throws TransportException { try { for (final String n : s3.list(bucket, resolveKey(ROOT_DIR - + "refs"))) - readRef(avail, "refs/" + n); + + "refs"))) //$NON-NLS-1$ + readRef(avail, "refs/" + n); //$NON-NLS-1$ } catch (IOException e) { throw new TransportException(getURI(), JGitText.get().cannotListRefs, e); } @@ -335,8 +335,8 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { if (s == null) throw new TransportException(getURI(), MessageFormat.format(JGitText.get().transportExceptionEmptyRef, rn)); - if (s.startsWith("ref: ")) { - final String target = s.substring("ref: ".length()); + if (s.startsWith("ref: ")) { //$NON-NLS-1$ + final String target = s.substring("ref: ".length()); //$NON-NLS-1$ Ref r = avail.get(target); if (r == null) r = readRef(avail, target); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundle.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundle.java index 05be0bbdf7..6a285e59f5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundle.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundle.java @@ -58,5 +58,5 @@ public interface TransportBundle extends PackTransport { /** * Bundle signature */ - public static final String V2_BUNDLE_SIGNATURE = "# v2 git bundle"; + public static final String V2_BUNDLE_SIGNATURE = "# v2 git bundle"; //$NON-NLS-1$ } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java index 05313dc7c8..32de7dedd7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java @@ -92,8 +92,8 @@ class TransportBundleFile extends Transport implements TransportBundle { @Override public Transport open(URIish uri, Repository local, String remoteName) throws NotSupportedException, TransportException { - if ("bundle".equals(uri.getScheme())) { - File path = local.getFS().resolve(new File("."), uri.getPath()); + if ("bundle".equals(uri.getScheme())) { //$NON-NLS-1$ + File path = local.getFS().resolve(new File("."), uri.getPath()); //$NON-NLS-1$ return new TransportBundleFile(local, uri, path); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java index 2bc895c56b..4fca19ce80 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java @@ -151,10 +151,10 @@ class TransportGitAnon extends TcpTransport implements PackTransport { cmd.append(' '); cmd.append(uri.getPath()); cmd.append('\0'); - cmd.append("host="); + cmd.append("host="); //$NON-NLS-1$ cmd.append(uri.getHost()); if (uri.getPort() > 0 && uri.getPort() != GIT_PORT) { - cmd.append(":"); + cmd.append(":"); //$NON-NLS-1$ cmd.append(uri.getPort()); } cmd.append('\0'); @@ -176,7 +176,7 @@ class TransportGitAnon extends TcpTransport implements PackTransport { sOut = new SafeBufferedOutputStream(sOut); init(sIn, sOut); - service("git-upload-pack", pckOut); + service("git-upload-pack", pckOut); //$NON-NLS-1$ } catch (IOException err) { close(); throw new TransportException(uri, @@ -215,7 +215,7 @@ class TransportGitAnon extends TcpTransport implements PackTransport { sOut = new SafeBufferedOutputStream(sOut); init(sIn, sOut); - service("git-receive-pack", pckOut); + service("git-receive-pack", pckOut); //$NON-NLS-1$ } catch (IOException err) { close(); throw new TransportException(uri, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java index 16e778da0d..dde4d20585 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java @@ -154,7 +154,7 @@ public class TransportGitSsh extends SshTransport implements PackTransport { String commandFor(final String exe) { String path = uri.getPath(); - if (uri.getScheme() != null && uri.getPath().startsWith("/~")) + if (uri.getScheme() != null && uri.getPath().startsWith("/~")) //$NON-NLS-1$ path = (uri.getPath().substring(1)); final StringBuilder cmd = new StringBuilder(); @@ -181,13 +181,13 @@ public class TransportGitSsh extends SshTransport implements PackTransport { return nf; String path = uri.getPath(); - if (uri.getScheme() != null && uri.getPath().startsWith("/~")) + if (uri.getScheme() != null && uri.getPath().startsWith("/~")) //$NON-NLS-1$ path = uri.getPath().substring(1); final StringBuilder pfx = new StringBuilder(); - pfx.append("fatal: "); + pfx.append("fatal: "); //$NON-NLS-1$ pfx.append(QuotedString.BOURNE.quote(path)); - pfx.append(": "); + pfx.append(": "); //$NON-NLS-1$ if (why.startsWith(pfx.toString())) why = why.substring(pfx.length()); @@ -195,25 +195,25 @@ public class TransportGitSsh extends SshTransport implements PackTransport { } private static boolean useExtSession() { - return SystemReader.getInstance().getenv("GIT_SSH") != null; + return SystemReader.getInstance().getenv("GIT_SSH") != null; //$NON-NLS-1$ } private class ExtSession implements RemoteSession { public Process exec(String command, int timeout) throws TransportException { - String ssh = SystemReader.getInstance().getenv("GIT_SSH"); - boolean putty = ssh.toLowerCase().contains("plink"); + String ssh = SystemReader.getInstance().getenv("GIT_SSH"); //$NON-NLS-1$ + boolean putty = ssh.toLowerCase().contains("plink"); //$NON-NLS-1$ List<String> args = new ArrayList<String>(); args.add(ssh); - if (putty && !ssh.toLowerCase().contains("tortoiseplink")) - args.add("-batch"); + if (putty && !ssh.toLowerCase().contains("tortoiseplink")) //$NON-NLS-1$ + args.add("-batch"); //$NON-NLS-1$ if (0 < getURI().getPort()) { - args.add(putty ? "-P" : "-p"); + args.add(putty ? "-P" : "-p"); //$NON-NLS-1$ //$NON-NLS-2$ args.add(String.valueOf(getURI().getPort())); } if (getURI().getUser() != null) - args.add(getURI().getUser() + "@" + getURI().getHost()); + args.add(getURI().getUser() + "@" + getURI().getHost()); //$NON-NLS-1$ else args.add(getURI().getHost()); args.add(command); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java index 5796ab3c73..3f1cebaaf8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java @@ -226,7 +226,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, HttpConfig(final Config rc) { postBuffer = rc.getInt("http", "postbuffer", 1 * 1024 * 1024); //$NON-NLS-1$ //$NON-NLS-2$ - sslVerify = rc.getBoolean("http", "sslVerify", true); + sslVerify = rc.getBoolean("http", "sslVerify", true); //$NON-NLS-1$ //$NON-NLS-2$ } private HttpConfig() { @@ -505,7 +505,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpURLConnection conn = (HttpURLConnection) u.openConnection(proxy); - if (!http.sslVerify && "https".equals(u.getProtocol())) { + if (!http.sslVerify && "https".equals(u.getProtocol())) { //$NON-NLS-1$ disableSslVerify(conn); } @@ -528,7 +528,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, throws IOException { final TrustManager[] trustAllCerts = new TrustManager[] { new DummyX509TrustManager() }; try { - SSLContext ctx = SSLContext.getInstance("SSL"); + SSLContext ctx = SSLContext.getInstance("SSL"); //$NON-NLS-1$ ctx.init(null, trustAllCerts, null); final HttpsURLConnection sslConn = (HttpsURLConnection) conn; sslConn.setSSLSocketFactory(ctx.getSocketFactory()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java index 5a23ae18d8..c783898c00 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java @@ -150,7 +150,7 @@ class TransportLocal extends Transport implements PackTransport { @Override public FetchConnection openFetch() throws TransportException { final String up = getOptionUploadPack(); - if ("git-upload-pack".equals(up) || "git upload-pack".equals(up)) + if ("git-upload-pack".equals(up) || "git upload-pack".equals(up)) //$NON-NLS-1$ //$NON-NLS-2$ return new InternalLocalFetchConnection(); return new ForkLocalFetchConnection(); } @@ -159,7 +159,7 @@ class TransportLocal extends Transport implements PackTransport { public PushConnection openPush() throws NotSupportedException, TransportException { final String rp = getOptionReceivePack(); - if ("git-receive-pack".equals(rp) || "git receive-pack".equals(rp)) + if ("git-receive-pack".equals(rp) || "git receive-pack".equals(rp)) //$NON-NLS-1$ //$NON-NLS-2$ return new InternalLocalPushConnection(); return new ForkLocalPushConnection(); } @@ -172,20 +172,20 @@ class TransportLocal extends Transport implements PackTransport { protected Process spawn(final String cmd) throws TransportException { try { - String[] args = { "." }; + String[] args = { "." }; //$NON-NLS-1$ ProcessBuilder proc = local.getFS().runInShell(cmd, args); proc.directory(remoteGitDir); // Remove the same variables CGit does. Map<String, String> env = proc.environment(); - env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); - env.remove("GIT_CONFIG"); - env.remove("GIT_CONFIG_PARAMETERS"); - env.remove("GIT_DIR"); - env.remove("GIT_WORK_TREE"); - env.remove("GIT_GRAFT_FILE"); - env.remove("GIT_INDEX_FILE"); - env.remove("GIT_NO_REPLACE_OBJECTS"); + env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); //$NON-NLS-1$ + env.remove("GIT_CONFIG"); //$NON-NLS-1$ + env.remove("GIT_CONFIG_PARAMETERS"); //$NON-NLS-1$ + env.remove("GIT_DIR"); //$NON-NLS-1$ + env.remove("GIT_WORK_TREE"); //$NON-NLS-1$ + env.remove("GIT_GRAFT_FILE"); //$NON-NLS-1$ + env.remove("GIT_INDEX_FILE"); //$NON-NLS-1$ + env.remove("GIT_NO_REPLACE_OBJECTS"); //$NON-NLS-1$ return proc.start(); } catch (IOException err) { @@ -230,7 +230,7 @@ class TransportLocal extends Transport implements PackTransport { throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } - worker = new Thread("JGit-Upload-Pack") { + worker = new Thread("JGit-Upload-Pack") { //$NON-NLS-1$ public void run() { try { final UploadPack rp = createUploadPack(dst); @@ -362,7 +362,7 @@ class TransportLocal extends Transport implements PackTransport { throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } - worker = new Thread("JGit-Receive-Pack") { + worker = new Thread("JGit-Receive-Pack") { //$NON-NLS-1$ public void run() { try { final ReceivePack rp = createReceivePack(dst); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java index dbb6c7ce0b..e99ba1c4ad 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java @@ -166,14 +166,14 @@ public class TransportSftp extends SshTransport implements WalkTransport { private ChannelSftp ftp; SftpObjectDB(String path) throws TransportException { - if (path.startsWith("/~")) + if (path.startsWith("/~")) //$NON-NLS-1$ path = path.substring(1); - if (path.startsWith("~/")) + if (path.startsWith("~/")) //$NON-NLS-1$ path = path.substring(2); try { ftp = newSftp(); ftp.cd(path); - ftp.cd("objects"); + ftp.cd("objects"); //$NON-NLS-1$ objectsPath = ftp.pwd(); } catch (TransportException err) { close(); @@ -224,7 +224,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { Collection<String> getPackNames() throws IOException { final List<String> packs = new ArrayList<String>(); try { - final Collection<ChannelSftp.LsEntry> list = ftp.ls("pack"); + final Collection<ChannelSftp.LsEntry> list = ftp.ls("pack"); //$NON-NLS-1$ final HashMap<String, ChannelSftp.LsEntry> files; final HashMap<String, Integer> mtimes; @@ -235,10 +235,10 @@ public class TransportSftp extends SshTransport implements WalkTransport { files.put(ent.getFilename(), ent); for (final ChannelSftp.LsEntry ent : list) { final String n = ent.getFilename(); - if (!n.startsWith("pack-") || !n.endsWith(".pack")) + if (!n.startsWith("pack-") || !n.endsWith(".pack")) //$NON-NLS-1$ continue; - final String in = n.substring(0, n.length() - 5) + ".idx"; + final String in = n.substring(0, n.length() - 5) + ".idx"; //$NON-NLS-1$ if (!files.containsKey(in)) continue; @@ -325,7 +325,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { @Override void writeFile(final String path, final byte[] data) throws IOException { - final String lock = path + ".lock"; + final String lock = path + ".lock"; //$NON-NLS-1$ try { super.writeFile(lock, data); try { @@ -373,7 +373,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { final TreeMap<String, Ref> avail = new TreeMap<String, Ref>(); readPackedRefs(avail); readRef(avail, ROOT_DIR + Constants.HEAD, Constants.HEAD); - readLooseRefs(avail, ROOT_DIR + "refs", "refs/"); + readLooseRefs(avail, ROOT_DIR + "refs", "refs/"); //$NON-NLS-1$ //$NON-NLS-2$ return avail; } @@ -390,12 +390,12 @@ public class TransportSftp extends SshTransport implements WalkTransport { for (final ChannelSftp.LsEntry ent : list) { final String n = ent.getFilename(); - if (".".equals(n) || "..".equals(n)) + if (".".equals(n) || "..".equals(n)) //$NON-NLS-1$ //$NON-NLS-2$ continue; - final String nPath = dir + "/" + n; + final String nPath = dir + "/" + n; //$NON-NLS-1$ if (ent.getAttrs().isDir()) - readLooseRefs(avail, nPath, prefix + n + "/"); + readLooseRefs(avail, nPath, prefix + n + "/"); //$NON-NLS-1$ else readRef(avail, nPath, prefix + n); } @@ -421,8 +421,8 @@ public class TransportSftp extends SshTransport implements WalkTransport { if (line == null) throw new TransportException("Empty ref: " + name); - if (line.startsWith("ref: ")) { - final String target = line.substring("ref: ".length()); + if (line.startsWith("ref: ")) { //$NON-NLS-1$ + final String target = line.substring("ref: ".length()); //$NON-NLS-1$ Ref r = avail.get(target); if (r == null) r = readRef(avail, ROOT_DIR + target, target); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java index f2d3c8c235..cdd7fcde83 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java @@ -73,7 +73,7 @@ public class URIish implements Serializable { * URI. Defines one capturing group containing the scheme without the * trailing colon and slashes */ - private static final String SCHEME_P = "([a-z][a-z0-9+-]+)://"; + private static final String SCHEME_P = "([a-z][a-z0-9+-]+)://"; //$NON-NLS-1$ /** * Part of a pattern which matches the optional user/password part (e.g. @@ -81,44 +81,44 @@ public class URIish implements Serializable { * capturing groups: the first containing the user and the second containing * the password */ - private static final String OPT_USER_PWD_P = "(?:([^/:@]+)(?::([^\\\\/]+))?@)?"; + private static final String OPT_USER_PWD_P = "(?:([^/:@]+)(?::([^\\\\/]+))?@)?"; //$NON-NLS-1$ /** * Part of a pattern which matches the host part of URIs. Defines one * capturing group containing the host name. */ - private static final String HOST_P = "([^\\\\/:]+)"; + private static final String HOST_P = "([^\\\\/:]+)"; //$NON-NLS-1$ /** * Part of a pattern which matches the optional port part of URIs. Defines * one capturing group containing the port without the preceding colon. */ - private static final String OPT_PORT_P = "(?::(\\d+))?"; + private static final String OPT_PORT_P = "(?::(\\d+))?"; //$NON-NLS-1$ /** * Part of a pattern which matches the ~username part (e.g. /~root in * git://host.xyz/~root/a.git) of URIs. Defines no capturing group. */ - private static final String USER_HOME_P = "(?:/~(?:[^\\\\/]+))"; + private static final String USER_HOME_P = "(?:/~(?:[^\\\\/]+))"; //$NON-NLS-1$ /** * Part of a pattern which matches the optional drive letter in paths (e.g. * D: in file:///D:/a.txt). Defines no capturing group. */ - private static final String OPT_DRIVE_LETTER_P = "(?:[A-Za-z]:)?"; + private static final String OPT_DRIVE_LETTER_P = "(?:[A-Za-z]:)?"; //$NON-NLS-1$ /** * Part of a pattern which matches a relative path. Relative paths don't * start with slash or drive letters. Defines no capturing group. */ - private static final String RELATIVE_PATH_P = "(?:(?:[^\\\\/]+[\\\\/])*[^\\\\/]+[\\\\/]?)"; + private static final String RELATIVE_PATH_P = "(?:(?:[^\\\\/]+[\\\\/])*[^\\\\/]+[\\\\/]?)"; //$NON-NLS-1$ /** * Part of a pattern which matches a relative or absolute path. Defines no * capturing group. */ - private static final String PATH_P = "(" + OPT_DRIVE_LETTER_P + "[\\\\/]?" - + RELATIVE_PATH_P + ")"; + private static final String PATH_P = "(" + OPT_DRIVE_LETTER_P + "[\\\\/]?" //$NON-NLS-1$ //$NON-NLS-2$ + + RELATIVE_PATH_P + ")"; //$NON-NLS-1$ private static final long serialVersionUID = 1L; @@ -126,58 +126,58 @@ public class URIish implements Serializable { * A pattern matching standard URI: </br> * <code>scheme "://" user_password? hostname? portnumber? path</code> */ - private static final Pattern FULL_URI = Pattern.compile("^" // + private static final Pattern FULL_URI = Pattern.compile("^" // //$NON-NLS-1$ + SCHEME_P // - + "(?:" // start a group containing hostname and all options only + + "(?:" // start a group containing hostname and all options only //$NON-NLS-1$ // availabe when a hostname is there + OPT_USER_PWD_P // + HOST_P // + OPT_PORT_P // - + "(" // open a catpuring group the the user-home-dir part - + (USER_HOME_P + "?") // - + "[\\\\/])" // - + ")?" // close the optional group containing hostname - + "(.+)?" // - + "$"); + + "(" // open a catpuring group the the user-home-dir part //$NON-NLS-1$ + + (USER_HOME_P + "?") // //$NON-NLS-1$ + + "[\\\\/])" // //$NON-NLS-1$ + + ")?" // close the optional group containing hostname //$NON-NLS-1$ + + "(.+)?" // //$NON-NLS-1$ + + "$"); //$NON-NLS-1$ /** * A pattern matching the reference to a local file. This may be an absolute * path (maybe even containing windows drive-letters) or a relative path. */ - private static final Pattern LOCAL_FILE = Pattern.compile("^" // - + "([\\\\/]?" + PATH_P + ")" // - + "$"); + private static final Pattern LOCAL_FILE = Pattern.compile("^" // //$NON-NLS-1$ + + "([\\\\/]?" + PATH_P + ")" // //$NON-NLS-1$ //$NON-NLS-2$ + + "$"); //$NON-NLS-1$ /** * A pattern matching a URI for the scheme 'file' which has only ':/' as * separator between scheme and path. Standard file URIs have '://' as * separator, but java.io.File.toURI() constructs those URIs. */ - private static final Pattern SINGLE_SLASH_FILE_URI = Pattern.compile("^" // - + "(file):([\\\\/](?![\\\\/])" // + private static final Pattern SINGLE_SLASH_FILE_URI = Pattern.compile("^" // //$NON-NLS-1$ + + "(file):([\\\\/](?![\\\\/])" // //$NON-NLS-1$ + PATH_P // - + ")$"); + + ")$"); //$NON-NLS-1$ /** * A pattern matching a SCP URI's of the form user@host:path/to/repo.git */ - private static final Pattern RELATIVE_SCP_URI = Pattern.compile("^" // + private static final Pattern RELATIVE_SCP_URI = Pattern.compile("^" // //$NON-NLS-1$ + OPT_USER_PWD_P // + HOST_P // - + ":(" // - + ("(?:" + USER_HOME_P + "[\\\\/])?") // + + ":(" // //$NON-NLS-1$ + + ("(?:" + USER_HOME_P + "[\\\\/])?") // //$NON-NLS-1$ //$NON-NLS-2$ + RELATIVE_PATH_P // - + ")$"); + + ")$"); //$NON-NLS-1$ /** * A pattern matching a SCP URI's of the form user@host:/path/to/repo.git */ - private static final Pattern ABSOLUTE_SCP_URI = Pattern.compile("^" // + private static final Pattern ABSOLUTE_SCP_URI = Pattern.compile("^" // //$NON-NLS-1$ + OPT_USER_PWD_P // - + "([^\\\\/:]{2,})" // - + ":(" // - + "[\\\\/]" + RELATIVE_PATH_P // - + ")$"); + + "([^\\\\/:]{2,})" // //$NON-NLS-1$ + + ":(" // //$NON-NLS-1$ + + "[\\\\/]" + RELATIVE_PATH_P // //$NON-NLS-1$ + + ")$"); //$NON-NLS-1$ private String scheme; @@ -201,7 +201,7 @@ public class URIish implements Serializable { */ public URIish(String s) throws URISyntaxException { if (StringUtils.isEmptyOrNull(s)) { - throw new URISyntaxException("The uri was empty or null", + throw new URISyntaxException("The uri was empty or null", //$NON-NLS-1$ JGitText.get().cannotParseGitURIish); } Matcher matcher = SINGLE_SLASH_FILE_URI.matcher(s); @@ -284,7 +284,7 @@ public class URIish implements Serializable { private static final BitSet reservedChars = new BitSet(127); static { - for (byte b : Constants.encodeASCII("!*'();:@&=+$,/?#[]")) + for (byte b : Constants.encodeASCII("!*'();:@&=+$,/?#[]")) //$NON-NLS-1$ reservedChars.set(b); } @@ -315,7 +315,7 @@ public class URIish implements Serializable { if (b <= 32 || (encodeNonAscii && b > 127) || b == '%' || (escapeReservedChars && reservedChars.get(b))) { os.write('%'); - byte[] tmp = Constants.encodeASCII(String.format("%02x", + byte[] tmp = Constants.encodeASCII(String.format("%02x", //$NON-NLS-1$ Integer.valueOf(b))); os.write(tmp[0]); os.write(tmp[1]); @@ -329,7 +329,7 @@ public class URIish implements Serializable { private String n2e(String s) { if (s == null) - return ""; + return ""; //$NON-NLS-1$ else return s; } @@ -602,7 +602,7 @@ public class URIish implements Serializable { final StringBuilder r = new StringBuilder(); if (getScheme() != null) { r.append(getScheme()); - r.append("://"); + r.append("://"); //$NON-NLS-1$ } if (getUser() != null) { @@ -625,7 +625,7 @@ public class URIish implements Serializable { if (getPath() != null) { if (getScheme() != null) { - if (!getPath().startsWith("/")) + if (!getPath().startsWith("/")) //$NON-NLS-1$ r.append('/'); } else if (getHost() != null) r.append(':'); @@ -691,14 +691,14 @@ public class URIish implements Serializable { * @see #getPath */ public String getHumanishName() throws IllegalArgumentException { - if ("".equals(getPath()) || getPath() == null) + if ("".equals(getPath()) || getPath() == null) //$NON-NLS-1$ throw new IllegalArgumentException(); String s = getPath(); String[] elements; - if ("file".equals(scheme) || LOCAL_FILE.matcher(s).matches()) - elements = s.split("[\\" + File.separatorChar + "/]"); + if ("file".equals(scheme) || LOCAL_FILE.matcher(s).matches()) //$NON-NLS-1$ + elements = s.split("[\\" + File.separatorChar + "/]"); //$NON-NLS-1$ //$NON-NLS-2$ else - elements = s.split("/"); + elements = s.split("/"); //$NON-NLS-1$ if (elements.length == 0) throw new IllegalArgumentException(); String result = elements[elements.length - 1]; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index c2cda54981..74801fe41a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -133,9 +133,9 @@ public class UploadPack { if (line.length() > 45) { final HashSet<String> opts = new HashSet<String>(); String opt = line.substring(45); - if (opt.startsWith(" ")) + if (opt.startsWith(" ")) //$NON-NLS-1$ opt = opt.substring(1); - for (String c : opt.split(" ")) + for (String c : opt.split(" ")) //$NON-NLS-1$ opts.add(c); this.line = line.substring(0, 45); this.options = Collections.unmodifiableSet(opts); @@ -271,10 +271,10 @@ public class UploadPack { walk = new RevWalk(db); walk.setRetainBody(false); - WANT = walk.newFlag("WANT"); - PEER_HAS = walk.newFlag("PEER_HAS"); - COMMON = walk.newFlag("COMMON"); - SATISFIED = walk.newFlag("SATISFIED"); + WANT = walk.newFlag("WANT"); //$NON-NLS-1$ + PEER_HAS = walk.newFlag("PEER_HAS"); //$NON-NLS-1$ + COMMON = walk.newFlag("COMMON"); //$NON-NLS-1$ + SATISFIED = walk.newFlag("SATISFIED"); //$NON-NLS-1$ walk.carry(PEER_HAS); SAVE = new RevFlagSet(); @@ -507,7 +507,7 @@ public class UploadPack { if (timeout > 0) { final Thread caller = Thread.currentThread(); - timer = new InterruptTimer(caller.getName() + "-Timer"); + timer = new InterruptTimer(caller.getName() + "-Timer"); //$NON-NLS-1$ TimeoutInputStream i = new TimeoutInputStream(rawIn, timer); TimeoutOutputStream o = new TimeoutOutputStream(rawOut, timer); i.setTimeout(timeout * 1000); @@ -588,7 +588,7 @@ public class UploadPack { } catch (ServiceMayNotContinueException err) { if (!err.isOutput() && err.getMessage() != null) { try { - pckOut.writeString("ERR " + err.getMessage() + "\n"); + pckOut.writeString("ERR " + err.getMessage() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ err.setOutput(); } catch (Throwable err2) { // Ignore this secondary failure (and not mark output). @@ -613,7 +613,7 @@ public class UploadPack { private void reportErrorDuringNegotiate(String msg) { try { - pckOut.writeString("ERR " + msg + "\n"); + pckOut.writeString("ERR " + msg + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (Throwable err) { // Ignore this secondary failure. } @@ -639,13 +639,13 @@ public class UploadPack { // Commits at the boundary which aren't already shallow in // the client need to be marked as such if (c.getDepth() == depth && !clientShallowCommits.contains(c)) - pckOut.writeString("shallow " + o.name()); + pckOut.writeString("shallow " + o.name()); //$NON-NLS-1$ // Commits not on the boundary which are shallow in the client // need to become unshallowed if (c.getDepth() < depth && clientShallowCommits.contains(c)) { unshallowCommits.add(c.copy()); - pckOut.writeString("unshallow " + c.name()); + pckOut.writeString("unshallow " + c.name()); //$NON-NLS-1$ } } @@ -668,7 +668,7 @@ public class UploadPack { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { - adv.writeOne("ERR " + fail.getMessage()); + adv.writeOne("ERR " + fail.getMessage()); //$NON-NLS-1$ fail.setOutput(); } throw fail; @@ -706,18 +706,18 @@ public class UploadPack { if (line == PacketLineIn.END) break; - if (line.startsWith("deepen ")) { + if (line.startsWith("deepen ")) { //$NON-NLS-1$ depth = Integer.parseInt(line.substring(7)); continue; } - if (line.startsWith("shallow ")) { + if (line.startsWith("shallow ")) { //$NON-NLS-1$ clientShallowCommits.add(ObjectId.fromString(line.substring(8))); continue; } - if (!line.startsWith("want ") || line.length() < 45) - throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line)); + if (!line.startsWith("want ") || line.length() < 45) //$NON-NLS-1$ + throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line)); //$NON-NLS-1$ if (isFirst && line.length() > 45) { final FirstLine firstLine = new FirstLine(line); @@ -753,31 +753,31 @@ public class UploadPack { if (line == PacketLineIn.END) { last = processHaveLines(peerHas, last); if (commonBase.isEmpty() || multiAck != MultiAck.OFF) - pckOut.writeString("NAK\n"); + pckOut.writeString("NAK\n"); //$NON-NLS-1$ if (noDone && sentReady) { - pckOut.writeString("ACK " + last.name() + "\n"); + pckOut.writeString("ACK " + last.name() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ return true; } if (!biDirectionalPipe) return false; pckOut.flush(); - } else if (line.startsWith("have ") && line.length() == 45) { + } else if (line.startsWith("have ") && line.length() == 45) { //$NON-NLS-1$ peerHas.add(ObjectId.fromString(line.substring(5))); - } else if (line.equals("done")) { + } else if (line.equals("done")) { //$NON-NLS-1$ last = processHaveLines(peerHas, last); if (commonBase.isEmpty()) - pckOut.writeString("NAK\n"); + pckOut.writeString("NAK\n"); //$NON-NLS-1$ else if (multiAck != MultiAck.OFF) - pckOut.writeString("ACK " + last.name() + "\n"); + pckOut.writeString("ACK " + last.name() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ return true; } else { - throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "have", line)); + throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "have", line)); //$NON-NLS-1$ } } } @@ -877,13 +877,13 @@ public class UploadPack { switch (multiAck) { case OFF: if (commonBase.size() == 1) - pckOut.writeString("ACK " + obj.name() + "\n"); + pckOut.writeString("ACK " + obj.name() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ break; case CONTINUE: - pckOut.writeString("ACK " + obj.name() + " continue\n"); + pckOut.writeString("ACK " + obj.name() + " continue\n"); //$NON-NLS-1$ //$NON-NLS-2$ break; case DETAILED: - pckOut.writeString("ACK " + obj.name() + " common\n"); + pckOut.writeString("ACK " + obj.name() + " common\n"); //$NON-NLS-1$ //$NON-NLS-2$ break; } } @@ -927,10 +927,10 @@ public class UploadPack { case OFF: break; case CONTINUE: - pckOut.writeString("ACK " + id.name() + " continue\n"); + pckOut.writeString("ACK " + id.name() + " continue\n"); //$NON-NLS-1$ //$NON-NLS-2$ break; case DETAILED: - pckOut.writeString("ACK " + id.name() + " ready\n"); + pckOut.writeString("ACK " + id.name() + " ready\n"); //$NON-NLS-1$ //$NON-NLS-2$ sentReady = true; break; } @@ -943,7 +943,7 @@ public class UploadPack { if (multiAck == MultiAck.DETAILED && !didOkToGiveUp && okToGiveUp()) { ObjectId id = peerHas.get(peerHas.size() - 1); sentReady = true; - pckOut.writeString("ACK " + id.name() + " ready\n"); + pckOut.writeString("ACK " + id.name() + " ready\n"); //$NON-NLS-1$ //$NON-NLS-2$ sentReady = true; } @@ -1047,7 +1047,7 @@ public class UploadPack { if (0 <= eof) throw new CorruptObjectException(MessageFormat.format( JGitText.get().expectedEOFReceived, - "\\x" + Integer.toHexString(eof))); + "\\x" + Integer.toHexString(eof))); //$NON-NLS-1$ } if (sideband) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java index db4ac63851..6caa5aa146 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java @@ -109,14 +109,14 @@ public class UsernamePasswordCredentialsProvider extends CredentialsProvider { continue; } if (i instanceof CredentialItem.StringType) { - if (i.getPromptText().equals("Password: ")) { + if (i.getPromptText().equals("Password: ")) { //$NON-NLS-1$ ((CredentialItem.StringType) i).setValue(new String( password)); continue; } } throw new UnsupportedCredentialItem(uri, i.getClass().getName() - + ":" + i.getPromptText()); + + ":" + i.getPromptText()); //$NON-NLS-1$ } return true; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java index 080dc35e6a..e55b984380 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java @@ -67,9 +67,9 @@ import org.eclipse.jgit.internal.JGitText; abstract class WalkEncryption { static final WalkEncryption NONE = new NoEncryption(); - static final String JETS3T_CRYPTO_VER = "jets3t-crypto-ver"; + static final String JETS3T_CRYPTO_VER = "jets3t-crypto-ver"; //$NON-NLS-1$ - static final String JETS3T_CRYPTO_ALG = "jets3t-crypto-alg"; + static final String JETS3T_CRYPTO_ALG = "jets3t-crypto-alg"; //$NON-NLS-1$ abstract OutputStream encrypt(OutputStream os) throws IOException; @@ -85,13 +85,13 @@ abstract class WalkEncryption { v = u.getHeaderField(p + JETS3T_CRYPTO_VER); if (v == null) - v = ""; + v = ""; //$NON-NLS-1$ if (!version.equals(v)) throw new IOException(MessageFormat.format(JGitText.get().unsupportedEncryptionVersion, v)); v = u.getHeaderField(p + JETS3T_CRYPTO_ALG); if (v == null) - v = ""; + v = ""; //$NON-NLS-1$ if (!name.equals(v)) throw new IOException(JGitText.get().unsupportedEncryptionAlgorithm + v); } @@ -112,7 +112,7 @@ abstract class WalkEncryption { @Override void validate(final HttpURLConnection u, final String p) throws IOException { - validateImpl(u, p, "", ""); + validateImpl(u, p, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ } @Override @@ -150,14 +150,14 @@ abstract class WalkEncryption { @Override void request(final HttpURLConnection u, final String prefix) { - u.setRequestProperty(prefix + JETS3T_CRYPTO_VER, "2"); + u.setRequestProperty(prefix + JETS3T_CRYPTO_VER, "2"); //$NON-NLS-1$ u.setRequestProperty(prefix + JETS3T_CRYPTO_ALG, algorithmName); } @Override void validate(final HttpURLConnection u, final String p) throws IOException { - validateImpl(u, p, "2", algorithmName); + validateImpl(u, p, "2", algorithmName); //$NON-NLS-1$ } @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java index f1710bd5c0..e1ce5d6523 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java @@ -212,9 +212,9 @@ class WalkFetchConnection extends BaseFetchConnection { revWalk = new RevWalk(reader); revWalk.setRetainBody(false); treeWalk = new TreeWalk(reader); - COMPLETE = revWalk.newFlag("COMPLETE"); - IN_WORK_QUEUE = revWalk.newFlag("IN_WORK_QUEUE"); - LOCALLY_SEEN = revWalk.newFlag("LOCALLY_SEEN"); + COMPLETE = revWalk.newFlag("COMPLETE"); //$NON-NLS-1$ + IN_WORK_QUEUE = revWalk.newFlag("IN_WORK_QUEUE"); //$NON-NLS-1$ + LOCALLY_SEEN = revWalk.newFlag("LOCALLY_SEEN"); //$NON-NLS-1$ localCommitQueue = new DateRevQueue(); workQueue = new LinkedList<ObjectId>(); @@ -406,7 +406,7 @@ class WalkFetchConnection extends BaseFetchConnection { final String idStr = id.name(); final String subdir = idStr.substring(0, 2); final String file = idStr.substring(2); - final String looseName = subdir + "/" + file; + final String looseName = subdir + "/" + file; //$NON-NLS-1$ for (int i = lastRemoteIdx; i < remotes.size(); i++) { if (downloadLooseObject(id, looseName, remotes.get(i))) { @@ -791,17 +791,18 @@ class WalkFetchConnection extends BaseFetchConnection { RemotePack(final WalkRemoteObjectDatabase c, final String pn) { connection = c; packName = pn; - idxName = packName.substring(0, packName.length() - 5) + ".idx"; + idxName = packName.substring(0, packName.length() - 5) + ".idx"; //$NON-NLS-1$ String tn = idxName; - if (tn.startsWith("pack-")) + if (tn.startsWith("pack-")) //$NON-NLS-1$ tn = tn.substring(5); - if (tn.endsWith(".idx")) + if (tn.endsWith(".idx")) //$NON-NLS-1$ tn = tn.substring(0, tn.length() - 4); if (local.getObjectDatabase() instanceof ObjectDirectory) { tmpIdx = new File(((ObjectDirectory) local.getObjectDatabase()) - .getDirectory(), "walk-" + tn + ".walkidx"); + .getDirectory(), + "walk-" + tn + ".walkidx"); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -809,7 +810,7 @@ class WalkFetchConnection extends BaseFetchConnection { if (index != null) return; if (tmpIdx == null) - tmpIdx = File.createTempFile("jgit-walk-", ".idx"); + tmpIdx = File.createTempFile("jgit-walk-", ".idx"); //$NON-NLS-1$ //$NON-NLS-2$ else if (tmpIdx.isFile()) { try { index = PackIndex.open(tmpIdx); @@ -820,8 +821,8 @@ class WalkFetchConnection extends BaseFetchConnection { } final WalkRemoteObjectDatabase.FileStream s; - s = connection.open("pack/" + idxName); - pm.beginTask("Get " + idxName.substring(0, 12) + "..idx", + s = connection.open("pack/" + idxName); //$NON-NLS-1$ + pm.beginTask("Get " + idxName.substring(0, 12) + "..idx", //$NON-NLS-1$ //$NON-NLS-2$ s.length < 0 ? ProgressMonitor.UNKNOWN : (int) (s.length / 1024)); try { @@ -858,7 +859,7 @@ class WalkFetchConnection extends BaseFetchConnection { } void downloadPack(final ProgressMonitor monitor) throws IOException { - String name = "pack/" + packName; + String name = "pack/" + packName; //$NON-NLS-1$ WalkRemoteObjectDatabase.FileStream s = connection.open(name); PackParser parser = inserter.newPackParser(s.in); parser.setAllowThin(false); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java index 9b22aefebe..78fe30a0bb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java @@ -149,7 +149,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { final List<RemoteRefUpdate> updates = new ArrayList<RemoteRefUpdate>(); for (final RemoteRefUpdate u : refUpdates.values()) { final String n = u.getRemoteName(); - if (!n.startsWith("refs/") || !Repository.isValidRefName(n)) { + if (!n.startsWith("refs/") || !Repository.isValidRefName(n)) { //$NON-NLS-1$ u.setStatus(Status.REJECTED_OTHER_REASON); u.setMessage(JGitText.get().funnyRefname); continue; @@ -239,10 +239,10 @@ class WalkPushConnection extends BaseConnection implements PushConnection { for (final String n : dest.getPackNames()) packNames.put(n, n); - final String base = "pack-" + writer.computeName().name(); - final String packName = base + ".pack"; - pathPack = "pack/" + packName; - pathIdx = "pack/" + base + ".idx"; + final String base = "pack-" + writer.computeName().name(); //$NON-NLS-1$ + final String packName = base + ".pack"; //$NON-NLS-1$ + pathPack = "pack/" + packName; //$NON-NLS-1$ + pathIdx = "pack/" + base + ".idx"; //$NON-NLS-1$ //$NON-NLS-2$ if (packNames.remove(packName) != null) { // The remote already contains this pack. We should @@ -256,8 +256,8 @@ class WalkPushConnection extends BaseConnection implements PushConnection { // Write the pack file, then the index, as readers look the // other direction (index, then pack file). // - final String wt = "Put " + base.substring(0, 12); - OutputStream os = dest.writeFile(pathPack, monitor, wt + "..pack"); + final String wt = "Put " + base.substring(0, 12); //$NON-NLS-1$ + OutputStream os = dest.writeFile(pathPack, monitor, wt + "..pack"); //$NON-NLS-1$ try { os = new SafeBufferedOutputStream(os); writer.writePack(monitor, monitor, os); @@ -265,7 +265,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { os.close(); } - os = dest.writeFile(pathIdx, monitor, wt + "..idx"); + os = dest.writeFile(pathIdx, monitor, wt + "..idx"); //$NON-NLS-1$ try { os = new SafeBufferedOutputStream(os); writer.writeIndex(os); @@ -354,7 +354,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { private void createNewRepository(final List<RemoteRefUpdate> updates) throws TransportException { try { - final String ref = "ref: " + pickHEAD(updates) + "\n"; + final String ref = "ref: " + pickHEAD(updates) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ final byte[] bytes = Constants.encode(ref); dest.writeFile(ROOT_DIR + Constants.HEAD, bytes); } catch (IOException e) { @@ -362,8 +362,8 @@ class WalkPushConnection extends BaseConnection implements PushConnection { } try { - final String config = "[core]\n" - + "\trepositoryformatversion = 0\n"; + final String config = "[core]\n" //$NON-NLS-1$ + + "\trepositoryformatversion = 0\n"; //$NON-NLS-1$ final byte[] bytes = Constants.encode(config); dest.writeFile(ROOT_DIR + Constants.CONFIG, bytes); } catch (IOException e) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java index 8d6937df4a..59a9f56825 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java @@ -76,13 +76,13 @@ import org.eclipse.jgit.util.IO; * independent {@link WalkFetchConnection}. */ abstract class WalkRemoteObjectDatabase { - static final String ROOT_DIR = "../"; + static final String ROOT_DIR = "../"; //$NON-NLS-1$ - static final String INFO_PACKS = "info/packs"; + static final String INFO_PACKS = "info/packs"; //$NON-NLS-1$ - static final String INFO_ALTERNATES = "info/alternates"; + static final String INFO_ALTERNATES = "info/alternates"; //$NON-NLS-1$ - static final String INFO_HTTP_ALTERNATES = "info/http-alternates"; + static final String INFO_HTTP_ALTERNATES = "info/http-alternates"; //$NON-NLS-1$ static final String INFO_REFS = ROOT_DIR + Constants.INFO_REFS; @@ -292,7 +292,7 @@ abstract class WalkRemoteObjectDatabase { * deletion is not supported, or deletion failed. */ void deleteRefLog(final String name) throws IOException { - deleteFile(ROOT_DIR + Constants.LOGS + "/" + name); + deleteFile(ROOT_DIR + Constants.LOGS + "/" + name); //$NON-NLS-1$ } /** @@ -336,7 +336,7 @@ abstract class WalkRemoteObjectDatabase { void writeInfoPacks(final Collection<String> packNames) throws IOException { final StringBuilder w = new StringBuilder(); for (final String n : packNames) { - w.append("P "); + w.append("P "); //$NON-NLS-1$ w.append(n); w.append('\n'); } @@ -398,8 +398,8 @@ abstract class WalkRemoteObjectDatabase { String line = br.readLine(); if (line == null) break; - if (!line.endsWith("/")) - line += "/"; + if (!line.endsWith("/")) //$NON-NLS-1$ + line += "/"; //$NON-NLS-1$ alts.add(openAlternate(line)); } return alts; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java index 1d4f2beb18..6964e7fa28 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java @@ -222,7 +222,7 @@ public class FileResolver<C> implements RepositoryResolver<C> { if (isExportAll()) return true; else if (db.getDirectory() != null) - return new File(db.getDirectory(), "git-daemon-export-ok").exists(); + return new File(db.getDirectory(), "git-daemon-export-ok").exists(); //$NON-NLS-1$ else return false; } @@ -242,13 +242,13 @@ public class FileResolver<C> implements RepositoryResolver<C> { if (new File(name).isAbsolute()) return true; // no absolute paths - if (name.startsWith("../")) - return true; // no "l../etc/passwd" - if (name.contains("/../")) - return true; // no "foo/../etc/passwd" - if (name.contains("/./")) - return true; // "foo/./foo" is insane to ask - if (name.contains("//")) + if (name.startsWith("../")) //$NON-NLS-1$ + return true; // no "l../etc/passwd" + if (name.contains("/../")) //$NON-NLS-1$ + return true; // no "foo/../etc/passwd" + if (name.contains("/./")) //$NON-NLS-1$ + return true; // "foo/./foo" is insane to ask + if (name.contains("//")) //$NON-NLS-1$ return true; // double slashes is sloppy, don't use it return false; // is a reasonable name diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java index 0b8df130f8..4cf79c0a27 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java @@ -672,8 +672,9 @@ public abstract class AbstractTreeIterator { System.arraycopy(path, pathOffset, buffer, offset, pathLen - pathOffset); } + @SuppressWarnings("nls") @Override public String toString() { - return getClass().getSimpleName() + "[" + getEntryPathString() + "]"; + return getClass().getSimpleName() + "[" + getEntryPathString() + "]"; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 9ee5f8b11d..e16bf7ffa9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -646,7 +646,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { if (e == null) continue; final String name = e.getName(); - if (".".equals(name) || "..".equals(name)) + if (".".equals(name) || "..".equals(name)) //$NON-NLS-1$ //$NON-NLS-2$ continue; if (Constants.DOT_GIT.equals(name)) continue; @@ -937,7 +937,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { } public String toString() { - return getMode().toString() + " " + getName(); + return getMode().toString() + " " + getName(); //$NON-NLS-1$ } /** @@ -1054,7 +1054,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { .getExcludesFile(); if (path != null) { File excludesfile; - if (path.startsWith("~/")) + if (path.startsWith("~/")) //$NON-NLS-1$ excludesfile = fs.resolve(fs.userHome(), path.substring(2)); else excludesfile = fs.resolve(null, path); @@ -1062,7 +1062,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { } File exclude = fs - .resolve(repository.getDirectory(), "info/exclude"); + .resolve(repository.getDirectory(), "info/exclude"); //$NON-NLS-1$ loadRulesFromFile(r, exclude); return r.getRules().isEmpty() ? null : r; 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 01d2bd0421..d5e7464d4f 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 @@ -141,6 +141,7 @@ public abstract class AndTreeFilter extends TreeFilter { return new Binary(a.clone(), b.clone()); } + @SuppressWarnings("nls") @Override public String toString() { return "(" + a.toString() + " AND " + b.toString() + ")"; @@ -181,6 +182,7 @@ public abstract class AndTreeFilter extends TreeFilter { return new List(s); } + @SuppressWarnings("nls") @Override public String toString() { final StringBuilder r = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java index 34e92b6b1b..4e44a76c99 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java @@ -226,7 +226,7 @@ public class IndexDiffFilter extends TreeFilter { String pathToBeSaved = null; while (!untrackedParentFolders.isEmpty() && !currentPath.startsWith(untrackedParentFolders.getFirst() - + "/")) + + "/")) //$NON-NLS-1$ pathToBeSaved = untrackedParentFolders.removeFirst(); if (pathToBeSaved != null) { while (!untrackedFolders.isEmpty() @@ -254,7 +254,7 @@ public class IndexDiffFilter extends TreeFilter { @Override public String toString() { - return "INDEX_DIFF_FILTER"; + return "INDEX_DIFF_FILTER"; //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java index 2e96d2ffa4..7f30cc7d08 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotIgnoredFilter.java @@ -83,6 +83,7 @@ public class NotIgnoredFilter extends TreeFilter { return this; } + @SuppressWarnings("nls") @Override public String toString() { return "NotIgnored(" + index + ")"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotTreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotTreeFilter.java index 717e8e1d0c..8ec04bb32d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotTreeFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/NotTreeFilter.java @@ -94,6 +94,6 @@ public class NotTreeFilter extends TreeFilter { @Override public String toString() { - return "NOT " + a.toString(); + return "NOT " + a.toString(); //$NON-NLS-1$ } } 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 8e934f01de..270633ce63 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 @@ -139,6 +139,7 @@ public abstract class OrTreeFilter extends TreeFilter { return new Binary(a.clone(), b.clone()); } + @SuppressWarnings("nls") @Override public String toString() { return "(" + a.toString() + " OR " + b.toString() + ")"; @@ -182,13 +183,13 @@ public abstract class OrTreeFilter extends TreeFilter { @Override public String toString() { final StringBuilder r = new StringBuilder(); - r.append("("); + r.append("("); //$NON-NLS-1$ for (int i = 0; i < subfilters.length; i++) { if (i > 0) - r.append(" OR "); + r.append(" OR "); //$NON-NLS-1$ r.append(subfilters[i].toString()); } - r.append(")"); + r.append(")"); //$NON-NLS-1$ return r.toString(); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java index b3494bf6ee..d85ea8cc5d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java @@ -74,7 +74,7 @@ public class PathFilter extends TreeFilter { * the path supplied was the empty string. */ public static PathFilter create(String path) { - while (path.endsWith("/")) + while (path.endsWith("/")) //$NON-NLS-1$ path = path.substring(0, path.length() - 1); if (path.length() == 0) throw new IllegalArgumentException(JGitText.get().emptyPathNotPermitted); @@ -113,6 +113,7 @@ public class PathFilter extends TreeFilter { return this; } + @SuppressWarnings("nls") public String toString() { return "PATH(\"" + pathStr + "\")"; } 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 8f6e544692..51761a8126 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 @@ -172,7 +172,7 @@ public class PathFilterGroup { } public String toString() { - return "FAST_" + path.toString(); + return "FAST_" + path.toString(); //$NON-NLS-1$ } } @@ -221,13 +221,13 @@ public class PathFilterGroup { public String toString() { final StringBuilder r = new StringBuilder(); - r.append("FAST("); + r.append("FAST("); //$NON-NLS-1$ for (int i = 0; i < paths.length; i++) { if (i > 0) - r.append(" OR "); + r.append(" OR "); //$NON-NLS-1$ r.append(paths[i].toString()); } - r.append(")"); + r.append(")"); //$NON-NLS-1$ return r.toString(); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/SkipWorkTreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/SkipWorkTreeFilter.java index d06a13ed89..e6bedfd43e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/SkipWorkTreeFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/SkipWorkTreeFilter.java @@ -89,6 +89,7 @@ public class SkipWorkTreeFilter extends TreeFilter { return this; } + @SuppressWarnings("nls") @Override public String toString() { return "SkipWorkTree(" + treeIdx + ")"; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java index acc1ae608a..7d99e58f38 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java @@ -106,7 +106,7 @@ public abstract class TreeFilter { @Override public String toString() { - return "ALL"; + return "ALL"; //$NON-NLS-1$ } } @@ -156,7 +156,7 @@ public abstract class TreeFilter { @Override public String toString() { - return "ANY_DIFF"; + return "ANY_DIFF"; //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java index b59148fc30..ed5838a20e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java @@ -40,7 +40,7 @@ public class Base64 { private final static byte INVALID_DEC = -3; /** Preferred encoding. */ - private final static String UTF_8 = "UTF-8"; + private final static String UTF_8 = "UTF-8"; //$NON-NLS-1$ /** The 64 valid Base64 values. */ private final static byte[] ENC; @@ -54,10 +54,10 @@ public class Base64 { static { try { - ENC = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" // - + "abcdefghijklmnopqrstuvwxyz" // - + "0123456789" // - + "+/" // + ENC = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" // //$NON-NLS-1$ + + "abcdefghijklmnopqrstuvwxyz" // //$NON-NLS-1$ + + "0123456789" // //$NON-NLS-1$ + + "+/" // //$NON-NLS-1$ ).getBytes(UTF_8); } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee.getMessage(), uee); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java index a8e505d6e5..a869b2beac 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java @@ -61,16 +61,17 @@ import org.eclipse.jgit.lib.PersonIdent; */ public class ChangeIdUtil { - static final String CHANGE_ID = "Change-Id:"; + static final String CHANGE_ID = "Change-Id:"; //$NON-NLS-1$ // package-private so the unit test can test this part only + @SuppressWarnings("nls") static String clean(String msg) { return msg.// - replaceAll("(?i)(?m)^Signed-off-by:.*$\n?", "").// - replaceAll("(?m)^#.*$\n?", "").// - replaceAll("(?m)\n\n\n+", "\\\n").// - replaceAll("\\n*$", "").// - replaceAll("(?s)\ndiff --git.*", "").// + replaceAll("(?i)(?m)^Signed-off-by:.*$\n?", "").// //$NON-NLS-1$ + replaceAll("(?m)^#.*$\n?", "").// //$NON-NLS-1$ + replaceAll("(?m)\n\n\n+", "\\\n").// //$NON-NLS-1$ + replaceAll("\\n*$", "").// //$NON-NLS-1$ + replaceAll("(?s)\ndiff --git.*", "").// //$NON-NLS-1$ trim(); } @@ -99,33 +100,33 @@ public class ChangeIdUtil { if (cleanMessage.length() == 0) return null; StringBuilder b = new StringBuilder(); - b.append("tree "); + b.append("tree "); //$NON-NLS-1$ b.append(ObjectId.toString(treeId)); - b.append("\n"); + b.append("\n"); //$NON-NLS-1$ if (firstParentId != null) { - b.append("parent "); + b.append("parent "); //$NON-NLS-1$ b.append(ObjectId.toString(firstParentId)); - b.append("\n"); + b.append("\n"); //$NON-NLS-1$ } - b.append("author "); + b.append("author "); //$NON-NLS-1$ b.append(author.toExternalString()); - b.append("\n"); - b.append("committer "); + b.append("\n"); //$NON-NLS-1$ + b.append("committer "); //$NON-NLS-1$ b.append(committer.toExternalString()); - b.append("\n\n"); + b.append("\n\n"); //$NON-NLS-1$ b.append(cleanMessage); return new ObjectInserter.Formatter().idFor(Constants.OBJ_COMMIT, // b.toString().getBytes(Constants.CHARACTER_ENCODING)); } private static final Pattern issuePattern = Pattern - .compile("^(Bug|Issue)[a-zA-Z0-9-]*:.*$"); + .compile("^(Bug|Issue)[a-zA-Z0-9-]*:.*$"); //$NON-NLS-1$ private static final Pattern footerPattern = Pattern - .compile("(^[a-zA-Z0-9-]+:(?!//).*$)"); + .compile("(^[a-zA-Z0-9-]+:(?!//).*$)"); //$NON-NLS-1$ private static final Pattern includeInFooterPattern = Pattern - .compile("^[ \\[].*$"); + .compile("^[ \\[].*$"); //$NON-NLS-1$ /** * Find the right place to insert a Change-Id and return it. @@ -167,12 +168,12 @@ public class ChangeIdUtil { i++; String oldId = message.length() == (i + 40) ? message.substring(i) : message.substring(i, i + 41); - message = message.replace(oldId, "I" + changeId.getName()); + message = message.replace(oldId, "I" + changeId.getName()); //$NON-NLS-1$ } return message; } - String[] lines = message.split("\n"); + String[] lines = message.split("\n"); //$NON-NLS-1$ int footerFirstLine = lines.length; for (int i = lines.length - 1; i > 1; --i) { if (footerPattern.matcher(lines[i]).matches()) { @@ -202,17 +203,17 @@ public class ChangeIdUtil { int i = 0; for (; i < insertAfter; ++i) { ret.append(lines[i]); - ret.append("\n"); + ret.append("\n"); //$NON-NLS-1$ } if (insertAfter == lines.length && insertAfter == footerFirstLine) - ret.append("\n"); + ret.append("\n"); //$NON-NLS-1$ ret.append(CHANGE_ID); - ret.append(" I"); + ret.append(" I"); //$NON-NLS-1$ ret.append(ObjectId.toString(changeId)); - ret.append("\n"); + ret.append("\n"); //$NON-NLS-1$ for (; i < lines.length; ++i) { ret.append(lines[i]); - ret.append("\n"); + ret.append("\n"); //$NON-NLS-1$ } return ret.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 6eb020e52b..ae6197838c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -243,7 +243,7 @@ public abstract class FS { final String home = AccessController .doPrivileged(new PrivilegedAction<String>() { public String run() { - return System.getProperty("user.home"); + return System.getProperty("user.home"); //$NON-NLS-1$ } }); if (home == null || home.length() == 0) @@ -287,10 +287,10 @@ public abstract class FS { */ protected static String readPipe(File dir, String[] command, String encoding) { final boolean debug = Boolean.parseBoolean(SystemReader.getInstance() - .getProperty("jgit.fs.debug")); + .getProperty("jgit.fs.debug")); //$NON-NLS-1$ try { if (debug) - System.err.println("readpipe " + Arrays.asList(command) + "," + System.err.println("readpipe " + Arrays.asList(command) + "," //$NON-NLS-1$ //$NON-NLS-2$ + dir); final Process p = Runtime.getRuntime().exec(command, null, dir); final BufferedReader lineRead = new BufferedReader( @@ -330,8 +330,8 @@ public abstract class FS { try { r = lineRead.readLine(); if (debug) { - System.err.println("readpipe may return '" + r + "'"); - System.err.println("(ignoring remaing output:"); + System.err.println("readpipe may return '" + r + "'"); //$NON-NLS-1$ //$NON-NLS-2$ + System.err.println("(ignoring remaing output:"); //$NON-NLS-1$ } String l; while ((l = lineRead.readLine()) != null) { @@ -351,7 +351,7 @@ public abstract class FS { && !gooblerFail.get()) return r; if (debug) - System.err.println("readpipe rc=" + rc); + System.err.println("readpipe rc=" + rc); //$NON-NLS-1$ break; } catch (InterruptedException ie) { // Stop bothering me, I have a zombie to reap. @@ -363,7 +363,7 @@ public abstract class FS { // Ignore error (but report) } if (debug) - System.err.println("readpipe returns null"); + System.err.println("readpipe returns null"); //$NON-NLS-1$ return null; } @@ -372,7 +372,7 @@ public abstract class FS { Holder<File> p = gitPrefix; if (p == null) { String overrideGitPrefix = SystemReader.getInstance().getProperty( - "jgit.gitprefix"); + "jgit.gitprefix"); //$NON-NLS-1$ if (overrideGitPrefix != null) p = new Holder<File>(new File(overrideGitPrefix)); else diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java index 742afe1354..b6b5595902 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java @@ -51,8 +51,8 @@ import java.util.List; abstract class FS_POSIX extends FS { @Override protected File discoverGitPrefix() { - String path = SystemReader.getInstance().getenv("PATH"); - File gitExe = searchPath(path, "git"); + String path = SystemReader.getInstance().getenv("PATH"); //$NON-NLS-1$ + File gitExe = searchPath(path, "git"); //$NON-NLS-1$ if (gitExe != null) return gitExe.getParentFile().getParentFile(); @@ -62,7 +62,7 @@ abstract class FS_POSIX extends FS { // login shell and search using that. // String w = readPipe(userHome(), // - new String[] { "bash", "--login", "-c", "which git" }, // + new String[] { "bash", "--login", "-c", "which git" }, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Charset.defaultCharset().name()); if (w == null || w.length() == 0) return null; @@ -91,9 +91,9 @@ abstract class FS_POSIX extends FS { @Override public ProcessBuilder runInShell(String cmd, String[] args) { List<String> argv = new ArrayList<String>(4 + args.length); - argv.add("sh"); - argv.add("-c"); - argv.add(cmd + " \"$@\""); + argv.add("sh"); //$NON-NLS-1$ + argv.add("-c"); //$NON-NLS-1$ + argv.add(cmd + " \"$@\""); //$NON-NLS-1$ argv.add(cmd); argv.addAll(Arrays.asList(args)); ProcessBuilder proc = new ProcessBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX_Java6.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX_Java6.java index 09a4db7a23..05025479b5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX_Java6.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX_Java6.java @@ -55,8 +55,8 @@ class FS_POSIX_Java6 extends FS_POSIX { private static final Method setExecute; static { - canExecute = needMethod(File.class, "canExecute"); - setExecute = needMethod(File.class, "setExecutable", Boolean.TYPE); + canExecute = needMethod(File.class, "canExecute"); //$NON-NLS-1$ + setExecute = needMethod(File.class, "setExecutable", Boolean.TYPE); //$NON-NLS-1$ } static boolean hasExecute() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java index eebaa65d08..ce62628e85 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java @@ -87,8 +87,8 @@ class FS_Win32 extends FS { @Override protected File discoverGitPrefix() { - String path = SystemReader.getInstance().getenv("PATH"); - File gitExe = searchPath(path, "git.exe", "git.cmd"); + String path = SystemReader.getInstance().getenv("PATH"); //$NON-NLS-1$ + File gitExe = searchPath(path, "git.exe", "git.cmd"); //$NON-NLS-1$ //$NON-NLS-2$ if (gitExe != null) return gitExe.getParentFile().getParentFile(); @@ -96,7 +96,7 @@ class FS_Win32 extends FS { // also be in $PATH. But its worth trying. // String w = readPipe(userHome(), // - new String[] { "bash", "--login", "-c", "which git" }, // + new String[] { "bash", "--login", "-c", "which git" }, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Charset.defaultCharset().name()); if (w != null) { // The path may be in cygwin/msys notation so resolve it right away @@ -109,16 +109,16 @@ class FS_Win32 extends FS { @Override protected File userHomeImpl() { - String home = SystemReader.getInstance().getenv("HOME"); + String home = SystemReader.getInstance().getenv("HOME"); //$NON-NLS-1$ if (home != null) return resolve(null, home); - String homeDrive = SystemReader.getInstance().getenv("HOMEDRIVE"); + String homeDrive = SystemReader.getInstance().getenv("HOMEDRIVE"); //$NON-NLS-1$ if (homeDrive != null) { - String homePath = SystemReader.getInstance().getenv("HOMEPATH"); + String homePath = SystemReader.getInstance().getenv("HOMEPATH"); //$NON-NLS-1$ return new File(homeDrive, homePath); } - String homeShare = SystemReader.getInstance().getenv("HOMESHARE"); + String homeShare = SystemReader.getInstance().getenv("HOMESHARE"); //$NON-NLS-1$ if (homeShare != null) return new File(homeShare); @@ -128,8 +128,8 @@ class FS_Win32 extends FS { @Override public ProcessBuilder runInShell(String cmd, String[] args) { List<String> argv = new ArrayList<String>(3 + args.length); - argv.add("cmd.exe"); - argv.add("/c"); + argv.add("cmd.exe"); //$NON-NLS-1$ + argv.add("/c"); //$NON-NLS-1$ argv.add(cmd); argv.addAll(Arrays.asList(args)); ProcessBuilder proc = new ProcessBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java index ee83c65f8b..af2d5a9a72 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java @@ -57,12 +57,12 @@ class FS_Win32_Cygwin extends FS_Win32 { final String path = AccessController .doPrivileged(new PrivilegedAction<String>() { public String run() { - return System.getProperty("java.library.path"); + return System.getProperty("java.library.path"); //$NON-NLS-1$ } }); if (path == null) return false; - File found = FS.searchPath(path, "cygpath.exe"); + File found = FS.searchPath(path, "cygpath.exe"); //$NON-NLS-1$ if (found != null) cygpath = found.getPath(); return cygpath != null; @@ -81,11 +81,11 @@ class FS_Win32_Cygwin extends FS_Win32 { } public File resolve(final File dir, final String pn) { - String useCygPath = System.getProperty("jgit.usecygpath"); - if (useCygPath != null && useCygPath.equals("true")) { + String useCygPath = System.getProperty("jgit.usecygpath"); //$NON-NLS-1$ + if (useCygPath != null && useCygPath.equals("true")) { //$NON-NLS-1$ String w = readPipe(dir, // - new String[] { cygpath, "--windows", "--absolute", pn }, // - "UTF-8"); + new String[] { cygpath, "--windows", "--absolute", pn }, // //$NON-NLS-1$ //$NON-NLS-2$ + "UTF-8"); //$NON-NLS-1$ if (w != null) return new File(w); } @@ -97,20 +97,20 @@ class FS_Win32_Cygwin extends FS_Win32 { final String home = AccessController .doPrivileged(new PrivilegedAction<String>() { public String run() { - return System.getenv("HOME"); + return System.getenv("HOME"); //$NON-NLS-1$ } }); if (home == null || home.length() == 0) return super.userHomeImpl(); - return resolve(new File("."), home); + return resolve(new File("."), home); //$NON-NLS-1$ } @Override public ProcessBuilder runInShell(String cmd, String[] args) { List<String> argv = new ArrayList<String>(4 + args.length); - argv.add("sh.exe"); - argv.add("-c"); - argv.add(cmd + " \"$@\""); + argv.add("sh.exe"); //$NON-NLS-1$ + argv.add("-c"); //$NON-NLS-1$ + argv.add(cmd + " \"$@\""); //$NON-NLS-1$ argv.add(cmd); argv.addAll(Arrays.asList(args)); ProcessBuilder proc = new ProcessBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateFormatter.java index 9648449da1..384cbb0f54 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateFormatter.java @@ -127,10 +127,10 @@ public class GitDateFormatter { break; case DEFAULT: // Not default: dateTimeInstance = new SimpleDateFormat( - "EEE MMM dd HH:mm:ss yyyy Z", Locale.US); + "EEE MMM dd HH:mm:ss yyyy Z", Locale.US); //$NON-NLS-1$ break; case ISO: - dateTimeInstance = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z", + dateTimeInstance = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z", //$NON-NLS-1$ Locale.US); break; case LOCAL: @@ -139,17 +139,17 @@ public class GitDateFormatter { break; case RFC: dateTimeInstance = new SimpleDateFormat( - "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US); + "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US); //$NON-NLS-1$ break; case SHORT: - dateTimeInstance = new SimpleDateFormat("yyyy-MM-dd", Locale.US); + dateTimeInstance = new SimpleDateFormat("yyyy-MM-dd", Locale.US); //$NON-NLS-1$ break; case LOCALE: case LOCALELOCAL: SystemReader systemReader = SystemReader.getInstance(); dateTimeInstance = systemReader.getDateTimeInstance( DateFormat.DEFAULT, DateFormat.DEFAULT); - dateTimeInstance2 = systemReader.getSimpleDateFormat("Z"); + dateTimeInstance2 = systemReader.getSimpleDateFormat("Z"); //$NON-NLS-1$ break; } } @@ -166,7 +166,7 @@ public class GitDateFormatter { switch (format) { case RAW: int offset = ident.getTimeZoneOffset(); - String sign = offset < 0 ? "-" : "+"; + String sign = offset < 0 ? "-" : "+"; //$NON-NLS-1$ //$NON-NLS-2$ int offset2; if (offset < 0) offset2 = -offset; @@ -174,7 +174,7 @@ public class GitDateFormatter { offset2 = offset; int hours = offset2 / 60; int minutes = offset2 % 60; - return String.format("%d %s%02d%02d", + return String.format("%d %s%02d%02d", //$NON-NLS-1$ ident.getWhen().getTime() / 1000, sign, hours, minutes); case RELATIVE: return RelativeDateFormatter.format(ident.getWhen()); @@ -189,7 +189,7 @@ public class GitDateFormatter { tz = SystemReader.getInstance().getTimeZone(); dateTimeInstance.setTimeZone(tz); dateTimeInstance2.setTimeZone(tz); - return dateTimeInstance.format(ident.getWhen()) + " " + return dateTimeInstance.format(ident.getWhen()) + " " //$NON-NLS-1$ + dateTimeInstance2.format(ident.getWhen()); default: tz = ident.getTimeZone(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java index f1743d4f16..8f4e491de6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java @@ -98,13 +98,13 @@ public class GitDateParser { // are not listed here because they are parsed without the help of a // SimpleDateFormat. enum ParseableSimpleDateFormat { - ISO("yyyy-MM-dd HH:mm:ss Z"), // - RFC("EEE, dd MMM yyyy HH:mm:ss Z"), // - SHORT("yyyy-MM-dd"), // - SHORT_WITH_DOTS_REVERSE("dd.MM.yyyy"), // - SHORT_WITH_DOTS("yyyy.MM.dd"), // - SHORT_WITH_SLASH("MM/dd/yyyy"), // - DEFAULT("EEE MMM dd HH:mm:ss yyyy Z"), // + ISO("yyyy-MM-dd HH:mm:ss Z"), // //$NON-NLS-1$ + RFC("EEE, dd MMM yyyy HH:mm:ss Z"), // //$NON-NLS-1$ + SHORT("yyyy-MM-dd"), // //$NON-NLS-1$ + SHORT_WITH_DOTS_REVERSE("dd.MM.yyyy"), // //$NON-NLS-1$ + SHORT_WITH_DOTS("yyyy.MM.dd"), // //$NON-NLS-1$ + SHORT_WITH_SLASH("MM/dd/yyyy"), // //$NON-NLS-1$ + DEFAULT("EEE MMM dd HH:mm:ss yyyy Z"), // //$NON-NLS-1$ LOCAL("EEE MMM dd HH:mm:ss yyyy"); String formatStr; @@ -154,7 +154,7 @@ public class GitDateParser { dateStr = dateStr.trim(); Date ret; - if ("never".equalsIgnoreCase(dateStr)) + if ("never".equalsIgnoreCase(dateStr)) //$NON-NLS-1$ return NEVER; ret = parse_relative(dateStr, now); if (ret != null) @@ -167,11 +167,11 @@ public class GitDateParser { } } ParseableSimpleDateFormat[] values = ParseableSimpleDateFormat.values(); - StringBuilder allFormats = new StringBuilder("\"") + StringBuilder allFormats = new StringBuilder("\"") //$NON-NLS-1$ .append(values[0].formatStr); for (int i = 1; i < values.length; i++) - allFormats.append("\", \"").append(values[i].formatStr); - allFormats.append("\""); + allFormats.append("\", \"").append(values[i].formatStr); //$NON-NLS-1$ + allFormats.append("\""); //$NON-NLS-1$ throw new ParseException(MessageFormat.format( JGitText.get().cannotParseDate, dateStr, allFormats.toString()), 0); } @@ -190,7 +190,7 @@ public class GitDateParser { SystemReader sysRead = SystemReader.getInstance(); // check for the static words "yesterday" or "now" - if ("now".equals(dateStr)) { + if ("now".equals(dateStr)) { //$NON-NLS-1$ return ((now == null) ? new Date(sysRead.getCurrentTime()) : now .getTime()); } @@ -202,7 +202,7 @@ public class GitDateParser { } else cal = (Calendar) now.clone(); - if ("yesterday".equals(dateStr)) { + if ("yesterday".equals(dateStr)) { //$NON-NLS-1$ cal.add(Calendar.DATE, -1); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); @@ -213,12 +213,12 @@ public class GitDateParser { } // parse constructs like "3 days ago", "5.week.2.day.ago" - String[] parts = dateStr.split("\\.| "); + String[] parts = dateStr.split("\\.| "); //$NON-NLS-1$ int partsLength = parts.length; // check we have an odd number of parts (at least 3) and that the last // part is "ago" if (partsLength < 3 || (partsLength & 1) == 0 - || !"ago".equals(parts[parts.length - 1])) + || !"ago".equals(parts[parts.length - 1])) //$NON-NLS-1$ return null; int number; for (int i = 0; i < parts.length - 2; i += 2) { @@ -227,24 +227,24 @@ public class GitDateParser { } catch (NumberFormatException e) { return null; } - if ("year".equals(parts[i + 1]) || "years".equals(parts[i + 1])) + if ("year".equals(parts[i + 1]) || "years".equals(parts[i + 1])) //$NON-NLS-1$ //$NON-NLS-2$ cal.add(Calendar.YEAR, -number); - else if ("month".equals(parts[i + 1]) - || "months".equals(parts[i + 1])) + else if ("month".equals(parts[i + 1]) //$NON-NLS-1$ + || "months".equals(parts[i + 1])) //$NON-NLS-1$ cal.add(Calendar.MONTH, -number); - else if ("week".equals(parts[i + 1]) - || "weeks".equals(parts[i + 1])) + else if ("week".equals(parts[i + 1]) //$NON-NLS-1$ + || "weeks".equals(parts[i + 1])) //$NON-NLS-1$ cal.add(Calendar.WEEK_OF_YEAR, -number); - else if ("day".equals(parts[i + 1]) || "days".equals(parts[i + 1])) + else if ("day".equals(parts[i + 1]) || "days".equals(parts[i + 1])) //$NON-NLS-1$ //$NON-NLS-2$ cal.add(Calendar.DATE, -number); - else if ("hour".equals(parts[i + 1]) - || "hours".equals(parts[i + 1])) + else if ("hour".equals(parts[i + 1]) //$NON-NLS-1$ + || "hours".equals(parts[i + 1])) //$NON-NLS-1$ cal.add(Calendar.HOUR_OF_DAY, -number); - else if ("minute".equals(parts[i + 1]) - || "minutes".equals(parts[i + 1])) + else if ("minute".equals(parts[i + 1]) //$NON-NLS-1$ + || "minutes".equals(parts[i + 1])) //$NON-NLS-1$ cal.add(Calendar.MINUTE, -number); - else if ("second".equals(parts[i + 1]) - || "seconds".equals(parts[i + 1])) + else if ("second".equals(parts[i + 1]) //$NON-NLS-1$ + || "seconds".equals(parts[i + 1])) //$NON-NLS-1$ cal.add(Calendar.SECOND, -number); else return null; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java index 3cddc0d0d5..0c41e945da 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java @@ -60,76 +60,76 @@ import org.eclipse.jgit.internal.JGitText; /** Extra utilities to support usage of HTTP. */ public class HttpSupport { /** The {@code GET} HTTP method. */ - public static final String METHOD_GET = "GET"; + public static final String METHOD_GET = "GET"; //$NON-NLS-1$ /** The {@code POST} HTTP method. */ - public static final String METHOD_POST = "POST"; + public static final String METHOD_POST = "POST"; //$NON-NLS-1$ /** The {@code Cache-Control} header. */ - public static final String HDR_CACHE_CONTROL = "Cache-Control"; + public static final String HDR_CACHE_CONTROL = "Cache-Control"; //$NON-NLS-1$ /** The {@code Pragma} header. */ - public static final String HDR_PRAGMA = "Pragma"; + public static final String HDR_PRAGMA = "Pragma"; //$NON-NLS-1$ /** The {@code User-Agent} header. */ - public static final String HDR_USER_AGENT = "User-Agent"; + public static final String HDR_USER_AGENT = "User-Agent"; //$NON-NLS-1$ /** The {@code Date} header. */ - public static final String HDR_DATE = "Date"; + public static final String HDR_DATE = "Date"; //$NON-NLS-1$ /** The {@code Expires} header. */ - public static final String HDR_EXPIRES = "Expires"; + public static final String HDR_EXPIRES = "Expires"; //$NON-NLS-1$ /** The {@code ETag} header. */ - public static final String HDR_ETAG = "ETag"; + public static final String HDR_ETAG = "ETag"; //$NON-NLS-1$ /** The {@code If-None-Match} header. */ - public static final String HDR_IF_NONE_MATCH = "If-None-Match"; + public static final String HDR_IF_NONE_MATCH = "If-None-Match"; //$NON-NLS-1$ /** The {@code Last-Modified} header. */ - public static final String HDR_LAST_MODIFIED = "Last-Modified"; + public static final String HDR_LAST_MODIFIED = "Last-Modified"; //$NON-NLS-1$ /** The {@code If-Modified-Since} header. */ - public static final String HDR_IF_MODIFIED_SINCE = "If-Modified-Since"; + public static final String HDR_IF_MODIFIED_SINCE = "If-Modified-Since"; //$NON-NLS-1$ /** The {@code Accept} header. */ - public static final String HDR_ACCEPT = "Accept"; + public static final String HDR_ACCEPT = "Accept"; //$NON-NLS-1$ /** The {@code Content-Type} header. */ - public static final String HDR_CONTENT_TYPE = "Content-Type"; + public static final String HDR_CONTENT_TYPE = "Content-Type"; //$NON-NLS-1$ /** The {@code Content-Length} header. */ - public static final String HDR_CONTENT_LENGTH = "Content-Length"; + public static final String HDR_CONTENT_LENGTH = "Content-Length"; //$NON-NLS-1$ /** The {@code Content-Encoding} header. */ - public static final String HDR_CONTENT_ENCODING = "Content-Encoding"; + public static final String HDR_CONTENT_ENCODING = "Content-Encoding"; //$NON-NLS-1$ /** The {@code Content-Range} header. */ - public static final String HDR_CONTENT_RANGE = "Content-Range"; + public static final String HDR_CONTENT_RANGE = "Content-Range"; //$NON-NLS-1$ /** The {@code Accept-Ranges} header. */ - public static final String HDR_ACCEPT_RANGES = "Accept-Ranges"; + public static final String HDR_ACCEPT_RANGES = "Accept-Ranges"; //$NON-NLS-1$ /** The {@code If-Range} header. */ - public static final String HDR_IF_RANGE = "If-Range"; + public static final String HDR_IF_RANGE = "If-Range"; //$NON-NLS-1$ /** The {@code Range} header. */ - public static final String HDR_RANGE = "Range"; + public static final String HDR_RANGE = "Range"; //$NON-NLS-1$ /** The {@code Accept-Encoding} header. */ - public static final String HDR_ACCEPT_ENCODING = "Accept-Encoding"; + public static final String HDR_ACCEPT_ENCODING = "Accept-Encoding"; //$NON-NLS-1$ /** The {@code gzip} encoding value for {@link #HDR_ACCEPT_ENCODING}. */ - public static final String ENCODING_GZIP = "gzip"; + public static final String ENCODING_GZIP = "gzip"; //$NON-NLS-1$ /** The standard {@code text/plain} MIME type. */ - public static final String TEXT_PLAIN = "text/plain"; + public static final String TEXT_PLAIN = "text/plain"; //$NON-NLS-1$ /** The {@code Authorization} header. */ - public static final String HDR_AUTHORIZATION = "Authorization"; + public static final String HDR_AUTHORIZATION = "Authorization"; //$NON-NLS-1$ /** The {@code WWW-Authenticate} header. */ - public static final String HDR_WWW_AUTHENTICATE = "WWW-Authenticate"; + public static final String HDR_WWW_AUTHENTICATE = "WWW-Authenticate"; //$NON-NLS-1$ /** * URL encode a value string into an output buffer. @@ -143,7 +143,7 @@ public class HttpSupport { if (key == null || key.length() == 0) return; try { - urlstr.append(URLEncoder.encode(key, "UTF-8")); + urlstr.append(URLEncoder.encode(key, "UTF-8")); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { throw new RuntimeException(JGitText.get().couldNotURLEncodeToUTF8, e); } @@ -171,7 +171,7 @@ public class HttpSupport { // if ("Connection timed out: connect".equals(ce.getMessage())) throw new ConnectException(MessageFormat.format(JGitText.get().connectionTimeOut, host)); - throw new ConnectException(ce.getMessage() + " " + host); + throw new ConnectException(ce.getMessage() + " " + host); //$NON-NLS-1$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java index 510032eeb0..3161b51ae0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java @@ -143,7 +143,7 @@ public class IntList { r.append('['); for (int i = 0; i < count; i++) { if (i > 0) - r.append(", "); + r.append(", "); //$NON-NLS-1$ r.append(entries[i]); } r.append(']'); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java index e3aeb83a7e..d62203c447 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java @@ -164,7 +164,7 @@ public class LongList { r.append('['); for (int i = 0; i < count; i++) { if (i > 0) - r.append(", "); + r.append(", "); //$NON-NLS-1$ r.append(entries[i]); } r.append(']'); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java index f920af6116..57dfb85903 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java @@ -187,14 +187,14 @@ public abstract class QuotedString { public static class BourneUserPathStyle extends BourneStyle { @Override public String quote(final String in) { - if (in.matches("^~[A-Za-z0-9_-]+$")) { + if (in.matches("^~[A-Za-z0-9_-]+$")) { //$NON-NLS-1$ // If the string is just "~user" we can assume they // mean "~user/". // - return in + "/"; + return in + "/"; //$NON-NLS-1$ } - if (in.matches("^~[A-Za-z0-9_-]*/.*$")) { + if (in.matches("^~[A-Za-z0-9_-]*/.*$")) { //$NON-NLS-1$ // If the string is of "~/path" or "~user/path" // we must not escape ~/ or ~user/ from the shell. // @@ -255,7 +255,7 @@ public abstract class QuotedString { @Override public String quote(final String instr) { if (instr.length() == 0) - return "\"\""; + return "\"\""; //$NON-NLS-1$ boolean reuse = true; final byte[] in = Constants.encode(instr); final StringBuilder r = new StringBuilder(2 + in.length); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java index c20474d11c..9114d500ee 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java @@ -70,7 +70,7 @@ public final class RawParseUtils { * * @since 2.2 */ - public static final Charset UTF8_CHARSET = Charset.forName("UTF-8"); + public static final Charset UTF8_CHARSET = Charset.forName("UTF-8"); //$NON-NLS-1$ private static final byte[] digits10; @@ -82,7 +82,7 @@ public final class RawParseUtils { static { encodingAliases = new HashMap<String, Charset>(); - encodingAliases.put("latin-1", Charset.forName("ISO-8859-1")); + encodingAliases.put("latin-1", Charset.forName("ISO-8859-1")); //$NON-NLS-1$ //$NON-NLS-2$ digits10 = new byte['9' + 1]; Arrays.fill(digits10, (byte) -1); @@ -779,7 +779,7 @@ public final class RawParseUtils { if (emailE < stop) { email = decode(raw, emailB, emailE - 1); } else { - email = "invalid"; + email = "invalid"; //$NON-NLS-1$ } if (emailB < stop) name = decode(raw, nameB, emailB - 2); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java index 45b065999c..4695111de9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java @@ -306,7 +306,7 @@ public class RefList<T extends Ref> implements Iterable<Ref> { if (cnt > 0) { r.append(list[0]); for (int i = 1; i < cnt; i++) { - r.append(", "); + r.append(", "); //$NON-NLS-1$ r.append(list[i]); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java index 763a9f3a47..5cc7e92c52 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java @@ -111,7 +111,7 @@ public class RefMap extends AbstractMap<String, Ref> { /** Construct an empty map with a small initial capacity. */ public RefMap() { - prefix = ""; + prefix = ""; //$NON-NLS-1$ packed = RefList.emptyList(); loose = RefList.emptyList(); resolved = RefList.emptyList(); @@ -267,7 +267,7 @@ public class RefMap extends AbstractMap<String, Ref> { if (first) first = false; else - r.append(", "); + r.append(", "); //$NON-NLS-1$ r.append(ref); } r.append(']'); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java index efb9abd878..cb4895025d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java @@ -208,15 +208,15 @@ public final class StringUtils { if (stringValue == null) return null; - if (equalsIgnoreCase("yes", stringValue) - || equalsIgnoreCase("true", stringValue) - || equalsIgnoreCase("1", stringValue) - || equalsIgnoreCase("on", stringValue)) + if (equalsIgnoreCase("yes", stringValue) //$NON-NLS-1$ + || equalsIgnoreCase("true", stringValue) //$NON-NLS-1$ + || equalsIgnoreCase("1", stringValue) //$NON-NLS-1$ + || equalsIgnoreCase("on", stringValue)) //$NON-NLS-1$ return Boolean.TRUE; - else if (equalsIgnoreCase("no", stringValue) - || equalsIgnoreCase("false", stringValue) - || equalsIgnoreCase("0", stringValue) - || equalsIgnoreCase("off", stringValue)) + else if (equalsIgnoreCase("no", stringValue) //$NON-NLS-1$ + || equalsIgnoreCase("false", stringValue) //$NON-NLS-1$ + || equalsIgnoreCase("0", stringValue) //$NON-NLS-1$ + || equalsIgnoreCase("off", stringValue)) //$NON-NLS-1$ return Boolean.FALSE; else return null; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java index e9d9953f4d..f0db580afe 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java @@ -93,14 +93,14 @@ public abstract class SystemReader { } }; } - File etc = fs.resolve(prefix, "etc"); - File config = fs.resolve(etc, "gitconfig"); + File etc = fs.resolve(prefix, "etc"); //$NON-NLS-1$ + File config = fs.resolve(etc, "gitconfig"); //$NON-NLS-1$ return new FileBasedConfig(parent, config, fs); } public FileBasedConfig openUserConfig(Config parent, FS fs) { final File home = fs.userHome(); - return new FileBasedConfig(parent, new File(home, ".gitconfig"), fs); + return new FileBasedConfig(parent, new File(home, ".gitconfig"), fs); //$NON-NLS-1$ } public String getHostname() { @@ -110,7 +110,7 @@ public abstract class SystemReader { hostname = localMachine.getCanonicalHostName(); } catch (UnknownHostException e) { // we do nothing - hostname = "localhost"; + hostname = "localhost"; //$NON-NLS-1$ } assert hostname != null; } @@ -251,10 +251,10 @@ public abstract class SystemReader { String osDotName = AccessController .doPrivileged(new PrivilegedAction<String>() { public String run() { - return getProperty("os.name"); + return getProperty("os.name"); //$NON-NLS-1$ } }); - return osDotName.startsWith("Windows"); + return osDotName.startsWith("Windows"); //$NON-NLS-1$ } /** @@ -264,10 +264,10 @@ public abstract class SystemReader { String osDotName = AccessController .doPrivileged(new PrivilegedAction<String>() { public String run() { - return getProperty("os.name"); + return getProperty("os.name"); //$NON-NLS-1$ } }); - return "Mac OS X".equals(osDotName) || "Darwin".equals(osDotName); + return "Mac OS X".equals(osDotName) || "Darwin".equals(osDotName); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java index 5c56a166a9..88c32d2f53 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java @@ -408,7 +408,7 @@ public abstract class TemporaryBuffer extends OutputStream { } protected OutputStream overflow() throws IOException { - onDiskFile = File.createTempFile("jgit_", ".buf", directory); + onDiskFile = File.createTempFile("jgit_", ".buf", directory); //$NON-NLS-1$ //$NON-NLS-2$ return new FileOutputStream(onDiskFile); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java index 352e237247..0e58c4b60f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java @@ -90,7 +90,7 @@ public final class InterruptTimer { /** Create a new timer with a default thread name. */ public InterruptTimer() { - this("JGit-InterruptTimer"); + this("JGit-InterruptTimer"); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java index 9129ece097..24b8b53330 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java @@ -69,7 +69,7 @@ public class StreamCopyThread extends Thread { * closed when the thread terminates. */ public StreamCopyThread(final InputStream i, final OutputStream o) { - setName(Thread.currentThread().getName() + "-StreamCopy"); + setName(Thread.currentThread().getName() + "-StreamCopy"); //$NON-NLS-1$ src = i; dst = o; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/ThrowingPrintWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/ThrowingPrintWriter.java index e4a8fc080e..c34c1fb681 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/ThrowingPrintWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/ThrowingPrintWriter.java @@ -70,7 +70,7 @@ public class ThrowingPrintWriter extends Writer { this.out = out; LF = AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { - return SystemReader.getInstance().getProperty("line.separator"); + return SystemReader.getInstance().getProperty("line.separator"); //$NON-NLS-1$ } }); } |