[ofbiz-plugins] branch trunk updated: Improved: Fix Literals comparisons with variable to avoid NPE (OFBIZ-11929)

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

[ofbiz-plugins] branch trunk updated: Improved: Fix Literals comparisons with variable to avoid NPE (OFBIZ-11929)

akashjain
This is an automated email from the ASF dual-hosted git repository.

akashjain pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3b9fbff  Improved: Fix Literals comparisons with variable to avoid NPE (OFBIZ-11929)
3b9fbff is described below

commit 3b9fbffc6df1169e60aee35eda87d619b417aa5f
Author: Akash Jain <[hidden email]>
AuthorDate: Sun Aug 30 17:22:44 2020 +0530

    Improved: Fix Literals comparisons with variable to avoid NPE (OFBIZ-11929)
   
    Thanks, Devanshu Vyas for your contribution.
---
 ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java       | 2 +-
 ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java    | 2 +-
 .../src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java      | 4 ++--
 .../activedirectory/OFBizActiveDirectoryAuthenticationHandler.java    | 2 +-
 .../src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java   | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java b/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java
index a7b64c9..5d2a1a9 100644
--- a/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java
+++ b/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java
@@ -1215,7 +1215,7 @@ public class EbayOrderServices {
 
                     contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx);
                     String emailBuyer = (String) context.get("emailBuyer");
-                    if (!(emailBuyer.equals("") || "Invalid Request".equalsIgnoreCase(emailBuyer))) {
+                    if (!("".equals(emailBuyer) || "Invalid Request".equalsIgnoreCase(emailBuyer))) {
                         EbayHelper.setEmailContactMech(dispatcher, delegator, party, userLogin, context);
                     }
                     EbayHelper.setPhoneContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx);
diff --git a/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java b/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java
index 7a4aab8..6ac52ef 100755
--- a/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java
+++ b/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java
@@ -767,7 +767,7 @@ public class ImportOrdersFromEbay {
 
                     contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, parameters);
                     String emailBuyer = (String) parameters.get("emailBuyer");
-                    if (!(emailBuyer.equals("") || "Invalid Request".equalsIgnoreCase(emailBuyer))) {
+                    if (!("".equals(emailBuyer) || "Invalid Request".equalsIgnoreCase(emailBuyer))) {
                         EbayHelper.setEmailContactMech(dispatcher, delegator, party, userLogin, parameters);
                     }
                     EbayHelper.setPhoneContactMech(dispatcher, delegator, party, userLogin, parameters);
diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java
index 641f362..9f9292c 100644
--- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java
+++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java
@@ -229,7 +229,7 @@ public class EbayStoreOrder {
 
                     contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, context);
                     String emailBuyer = context.get("emailBuyer").toString();
-                    if (!(emailBuyer.equals("") || "Invalid Request".equalsIgnoreCase(emailBuyer))) {
+                    if (!("".equals(emailBuyer) || "Invalid Request".equalsIgnoreCase(emailBuyer))) {
                         EbayHelper.setEmailContactMech(dispatcher, delegator, party, userLogin, context);
                     }
                     EbayHelper.setPhoneContactMech(dispatcher, delegator, party, userLogin, context);
@@ -462,7 +462,7 @@ public class EbayStoreOrder {
 
                 contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx);
                 String emailBuyer = (String) context.get("emailBuyer");
-                if (!(emailBuyer.equals("") || "Invalid Request".equalsIgnoreCase(emailBuyer))) {
+                if (!("".equals(emailBuyer) || "Invalid Request".equalsIgnoreCase(emailBuyer))) {
                     EbayHelper.setEmailContactMech(dispatcher, delegator, party, userLogin, context);
                 }
                 EbayHelper.setPhoneContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx);
diff --git a/ldap/src/main/java/org/apache/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java b/ldap/src/main/java/org/apache/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java
index cfc013a..6377154 100644
--- a/ldap/src/main/java/org/apache/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java
+++ b/ldap/src/main/java/org/apache/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java
@@ -62,7 +62,7 @@ public final class OFBizActiveDirectoryAuthenticationHandler extends AbstractOFB
         Hashtable<String, String> env = new Hashtable<>();
         env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
         env.put(Context.PROVIDER_URL, ldapURL);
-        if (searchType == null || searchType.trim().equals("")) {
+        if (searchType == null || "".equals(searchType.trim())) {
             env.put(Context.SECURITY_AUTHENTICATION, "none");
         } else if ("login".equals(searchType.trim())) {
             env.put(Context.SECURITY_AUTHENTICATION, authenType);
diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java b/pricat/src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java
index 0cc33ac..d9e701a 100644
--- a/pricat/src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java
+++ b/pricat/src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java
@@ -38,7 +38,7 @@ public final class OFBizPricatUtil {
     static {
         Method[] methods = XSSFSheet.class.getDeclaredMethods();
         for (Method method : methods) {
-            if (method.getName().equals("getVMLDrawing")) {
+            if ("getVMLDrawing".equals(method.getName())) {
                 vmlDrawingMethod = method;
                 break;
             }
@@ -46,7 +46,7 @@ public final class OFBizPricatUtil {
         // for POI 4.0.0 and later, this part can be removed
         methods = XSSFVMLDrawing.class.getDeclaredMethods();
         for (Method method : methods) {
-            if (method.getName().equals("findCommentShape")) {
+            if ("findCommentShape".equals(method.getName())) {
                 findCommentShapeMethod = method;
                 break;
             }