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 <carsten.hammer@t-online.de> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
e876a70ede
commit
0db509f7e7
|
@ -1235,7 +1235,7 @@ private void insertChangeId(org.eclipse.jgit.lib.CommitBuilder c) {
|
||||||
firstParentId = parents.get(0);
|
firstParentId = parents.get(0);
|
||||||
|
|
||||||
ObjectId cid;
|
ObjectId cid;
|
||||||
if (changeId.equals(""))
|
if (changeId.isEmpty())
|
||||||
cid = ChangeIdUtil.computeChangeId(c.getTreeId(), firstParentId,
|
cid = ChangeIdUtil.computeChangeId(c.getTreeId(), firstParentId,
|
||||||
c.getAuthor(), c.getCommitter(), message);
|
c.getAuthor(), c.getCommitter(), message);
|
||||||
else
|
else
|
||||||
|
|
|
@ -214,7 +214,7 @@ protected String escapeJava(String line) {
|
||||||
protected void assertStringArrayEquals(String expected, String[] actual) {
|
protected void assertStringArrayEquals(String expected, String[] actual) {
|
||||||
// if there is more than one line, ignore last one if empty
|
// if there is more than one line, ignore last one if empty
|
||||||
assertEquals(1,
|
assertEquals(1,
|
||||||
actual.length > 1 && actual[actual.length - 1].equals("")
|
actual.length > 1 && actual[actual.length - 1].isEmpty()
|
||||||
? actual.length - 1 : actual.length);
|
? actual.length - 1 : actual.length);
|
||||||
assertEquals(expected, actual[0]);
|
assertEquals(expected, actual[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,14 +295,14 @@ private void parseLineRangeOption() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beginStr.equals("")) //$NON-NLS-1$
|
if (beginStr.isEmpty())
|
||||||
begin = 0;
|
begin = 0;
|
||||||
else if (beginStr.startsWith("/")) //$NON-NLS-1$
|
else if (beginStr.startsWith("/")) //$NON-NLS-1$
|
||||||
begin = findLine(0, beginStr);
|
begin = findLine(0, beginStr);
|
||||||
else
|
else
|
||||||
begin = Math.max(0, Integer.parseInt(beginStr) - 1);
|
begin = Math.max(0, Integer.parseInt(beginStr) - 1);
|
||||||
|
|
||||||
if (endStr.equals("")) //$NON-NLS-1$
|
if (endStr.isEmpty())
|
||||||
end = blame.getResultContents().size();
|
end = blame.getResultContents().size();
|
||||||
else if (endStr.startsWith("/")) //$NON-NLS-1$
|
else if (endStr.startsWith("/")) //$NON-NLS-1$
|
||||||
end = findLine(begin, endStr);
|
end = findLine(begin, endStr);
|
||||||
|
|
|
@ -390,7 +390,7 @@ static void configureHttpProxy() throws MalformedURLException {
|
||||||
if (s == null && protocol.equals("https")) { //$NON-NLS-1$
|
if (s == null && protocol.equals("https")) { //$NON-NLS-1$
|
||||||
s = System.getenv("HTTPS_PROXY"); //$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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ protected void printSectionHeader(String pattern, Object... arguments)
|
||||||
if (!porcelain) {
|
if (!porcelain) {
|
||||||
outw.println(CLIText.formatLine(MessageFormat.format(pattern,
|
outw.println(CLIText.formatLine(MessageFormat.format(pattern,
|
||||||
arguments)));
|
arguments)));
|
||||||
if (!pattern.equals("")) //$NON-NLS-1$
|
if (!pattern.isEmpty())
|
||||||
outw.println(CLIText.formatLine("")); //$NON-NLS-1$
|
outw.println(CLIText.formatLine("")); //$NON-NLS-1$
|
||||||
outw.flush();
|
outw.flush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,7 +608,7 @@ private Object resolve(RevWalk rw, String revstr)
|
||||||
if (!(rev instanceof RevBlob))
|
if (!(rev instanceof RevBlob))
|
||||||
throw new IncorrectObjectTypeException(rev,
|
throw new IncorrectObjectTypeException(rev,
|
||||||
Constants.TYPE_BLOB);
|
Constants.TYPE_BLOB);
|
||||||
} else if (item.equals("")) { //$NON-NLS-1$
|
} else if (item.isEmpty()) {
|
||||||
rev = rw.peel(rev);
|
rev = rw.peel(rev);
|
||||||
} else
|
} else
|
||||||
throw new RevisionSyntaxException(revstr);
|
throw new RevisionSyntaxException(revstr);
|
||||||
|
@ -709,7 +709,7 @@ private Object resolve(RevWalk rw, String revstr)
|
||||||
if (time.equals("upstream")) { //$NON-NLS-1$
|
if (time.equals("upstream")) { //$NON-NLS-1$
|
||||||
if (name == null)
|
if (name == null)
|
||||||
name = new String(revChars, done, i);
|
name = new String(revChars, done, i);
|
||||||
if (name.equals("")) //$NON-NLS-1$
|
if (name.isEmpty())
|
||||||
// Currently checked out branch, HEAD if
|
// Currently checked out branch, HEAD if
|
||||||
// detached
|
// detached
|
||||||
name = Constants.HEAD;
|
name = Constants.HEAD;
|
||||||
|
@ -764,7 +764,7 @@ private Object resolve(RevWalk rw, String revstr)
|
||||||
} else {
|
} else {
|
||||||
if (name == null)
|
if (name == null)
|
||||||
name = new String(revChars, done, i);
|
name = new String(revChars, done, i);
|
||||||
if (name.equals("")) //$NON-NLS-1$
|
if (name.isEmpty())
|
||||||
name = Constants.HEAD;
|
name = Constants.HEAD;
|
||||||
if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$
|
if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$
|
||||||
throw new RevisionSyntaxException(MessageFormat
|
throw new RevisionSyntaxException(MessageFormat
|
||||||
|
@ -790,7 +790,7 @@ private Object resolve(RevWalk rw, String revstr)
|
||||||
if (rev == null) {
|
if (rev == null) {
|
||||||
if (name == null)
|
if (name == null)
|
||||||
name = new String(revChars, done, i);
|
name = new String(revChars, done, i);
|
||||||
if (name.equals("")) //$NON-NLS-1$
|
if (name.isEmpty())
|
||||||
name = Constants.HEAD;
|
name = Constants.HEAD;
|
||||||
rev = parseSimple(rw, name);
|
rev = parseSimple(rw, name);
|
||||||
name = null;
|
name = null;
|
||||||
|
|
Loading…
Reference in New Issue