]> source.dussan.org Git - jgit.git/commitdiff
PushCertificateParser: Fix check for blank line after header 92/43492/1
authorShawn Pearce <spearce@spearce.org>
Tue, 10 Mar 2015 00:30:08 +0000 (17:30 -0700)
committerShawn Pearce <spearce@spearce.org>
Tue, 10 Mar 2015 00:30:08 +0000 (17:30 -0700)
Reference equality (!= or ==) cannot be used to check for
String equality. String objects are not necessarily interned
to the same instance.

Use .isEmpty() since the function only cares about an empty
string and does not need to test a specific string value.

Change-Id: If530cb59666a8196d57d2348c893706a517ea541

org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateParser.java

index d4b11a5d40ffa5637ca82e83216001c093d9ef1f..4bb3d6bf82769443afba528196dc5ce5d4955d78 100644 (file)
@@ -158,7 +158,7 @@ public class PushCertificateParser extends PushCertificate {
                        pushee = parseNextLine(pckIn, PUSHEE);
                        receivedNonce = parseNextLine(pckIn, NONCE);
                        // an empty line
-                       if (pckIn.readString() != "") { //$NON-NLS-1$
+                       if (!pckIn.readString().isEmpty()) {
                                throw new IOException(MessageFormat.format(
                                                JGitText.get().errorInvalidPushCert,
                                                "expected empty line after header")); //$NON-NLS-1$