svn commit: r1828217 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java

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

svn commit: r1828217 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java

jleroux@apache.org
Author: jleroux
Date: Tue Apr  3 10:51:29 2018
New Revision: 1828217

URL: http://svn.apache.org/viewvc?rev=1828217&view=rev
Log:
Improved: EntityUtilProperties
(OFBIZ-7112)

Remove useless redundant code.

results map is already initialised in the beginning with isExistInDb
as "N" and value as "".
These values only changed when systemProperty != null. S
o except for this condition if we return results at any point it will have
isExistInDb as "N" and value as "".
If we remove the lines I removed in the patch, it will only remove put
operations that are not necessary.

Thanks: Aditya

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java?rev=1828217&r1=1828216&r2=1828217&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java Tue Apr  3 10:51:29 2018
@@ -57,8 +57,6 @@ public final class EntityUtilProperties
         results.put("value", "");
 
         if (UtilValidate.isEmpty(resource) || UtilValidate.isEmpty(name)) {
-            results.put("isExistInDb", "N");
-            results.put("value", "");
             return results;
         }
         resource = resource.replace(".properties", "");
@@ -72,12 +70,6 @@ public final class EntityUtilProperties
                 //property exists in database
                 results.put("isExistInDb", "Y");
                 results.put("value", (systemProperty.getString("systemPropertyValue") != null) ? systemProperty.getString("systemPropertyValue") : "");
-                return results;
-            } else {
-                //property does not exists in database
-                results.put("isExistInDb", "N");
-                results.put("value", "");
-                return results;
             }
         } catch (GenericEntityException e) {
             Debug.logError("Could not get a system property for " + name + " : " + e.getMessage(), module);