mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-22 22:25:41 +01:00
Strings literals should be placed on the left side when checking for equality
This commit is contained in:
parent
e3e8e8079d
commit
0de458db45
3 changed files with 7 additions and 7 deletions
|
@ -101,7 +101,7 @@ public class RejectMessage extends Message {
|
|||
byte[] reasonBytes = reason.getBytes("UTF-8");
|
||||
stream.write(new VarInt(reasonBytes.length).encode());
|
||||
stream.write(reasonBytes);
|
||||
if (message.equals("block") || message.equals("tx"))
|
||||
if ("block".equals(message) || "tx".equals(message))
|
||||
stream.write(messageHash.getReversedBytes());
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class PaymentProtocol {
|
|||
final Protos.PaymentRequest paymentRequestToSign = paymentRequest.build();
|
||||
|
||||
final String algorithm;
|
||||
if (privateKey.getAlgorithm().equalsIgnoreCase("RSA"))
|
||||
if ("RSA".equalsIgnoreCase(privateKey.getAlgorithm()))
|
||||
algorithm = "SHA256withRSA";
|
||||
else
|
||||
throw new IllegalStateException(privateKey.getAlgorithm());
|
||||
|
@ -166,14 +166,14 @@ public class PaymentProtocol {
|
|||
List<X509Certificate> certs = null;
|
||||
try {
|
||||
final String pkiType = paymentRequest.getPkiType();
|
||||
if (pkiType.equals("none"))
|
||||
if ("none".equals(pkiType))
|
||||
// Nothing to verify. Everything is fine. Move along.
|
||||
return null;
|
||||
|
||||
String algorithm;
|
||||
if (pkiType.equals("x509+sha256"))
|
||||
if ("x509+sha256".equals(pkiType))
|
||||
algorithm = "SHA256withRSA";
|
||||
else if (pkiType.equals("x509+sha1"))
|
||||
else if ("x509+sha1".equals(pkiType))
|
||||
algorithm = "SHA1withRSA";
|
||||
else
|
||||
throw new PaymentProtocolException.InvalidPkiType("Unsupported PKI type: " + pkiType);
|
||||
|
|
|
@ -55,9 +55,9 @@ public class PaymentProtocolTool {
|
|||
Protos.PaymentRequest request = Protos.PaymentRequest.parseFrom(stream);
|
||||
stream.close();
|
||||
session = new PaymentSession(request);
|
||||
} else if (uri.getScheme().equals("http")) {
|
||||
} else if ("http".equals(uri.getScheme())) {
|
||||
session = PaymentSession.createFromUrl(arg).get();
|
||||
} else if (uri.getScheme().equals("bitcoin")) {
|
||||
} else if ("bitcoin".equals(uri.getScheme())) {
|
||||
BitcoinURI bcuri = new BitcoinURI(arg);
|
||||
final String paymentRequestUrl = bcuri.getPaymentRequestUrl();
|
||||
if (paymentRequestUrl == null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue