svn commit: r1812255 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util: HttpClient.java SSLUtil.java UtilHttp.java UtilIO.java UtilValidate.java string/test/FlexibleStringExpanderTests.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1812255 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util: HttpClient.java SSLUtil.java UtilHttp.java UtilIO.java UtilValidate.java string/test/FlexibleStringExpanderTests.java

Deepak Dixit-5
Author: deepak
Date: Mon Oct 16 08:09:25 2017
New Revision: 1812255

URL: http://svn.apache.org/viewvc?rev=1812255&view=rev
Log:
Inconsistent String Comparisons, Applied patch for framework base classes.
Thanks Devanshu Vyas for your contribution (OFBIZ-9254)

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java?rev=1812255&r1=1812254&r2=1812255&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java Mon Oct 16 08:09:25 2017
@@ -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")) {

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java?rev=1812255&r1=1812254&r2=1812255&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java Mon Oct 16 08:09:25 2017
@@ -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);
             }
 

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java?rev=1812255&r1=1812254&r2=1812255&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java Mon Oct 16 08:09:25 2017
@@ -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

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java?rev=1812255&r1=1812254&r2=1812255&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java Mon Oct 16 08:09:25 2017
@@ -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);

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java?rev=1812255&r1=1812254&r2=1812255&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java Mon Oct 16 08:09:25 2017
@@ -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;
     }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java?rev=1812255&r1=1812254&r2=1812255&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java Mon Oct 16 08:09:25 2017
@@ -212,7 +212,7 @@ public class FlexibleStringExpanderTests
     @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());