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 915b9860b..b32f7ab20 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java @@ -524,7 +524,7 @@ public class CommitCommand extends GitCommand { int position = Collections.binarySearch(only, p); if (position >= 0) return position; - int l = p.lastIndexOf("/"); //$NON-NLS-1$ + int l = p.lastIndexOf('/'); if (l < 1) break; p = p.substring(0, l); 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 715d9768d..6eed0b3f6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -833,7 +833,8 @@ public class RebaseCommand extends GitCommand { sb.append("# This is a combination of ").append(count) .append(" commits.\n"); // Add the previous message without header (i.e first line) - sb.append(currSquashMessage.substring(currSquashMessage.indexOf("\n") + 1)); + sb.append(currSquashMessage + .substring(currSquashMessage.indexOf('\n') + 1)); sb.append("\n"); if (isSquash) { sb.append("# This is the ").append(count).append(ordinal) @@ -871,7 +872,7 @@ public class RebaseCommand extends GitCommand { static int parseSquashFixupSequenceCount(String currSquashMessage) { String regex = "This is a combination of (.*) commits"; //$NON-NLS-1$ String firstLine = currSquashMessage.substring(0, - currSquashMessage.indexOf("\n")); //$NON-NLS-1$ + currSquashMessage.indexOf('\n')); Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(firstLine); if (!matcher.find()) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java index a91d8c282..ead99c79c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java @@ -91,7 +91,7 @@ public class AttributesRule { continue; } - final int equalsIndex = attribute.indexOf("="); //$NON-NLS-1$ + final int equalsIndex = attribute.indexOf('='); if (equalsIndex == -1) result.add(new Attribute(attribute, State.SET)); else { 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 d8a05c34e..5c07f88a5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java @@ -335,8 +335,8 @@ class SimilarityRenameDetector { } static int nameScore(String a, String b) { - int aDirLen = a.lastIndexOf("/") + 1; //$NON-NLS-1$ - int bDirLen = b.lastIndexOf("/") + 1; //$NON-NLS-1$ + int aDirLen = a.lastIndexOf('/') + 1; + int bDirLen = b.lastIndexOf('/') + 1; int dirMin = Math.min(aDirLen, bDirLen); int dirMax = Math.max(aDirLen, bDirLen); 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 35ea35ecb..12ade4d19 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java @@ -391,7 +391,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen refNameEnd = refLine.length(); } else if (refLine.startsWith("ng ")) { //$NON-NLS-1$ ok = false; - refNameEnd = refLine.indexOf(" ", 3); //$NON-NLS-1$ + refNameEnd = refLine.indexOf(' ', 3); } if (refNameEnd == -1) throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedReportLine2 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 66f996554..957cb5af6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java @@ -181,7 +181,7 @@ public class ChangeIdUtil { ret.append(CHANGE_ID); ret.append(" I"); //$NON-NLS-1$ ret.append(ObjectId.toString(changeId)); - int indexOfNextLineBreak = message.indexOf("\n", //$NON-NLS-1$ + int indexOfNextLineBreak = message.indexOf('\n', indexOfChangeId); if (indexOfNextLineBreak > 0) ret.append(message.substring(indexOfNextLineBreak));