From 0db509f7e750336923fcee858a7152129dc1a321 Mon Sep 17 00:00:00 2001 From: Carsten Hammer Date: Sat, 6 Apr 2019 19:38:27 +0200 Subject: Use String.isEmpty() instead of comparing to "" Use of String.equals("") can be replaced with with String.length() == 0 (for JDK5 and lower) or String.isEmpty() (for JDK6 and higher) Change-Id: Id1462d22c5d249485d87993263a9239809e73c55 Signed-off-by: Carsten Hammer Signed-off-by: David Pursehouse --- org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'org.eclipse.jgit') 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 625ddf1017..30f247b83a 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; -- cgit v1.2.3