mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-23 06:35:17 +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");
|
byte[] reasonBytes = reason.getBytes("UTF-8");
|
||||||
stream.write(new VarInt(reasonBytes.length).encode());
|
stream.write(new VarInt(reasonBytes.length).encode());
|
||||||
stream.write(reasonBytes);
|
stream.write(reasonBytes);
|
||||||
if (message.equals("block") || message.equals("tx"))
|
if ("block".equals(message) || "tx".equals(message))
|
||||||
stream.write(messageHash.getReversedBytes());
|
stream.write(messageHash.getReversedBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class PaymentProtocol {
|
||||||
final Protos.PaymentRequest paymentRequestToSign = paymentRequest.build();
|
final Protos.PaymentRequest paymentRequestToSign = paymentRequest.build();
|
||||||
|
|
||||||
final String algorithm;
|
final String algorithm;
|
||||||
if (privateKey.getAlgorithm().equalsIgnoreCase("RSA"))
|
if ("RSA".equalsIgnoreCase(privateKey.getAlgorithm()))
|
||||||
algorithm = "SHA256withRSA";
|
algorithm = "SHA256withRSA";
|
||||||
else
|
else
|
||||||
throw new IllegalStateException(privateKey.getAlgorithm());
|
throw new IllegalStateException(privateKey.getAlgorithm());
|
||||||
|
@ -166,14 +166,14 @@ public class PaymentProtocol {
|
||||||
List<X509Certificate> certs = null;
|
List<X509Certificate> certs = null;
|
||||||
try {
|
try {
|
||||||
final String pkiType = paymentRequest.getPkiType();
|
final String pkiType = paymentRequest.getPkiType();
|
||||||
if (pkiType.equals("none"))
|
if ("none".equals(pkiType))
|
||||||
// Nothing to verify. Everything is fine. Move along.
|
// Nothing to verify. Everything is fine. Move along.
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
String algorithm;
|
String algorithm;
|
||||||
if (pkiType.equals("x509+sha256"))
|
if ("x509+sha256".equals(pkiType))
|
||||||
algorithm = "SHA256withRSA";
|
algorithm = "SHA256withRSA";
|
||||||
else if (pkiType.equals("x509+sha1"))
|
else if ("x509+sha1".equals(pkiType))
|
||||||
algorithm = "SHA1withRSA";
|
algorithm = "SHA1withRSA";
|
||||||
else
|
else
|
||||||
throw new PaymentProtocolException.InvalidPkiType("Unsupported PKI type: " + pkiType);
|
throw new PaymentProtocolException.InvalidPkiType("Unsupported PKI type: " + pkiType);
|
||||||
|
|
|
@ -55,9 +55,9 @@ public class PaymentProtocolTool {
|
||||||
Protos.PaymentRequest request = Protos.PaymentRequest.parseFrom(stream);
|
Protos.PaymentRequest request = Protos.PaymentRequest.parseFrom(stream);
|
||||||
stream.close();
|
stream.close();
|
||||||
session = new PaymentSession(request);
|
session = new PaymentSession(request);
|
||||||
} else if (uri.getScheme().equals("http")) {
|
} else if ("http".equals(uri.getScheme())) {
|
||||||
session = PaymentSession.createFromUrl(arg).get();
|
session = PaymentSession.createFromUrl(arg).get();
|
||||||
} else if (uri.getScheme().equals("bitcoin")) {
|
} else if ("bitcoin".equals(uri.getScheme())) {
|
||||||
BitcoinURI bcuri = new BitcoinURI(arg);
|
BitcoinURI bcuri = new BitcoinURI(arg);
|
||||||
final String paymentRequestUrl = bcuri.getPaymentRequestUrl();
|
final String paymentRequestUrl = bcuri.getPaymentRequestUrl();
|
||||||
if (paymentRequestUrl == null) {
|
if (paymentRequestUrl == null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue