svn commit: r1811433 - /ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java

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

svn commit: r1811433 - /ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java

mbrohl
Author: mbrohl
Date: Sat Oct  7 14:51:43 2017
New Revision: 1811433

URL: http://svn.apache.org/viewvc?rev=1811433&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.common.preferences.
(OFBIZ-9640)

Thanks Dennis Balkir for reporting and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java?rev=1811433&r1=1811432&r2=1811433&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java Sat Oct  7 14:51:43 2017
@@ -87,7 +87,7 @@ public final class PreferenceWorker {
         if (userLogin != null) {
             String userLoginId = userLogin.getString("userLoginId");
             String userLoginIdArg = (String) context.get(LOGINID_PARAMETER_NAME); // is an optional parameters which defaults to the logged on user
-            if (userLoginIdArg == null || (userLoginIdArg != null && userLoginId.equals(userLoginIdArg))) {
+            if (userLoginIdArg == null || userLoginId.equals(userLoginIdArg)) {
                 hasPermission = true; // users can copy to their own preferences
             } else {
                 Security security = ctx.getSecurity();
@@ -133,7 +133,7 @@ public final class PreferenceWorker {
      * @return user preference map
      */
     public static Map<String, Object> createUserPrefMap(GenericValue rec) throws GeneralException {
-        return addPrefToMap(rec, new LinkedHashMap<String, Object>());
+        return addPrefToMap(rec, new LinkedHashMap<>());
     }
 
     /**
@@ -143,7 +143,7 @@ public final class PreferenceWorker {
      * @return user preference map
      */
     public static Map<String, Object> createUserPrefMap(List<GenericValue> recList) throws GeneralException {
-        Map<String, Object> userPrefMap =  new LinkedHashMap<String, Object>();
+        Map<String, Object> userPrefMap =  new LinkedHashMap<>();
         if (recList != null) {
             for (GenericValue value: recList) {
                 addPrefToMap(value, userPrefMap);