diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index 55a7766f6..356d9d82e 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -1235,7 +1235,7 @@ public class TestRepository implements AutoCloseable { firstParentId = parents.get(0); ObjectId cid; - if (changeId.equals("")) + if (changeId.isEmpty()) cid = ChangeIdUtil.computeChangeId(c.getTreeId(), firstParentId, c.getAuthor(), c.getCommitter(), message); else diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java index 0d1894b64..a830ff284 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java @@ -214,7 +214,7 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase { protected void assertStringArrayEquals(String expected, String[] actual) { // if there is more than one line, ignore last one if empty assertEquals(1, - actual.length > 1 && actual[actual.length - 1].equals("") + actual.length > 1 && actual[actual.length - 1].isEmpty() ? actual.length - 1 : actual.length); assertEquals(expected, actual[0]); } 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 3858b3dd0..8794ca6cb 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 @@ -295,14 +295,14 @@ class Blame extends TextBuiltin { } } - if (beginStr.equals("")) //$NON-NLS-1$ + if (beginStr.isEmpty()) begin = 0; else if (beginStr.startsWith("/")) //$NON-NLS-1$ begin = findLine(0, beginStr); else begin = Math.max(0, Integer.parseInt(beginStr) - 1); - if (endStr.equals("")) //$NON-NLS-1$ + if (endStr.isEmpty()) end = blame.getResultContents().size(); else if (endStr.startsWith("/")) //$NON-NLS-1$ end = findLine(begin, endStr); 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 c7e4bad94..0373aeff5 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 @@ -390,7 +390,7 @@ public class Main { if (s == null && protocol.equals("https")) { //$NON-NLS-1$ s = System.getenv("HTTPS_PROXY"); //$NON-NLS-1$ } - if (s == null || s.equals("")) { //$NON-NLS-1$ + if (s == null || s.isEmpty()) { continue; } 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 dfc8a9436..8b187587b 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 @@ -282,7 +282,7 @@ class Status extends TextBuiltin { if (!porcelain) { outw.println(CLIText.formatLine(MessageFormat.format(pattern, arguments))); - if (!pattern.equals("")) //$NON-NLS-1$ + if (!pattern.isEmpty()) outw.println(CLIText.formatLine("")); //$NON-NLS-1$ outw.flush(); } 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 625ddf101..30f247b83 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -608,7 +608,7 @@ public abstract class Repository implements AutoCloseable { if (!(rev instanceof RevBlob)) throw new IncorrectObjectTypeException(rev, Constants.TYPE_BLOB); - } else if (item.equals("")) { //$NON-NLS-1$ + } else if (item.isEmpty()) { rev = rw.peel(rev); } else throw new RevisionSyntaxException(revstr); @@ -709,7 +709,7 @@ public abstract class Repository implements AutoCloseable { if (time.equals("upstream")) { //$NON-NLS-1$ if (name == null) name = new String(revChars, done, i); - if (name.equals("")) //$NON-NLS-1$ + if (name.isEmpty()) // Currently checked out branch, HEAD if // detached name = Constants.HEAD; @@ -764,7 +764,7 @@ public abstract class Repository implements AutoCloseable { } else { if (name == null) name = new String(revChars, done, i); - if (name.equals("")) //$NON-NLS-1$ + if (name.isEmpty()) name = Constants.HEAD; if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ throw new RevisionSyntaxException(MessageFormat @@ -790,7 +790,7 @@ public abstract class Repository implements AutoCloseable { if (rev == null) { if (name == null) name = new String(revChars, done, i); - if (name.equals("")) //$NON-NLS-1$ + if (name.isEmpty()) name = Constants.HEAD; rev = parseSimple(rw, name); name = null;