Inconsistent String Comparisons, Applied patch for framework base classes.
Thanks Devanshu Vyas for your contribution (OFBIZ-9254) git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812255 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -423,7 +423,7 @@ public class HttpClient {
|
||||
}
|
||||
|
||||
// Append the arguments to the query string if GET.
|
||||
if (method.equalsIgnoreCase("get") && arguments != null) {
|
||||
if ("get".equalsIgnoreCase(method) && arguments != null) {
|
||||
if (url.contains("?")) {
|
||||
url = url + "&" + arguments;
|
||||
} else {
|
||||
@@ -458,7 +458,7 @@ public class HttpClient {
|
||||
con.setRequestProperty("Connection", "Keep-Alive");
|
||||
}
|
||||
|
||||
if (method.equalsIgnoreCase("post")) {
|
||||
if ("post".equalsIgnoreCase(method)) {
|
||||
if (contentType == null) {
|
||||
con.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
|
||||
}
|
||||
@@ -481,7 +481,7 @@ public class HttpClient {
|
||||
}
|
||||
}
|
||||
|
||||
if (method.equalsIgnoreCase("post")) {
|
||||
if ("post".equalsIgnoreCase(method)) {
|
||||
try (
|
||||
OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream(),
|
||||
this.streamCharset != null ? this.streamCharset : "UTF-8")) {
|
||||
|
||||
@@ -299,16 +299,16 @@ public final class SSLUtil {
|
||||
String proxyHost = UtilProperties.getPropertyValue("jsse", "https.proxyHost", "NONE");
|
||||
String proxyPort = UtilProperties.getPropertyValue("jsse", "https.proxyPort", "NONE");
|
||||
String cypher = UtilProperties.getPropertyValue("jsse", "https.cipherSuites", "NONE");
|
||||
if (protocol != null && !protocol.equals("NONE")) {
|
||||
if (protocol != null && !"NONE".equals(protocol)) {
|
||||
System.setProperty("java.protocol.handler.pkgs", protocol);
|
||||
}
|
||||
if (proxyHost != null && !proxyHost.equals("NONE")) {
|
||||
if (proxyHost != null && !"NONE".equals(proxyHost)) {
|
||||
System.setProperty("https.proxyHost", proxyHost);
|
||||
}
|
||||
if (proxyPort != null && !proxyPort.equals("NONE")) {
|
||||
if (proxyPort != null && !"NONE".equals(proxyPort)) {
|
||||
System.setProperty("https.proxyPort", proxyPort);
|
||||
}
|
||||
if (cypher != null && !cypher.equals("NONE")) {
|
||||
if (cypher != null && !"NONE".equals(cypher)) {
|
||||
System.setProperty("https.cipherSuites", cypher);
|
||||
}
|
||||
|
||||
|
||||
@@ -1157,7 +1157,7 @@ public final class UtilHttp {
|
||||
if (key == null || key.length() <= ROW_SUBMIT_PREFIX_LENGTH) continue;
|
||||
if (key.indexOf(MULTI_ROW_DELIMITER) <= 0) continue;
|
||||
if (!key.substring(0, ROW_SUBMIT_PREFIX_LENGTH).equals(ROW_SUBMIT_PREFIX)) continue;
|
||||
if (!entry.getValue().equals("Y"))
|
||||
if (!"Y".equals(entry.getValue()))
|
||||
continue;
|
||||
|
||||
// decode the value of N and create a new map for it
|
||||
|
||||
@@ -248,7 +248,7 @@ public final class UtilIO {
|
||||
|
||||
private static StringBuilder filterLineEndings(StringBuilder sb) {
|
||||
String nl = System.getProperty("line.separator");
|
||||
if (!nl.equals("\n")) {
|
||||
if (!"\n".equals(nl)) {
|
||||
int r = 0;
|
||||
while (r < sb.length()) {
|
||||
int i = sb.indexOf(nl, r);
|
||||
|
||||
@@ -1046,7 +1046,7 @@ public final class UtilValidate {
|
||||
* @return true, if the credit card number is a valid VISA number, false otherwise
|
||||
*/
|
||||
public static boolean isVisa(String cc) {
|
||||
if (((cc.length() == 16) || (cc.length() == 13)) && (cc.substring(0, 1).equals("4")))
|
||||
if (((cc.length() == 16) || (cc.length() == 13)) && ("4".equals(cc.substring(0, 1))))
|
||||
return isCreditCard(cc);
|
||||
return false;
|
||||
}
|
||||
@@ -1108,7 +1108,7 @@ public final class UtilValidate {
|
||||
public static boolean isDiscover(String cc) {
|
||||
String first4digs = cc.substring(0, 4);
|
||||
|
||||
if ((cc.length() == 16) && (first4digs.equals("6011")))
|
||||
if ((cc.length() == 16) && ("6011".equals(first4digs)))
|
||||
return isCreditCard(cc);
|
||||
return false;
|
||||
}
|
||||
@@ -1120,7 +1120,7 @@ public final class UtilValidate {
|
||||
public static boolean isEnRoute(String cc) {
|
||||
String first4digs = cc.substring(0, 4);
|
||||
|
||||
if ((cc.length() == 15) && (first4digs.equals("2014") || first4digs.equals("2149")))
|
||||
if ((cc.length() == 15) && ("2014".equals(first4digs) || "2149".equals(first4digs)))
|
||||
return isCreditCard(cc);
|
||||
return false;
|
||||
}
|
||||
@@ -1133,12 +1133,12 @@ public final class UtilValidate {
|
||||
String first4digs = cc.substring(0, 4);
|
||||
|
||||
if ((cc.length() == 16) &&
|
||||
(first4digs.equals("3088") ||
|
||||
first4digs.equals("3096") ||
|
||||
first4digs.equals("3112") ||
|
||||
first4digs.equals("3158") ||
|
||||
first4digs.equals("3337") ||
|
||||
first4digs.equals("3528")))
|
||||
("3088".equals(first4digs) ||
|
||||
"3096".equals(first4digs) ||
|
||||
"3112".equals(first4digs) ||
|
||||
"3158".equals(first4digs) ||
|
||||
"3337".equals(first4digs) ||
|
||||
"3528".equals(first4digs)))
|
||||
return isCreditCard(cc);
|
||||
return false;
|
||||
}
|
||||
@@ -1152,14 +1152,14 @@ public final class UtilValidate {
|
||||
String first6digs = cc.substring(0, 6);
|
||||
|
||||
if (((cc.length() == 16) || (cc.length() == 18) || (cc.length() == 19)) &&
|
||||
(first4digs.equals("4903") ||
|
||||
first4digs.equals("4905") ||
|
||||
first4digs.equals("4911") ||
|
||||
first4digs.equals("4936") ||
|
||||
first6digs.equals("564182") ||
|
||||
first6digs.equals("633110") ||
|
||||
first4digs.equals("6333") ||
|
||||
first4digs.equals("6759")))
|
||||
("4903".equals(first4digs) ||
|
||||
"4905".equals(first4digs) ||
|
||||
"4911".equals(first4digs) ||
|
||||
"4936".equals(first4digs) ||
|
||||
"564182".equals(first4digs) ||
|
||||
"633110".equals(first4digs) ||
|
||||
"6333".equals(first4digs) ||
|
||||
"6759".equals(first4digs)))
|
||||
return isCreditCard(cc);
|
||||
return false;
|
||||
}
|
||||
@@ -1172,7 +1172,7 @@ public final class UtilValidate {
|
||||
String first4digs = cc.substring(0, 4);
|
||||
String first2digs = cc.substring(0, 2);
|
||||
if (((cc.length() == 16) || (cc.length() == 18) || (cc.length() == 19)) &&
|
||||
(first2digs.equals("63") || first4digs.equals("6767")))
|
||||
("63".equals(first2digs) || "6767".equals(first4digs)))
|
||||
return isCreditCard(cc);
|
||||
return false;
|
||||
}
|
||||
@@ -1186,12 +1186,12 @@ public final class UtilValidate {
|
||||
String first4digs = cc.substring(0, 4);
|
||||
|
||||
if ((cc.length() == 16) &&
|
||||
(first6digs.equals("417500") ||
|
||||
first4digs.equals("4917") ||
|
||||
first4digs.equals("4913") ||
|
||||
first4digs.equals("4508") ||
|
||||
first4digs.equals("4844") ||
|
||||
first4digs.equals("4027")))
|
||||
("417500".equals(first6digs) ||
|
||||
"4917".equals(first6digs) ||
|
||||
"4913".equals(first6digs) ||
|
||||
"4508".equals(first6digs) ||
|
||||
"4844".equals(first6digs) ||
|
||||
"4027".equals(first6digs)))
|
||||
return isCreditCard(cc);
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ public class FlexibleStringExpanderTests extends TestCase {
|
||||
@Override
|
||||
public void setUp() {
|
||||
wasVerbose = Debug.isOn(Debug.VERBOSE);
|
||||
if (getName().equals("testWithVerbosity")) {
|
||||
if ("testWithVerbosity".equals(getName())) {
|
||||
Debug.set(Debug.VERBOSE, true);
|
||||
}
|
||||
Converters.registerConverter(new SpecialNumberToString());
|
||||
|
||||
Reference in New Issue
Block a user