Author: mthl
Date: Sat Mar  2 17:26:25 2019
New Revision: 1854658

URL: http://svn.apache.org/viewvc?rev=1854658&view=rev
Log:
Improved: Rewrite ‘AbstractEngine#getLocation’ (OFBIZ-10809)

The AbstractEngine#getLocation method is now documented and rewritten
using a single statement.

Modified:
    
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java

Modified: 
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java?rev=1854658&r1=1854657&r2=1854658&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java
 Sat Mar  2 17:26:25 2019
@@ -65,12 +65,15 @@ public abstract class AbstractEngine imp
         return Collections.unmodifiableMap(tmpMap);
     }
 
-    // uses the lookup map to determine if the location has been aliased by a 
service-location element in serviceengine.xml
+    /**
+     * Looks for location aliases which are set by {@code service-location} 
elements
+     * inside the {@code serviceengine.xml} configuration file.
+     *
+     * @param model  the object representing a service
+     * @return the actual location where to find the service implementation
+     */
     protected String getLocation(ModelService model) {
-        if (locationMap.containsKey(model.location)) {
-            return locationMap.get(model.location);
-        }
-        return model.location;
+        return locationMap.getOrDefault(model.location, model.location);
     }
 
     @Override


Reply via email to