Browse Source

PushCertificateParser: Fix check for blank line after header

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
stable-4.0
Shawn Pearce 10 years ago
parent
commit
ce3997344e
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateParser.java

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

@ -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$

Loading…
Cancel
Save