svn commit: r1818540 - /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/

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

svn commit: r1818540 - /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/

mbrohl
Author: mbrohl
Date: Mon Dec 18 09:30:52 2017
New Revision: 1818540

URL: http://svn.apache.org/viewvc?rev=1818540&view=rev
Log:
Improved: General refactoring and code improvements, package
org.apache.ofbiz.service.engine.
(OFBIZ-9934)

Thanks Dennis Balkir for reporting and providing the patches.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SOAPClientEngine.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/ScriptEngine.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SoapSerializer.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/XMLRPCClientEngine.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=1818540&r1=1818539&r2=1818540&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 Mon Dec 18 09:30:52 2017
@@ -49,7 +49,7 @@ public abstract class AbstractEngine imp
 
     // creates the location alias map
     protected static Map<String, String> createLocationMap() {
-        Map<String, String> tmpMap = new HashMap<String, String>();
+        Map<String, String> tmpMap = new HashMap<>();
 
         List<ServiceLocation> locationsList = null;
         try {
@@ -71,16 +71,17 @@ public abstract class AbstractEngine imp
     protected String getLocation(ModelService model) {
         if (locationMap.containsKey(model.location)) {
             return locationMap.get(model.location);
-        } else {
-            return model.location;
         }
+        return model.location;
     }
 
     /**
      * @see org.apache.ofbiz.service.engine.GenericEngine#sendCallbacks(org.apache.ofbiz.service.ModelService, java.util.Map, int)
      */
     public void sendCallbacks(ModelService model, Map<String, Object> context, int mode) throws GenericServiceException {
-        if (!allowCallbacks(model, context, mode)) return;
+        if (!allowCallbacks(model, context, mode)) {
+            return;
+        }
         List<GenericServiceCallback> callbacks = dispatcher.getCallbacks(model.name);
         if (callbacks != null) {
             Iterator<GenericServiceCallback> i = callbacks.iterator();
@@ -96,7 +97,9 @@ public abstract class AbstractEngine imp
     }
 
     public void sendCallbacks(ModelService model, Map<String, Object> context, Throwable t, int mode) throws GenericServiceException {
-        if (!allowCallbacks(model, context, mode)) return;
+        if (!allowCallbacks(model, context, mode)) {
+            return;
+        }
         List<GenericServiceCallback> callbacks = dispatcher.getCallbacks(model.name);
         if (callbacks != null) {
             Iterator<GenericServiceCallback> i = callbacks.iterator();
@@ -112,7 +115,9 @@ public abstract class AbstractEngine imp
     }
 
     public void sendCallbacks(ModelService model, Map<String, Object> context, Map<String, Object> result, int mode) throws GenericServiceException {
-        if (!allowCallbacks(model, context, mode)) return;
+        if (!allowCallbacks(model, context, mode)) {
+            return;
+        }
         List<GenericServiceCallback> callbacks = dispatcher.getCallbacks(model.name);
         if (callbacks != null) {
             Iterator<GenericServiceCallback> i = callbacks.iterator();

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java?rev=1818540&r1=1818539&r2=1818540&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java Mon Dec 18 09:30:52 2017
@@ -92,7 +92,7 @@ public final class EntityAutoEngine exte
             boolean allPksInOnly = true;
             List<String> pkFieldNameOutOnly = null;
             /* Check for each pk if it's :
-             * 1. part IN
+             * 1. part IN
              * 2. or part IN and OUT, but without value but present on parameters map
              * Help the engine to determinate the operation to realize for a create call or validate that
              * any pk is present for update/delete call.
@@ -102,7 +102,7 @@ public final class EntityAutoEngine exte
                 boolean pkValueInParameters = pkParam.isIn() && UtilValidate.isNotEmpty(parameters.get(pkParam.getFieldName()));
                 if (pkParam.isOut() && !pkValueInParameters) {
                     if (pkFieldNameOutOnly == null) {
-                        pkFieldNameOutOnly = new LinkedList<String>();
+                        pkFieldNameOutOnly = new LinkedList<>();
                         allPksInOnly = false;
                     }
                     pkFieldNameOutOnly.add(pkField.getName());
@@ -277,7 +277,7 @@ public final class EntityAutoEngine exte
                 newEntity.setPKFields(parameters, true);
                 String pkFieldName = pkFieldNameOutOnly.get(0);
                 //if it's a fromDate, don't update it now, it's will be done next step
-                if (! "fromDate".equals(pkFieldName)) {
+                if (! "fromDate".equals(pkFieldName)) {
                     String pkValue = dctx.getDelegator().getNextSeqId(modelEntity.getEntityName());
                     newEntity.set(pkFieldName, pkValue);
                 }
@@ -339,7 +339,7 @@ public final class EntityAutoEngine exte
                     if (modelEntity.getField("statusEndDate") != null) {
                         ModelEntity relatedEntity = dctx.getDelegator().getModelEntity(modelEntity.getEntityName().replaceFirst("Status", ""));
                         if (relatedEntity != null) {
-                            Map<String, Object> conditionRelatedPkFieldMap = new HashMap<String, Object>();
+                            Map<String, Object> conditionRelatedPkFieldMap = new HashMap<>();
                             for (String pkRelatedField : relatedEntity.getPkFieldNames()) {
                                 conditionRelatedPkFieldMap.put(pkRelatedField, parameters.get(pkRelatedField));
                             }
@@ -363,7 +363,7 @@ public final class EntityAutoEngine exte
     private static Map<String, Object> invokeUpdate(DispatchContext dctx, Map<String, Object> parameters, ModelService modelService, ModelEntity modelEntity, boolean allPksInOnly)
             throws GeneralException {
         Locale locale = (Locale) parameters.get("locale");
-        Map<String, Object> localContext = new HashMap<String, Object>();
+        Map<String, Object> localContext = new HashMap<>();
         localContext.put("parameters", parameters);
         Map<String, Object> result = ServiceUtil.returnSuccess();
         /*
@@ -517,7 +517,7 @@ public final class EntityAutoEngine exte
     private static Map<String, Object> invokeExpire(DispatchContext dctx, Map<String, Object> parameters, ModelService modelService, ModelEntity modelEntity, boolean allPksInOnly)
             throws GeneralException {
         Locale locale = (Locale) parameters.get("locale");
-        List<String> fieldThruDates = new LinkedList<String>();
+        List<String> fieldThruDates = new LinkedList<>();
         boolean thruDatePresent = false;
         String fieldDateNameIn = null;
 
@@ -544,26 +544,35 @@ public final class EntityAutoEngine exte
             }
         }
 
-        if (Debug.infoOn())
+        if (Debug.infoOn()) {
             Debug.logInfo(" FIELD FOUND : " + fieldDateNameIn + " ## # " + fieldThruDates + " ### " + thruDatePresent, module);
+        }
 
-        if (Debug.infoOn())
+        if (Debug.infoOn()) {
             Debug.logInfo(" parameters IN  : " + parameters, module);
+        }
         // Resolve the field without value to expire and check if the value is present on parameters or use now
         if (fieldDateNameIn != null) {
-            if (parameters.get(fieldDateNameIn) == null) parameters.put(fieldDateNameIn, UtilDateTime.nowTimestamp());
+            if (parameters.get(fieldDateNameIn) == null) {
+                parameters.put(fieldDateNameIn, UtilDateTime.nowTimestamp());
+            }
         } else if (thruDatePresent && UtilValidate.isEmpty(lookedUpValue.getTimestamp("thruDate"))) {
-            if (UtilValidate.isEmpty(parameters.get("thruDate"))) parameters.put("thruDate", UtilDateTime.nowTimestamp());
+            if (UtilValidate.isEmpty(parameters.get("thruDate"))) {
+                parameters.put("thruDate", UtilDateTime.nowTimestamp());
+            }
         } else {
             for (String fieldDateName: fieldThruDates) {
                 if (UtilValidate.isEmpty(lookedUpValue.getTimestamp(fieldDateName))) {
-                    if (UtilValidate.isEmpty(parameters.get(fieldDateName))) parameters.put(fieldDateName, UtilDateTime.nowTimestamp());
+                    if (UtilValidate.isEmpty(parameters.get(fieldDateName))) {
+                        parameters.put(fieldDateName, UtilDateTime.nowTimestamp());
+                    }
                     break;
                 }
             }
         }
-        if (Debug.infoOn())
+        if (Debug.infoOn()) {
             Debug.logInfo(" parameters OUT  : " + parameters, module);
+        }
         Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage("ServiceUiLabels", "EntityExpiredSuccessfully", UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
         return result;
     }

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java?rev=1818540&r1=1818539&r2=1818540&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java Mon Dec 18 09:30:52 2017
@@ -125,7 +125,6 @@ public final class GroovyEngine extends
         } catch (Exception e) {
             // detailMessage can be null.  If it is null, the exception won't be properly returned and logged, and that will
             // make spotting problems very difficult.  Disabling this for now in favor of returning a proper exception.
-            // return ServiceUtil.returnError(e.getMessage());
             throw new GenericServiceException("Error running Groovy method [" + modelService.invoke + "] in Groovy file [" + modelService.location + "]: ", e);
         }
     }

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java?rev=1818540&r1=1818539&r2=1818540&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java Mon Dec 18 09:30:52 2017
@@ -59,7 +59,9 @@ public class HttpEngine extends GenericA
         String xmlContext = null;
 
         try {
-            if (Debug.verboseOn()) Debug.logVerbose("Serializing Context --> " + context, module);
+            if (Debug.verboseOn()) {
+                Debug.logVerbose("Serializing Context --> " + context, module);
+            }
             xmlContext = XmlSerializer.serialize(context);
         } catch (Exception e) {
             throw new GenericServiceException("Cannot serialize context.", e);
@@ -67,8 +69,9 @@ public class HttpEngine extends GenericA
 
         Map<String, Object> parameters = new HashMap<>();
         parameters.put("serviceName", modelService.invoke);
-        if (xmlContext != null)
+        if (xmlContext != null) {
             parameters.put("serviceContext", xmlContext);
+        }
 
         HttpClient http = new HttpClient(this.getLocation(modelService), parameters);
         String postResult = null;
@@ -81,10 +84,11 @@ public class HttpEngine extends GenericA
         Map<String, Object> result = null;
         try {
             Object res = XmlSerializer.deserialize(postResult, dctx.getDelegator());
-            if (res instanceof Map<?, ?>)
+            if (res instanceof Map<?, ?>) {
                 result = UtilGenerics.checkMap(res);
-            else
+            } else {
                 throw new GenericServiceException("Result not an instance of Map.");
+            }
         } catch (Exception e) {
             throw new GenericServiceException("Problems deserializing result.", e);
         }
@@ -117,20 +121,22 @@ public class HttpEngine extends GenericA
         Map<String, Object> result = new HashMap<>();
         Map<String, Object> context = null;
 
-        if (serviceName == null)
+        if (serviceName == null) {
             result.put(ModelService.ERROR_MESSAGE, "Cannot have null service name");
+        }
 
-        if (serviceMode == null)
+        if (serviceMode == null) {
             serviceMode = "SYNC";
+        }
 
         // deserialize the context
         if (!result.containsKey(ModelService.ERROR_MESSAGE)) {
             if (xmlContext != null) {
                 try {
                     Object o = XmlSerializer.deserialize(xmlContext, delegator);
-                    if (o instanceof Map<?, ?>)
+                    if (o instanceof Map<?, ?>) {
                         context = UtilGenerics.checkMap(o);
-                    else {
+                    } else {
                         Debug.logError("Context not an instance of Map error", module);
                         result.put(ModelService.ERROR_MESSAGE, "Context not an instance of Map");
                     }
@@ -170,8 +176,9 @@ public class HttpEngine extends GenericA
             resultString = XmlSerializer.serialize(result);
         } catch (Exception e) {
             Debug.logError(e, "Cannot serialize result", module);
-            if (result.containsKey(ModelService.ERROR_MESSAGE))
+            if (result.containsKey(ModelService.ERROR_MESSAGE)) {
                 errorMessage.append(result.get(ModelService.ERROR_MESSAGE));
+            }
             errorMessage.append("::");
             errorMessage.append(e);
         }

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SOAPClientEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SOAPClientEngine.java?rev=1818540&r1=1818539&r2=1818540&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SOAPClientEngine.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SOAPClientEngine.java Mon Dec 18 09:30:52 2017
@@ -73,16 +73,18 @@ public final class SOAPClientEngine exte
     public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
         Map<String, Object> result = serviceInvoker(modelService, context);
 
-        if (result == null)
+        if (result == null) {
             throw new GenericServiceException("Service did not return expected result");
+        }
         return result;
     }
 
     // Invoke the remote SOAP service
     private Map<String, Object> serviceInvoker(ModelService modelService, Map<String, Object> context) throws GenericServiceException {
         Delegator delegator = dispatcher.getDelegator();
-        if (modelService.location == null || modelService.invoke == null)
+        if (modelService.location == null || modelService.invoke == null) {
             throw new GenericServiceException("Cannot locate service to invoke");
+        }
 
         ServiceClient client = null;
         QName serviceName = null;
@@ -104,7 +106,9 @@ public final class SOAPClientEngine exte
 
         List<ModelParam> inModelParamList = modelService.getInModelParamList();
 
-        if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke] : Parameter length - " + inModelParamList.size(), module);
+        if (Debug.infoOn()) {
+            Debug.logInfo("[SOAPClientEngine.invoke] : Parameter length - " + inModelParamList.size(), module);
+        }
 
         if (UtilValidate.isNotEmpty(modelService.nameSpace)) {
             serviceName = new QName(modelService.nameSpace, modelService.invoke);
@@ -116,7 +120,9 @@ public final class SOAPClientEngine exte
 
         Map<String, Object> parameterMap = new HashMap<>();
         for (ModelParam p: inModelParamList) {
-            if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke} : Parameter: " + p.name + " (" + p.mode + ") - " + i, module);
+            if (Debug.infoOn()) {
+                Debug.logInfo("[SOAPClientEngine.invoke} : Parameter: " + p.name + " (" + p.mode + ") - " + i, module);
+            }
 
             // exclude params that ModelServiceReader insert into (internal params)
             if (!p.internal) {

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/ScriptEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/ScriptEngine.java?rev=1818540&r1=1818539&r2=1818540&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/ScriptEngine.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/ScriptEngine.java Mon Dec 18 09:30:52 2017
@@ -56,7 +56,7 @@ public final class ScriptEngine extends
     private static final Set<String> protectedKeys = createProtectedKeys();
 
     private static Set<String> createProtectedKeys() {
-        Set<String> newSet = new HashSet<String>();
+        Set<String> newSet = new HashSet<>();
         /* Commenting out for now because some scripts write to the parameters Map - which should not be allowed.
         newSet.add(ScriptUtil.PARAMETERS_KEY);
         */
@@ -73,7 +73,7 @@ public final class ScriptEngine extends
     @Override
     public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
         Assert.notNull("localName", localName, "modelService.location", modelService.location, "context", context);
-        Map<String, Object> params = new HashMap<String, Object>();
+        Map<String, Object> params = new HashMap<>();
         params.putAll(context);
         context.put(ScriptUtil.PARAMETERS_KEY, params);
         DispatchContext dctx = dispatcher.getLocalContext(localName);

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SoapSerializer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SoapSerializer.java?rev=1818540&r1=1818539&r2=1818540&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SoapSerializer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/SoapSerializer.java Mon Dec 18 09:30:52 2017
@@ -43,10 +43,9 @@ public class SoapSerializer {
         Document document = UtilXml.readXmlDocument(content, false);
         if (document != null) {
             return XmlSerializer.deserialize(document, delegator);
-        } else {
-            Debug.logWarning("Serialized document came back null", module);
-            return null;
         }
+        Debug.logWarning("Serialized document came back null", module);
+        return null;
     }
 
     public static String serialize(Object object) throws SerializeException, FileNotFoundException, IOException {

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/XMLRPCClientEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/XMLRPCClientEngine.java?rev=1818540&r1=1818539&r2=1818540&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/XMLRPCClientEngine.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/XMLRPCClientEngine.java Mon Dec 18 09:30:52 2017
@@ -41,7 +41,7 @@ import org.apache.xmlrpc.XmlRpcException
 import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
 
 /**
- * Engine For XML RPC CLient Configuration management
+ * Engine For XML RPC CLient Configuration management
  */
 public class XMLRPCClientEngine extends GenericAsyncEngine {
 
@@ -66,18 +66,20 @@ public class XMLRPCClientEngine extends
     public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
         Map<String, Object> result = serviceInvoker(modelService, context);
 
-        if (result == null)
+        if (result == null) {
             throw new GenericServiceException("Service did not return expected result");
+        }
         return result;
     }
-    
+
     /*
      *  Invoke the remote XMLRPC SERVICE : This engine convert all value in IN mode to one struct.
      */
     private Map<String, Object> serviceInvoker(ModelService modelService, Map<String, Object> context) throws GenericServiceException {
-        if (modelService.location == null || modelService.invoke == null)
+        if (modelService.location == null || modelService.invoke == null) {
             throw new GenericServiceException("Cannot locate service to invoke");
-        
+        }
+
         XmlRpcClientConfigImpl config = null;
         XmlRpcClient client = null;
         String serviceName = modelService.invoke;
@@ -105,16 +107,12 @@ public class XMLRPCClientEngine extends
             config.setBasicUserName(login);
             config.setBasicPassword(password);
             config.setServerURL(new URL(url));
-        }catch (MalformedURLException e) {
-            throw new GenericServiceException("Cannot invoke service : engine parameters are not correct");
-        }
-        catch (GenericConfigException e) {
+        } catch (MalformedURLException | GenericConfigException e) {
             throw new GenericServiceException("Cannot invoke service : engine parameters are not correct");
         }
-        if(UtilValidate.isNotEmpty(keyStoreComponent) && UtilValidate.isNotEmpty(keyStoreName) && UtilValidate.isNotEmpty(keyAlias)){
+        if (UtilValidate.isNotEmpty(keyStoreComponent) && UtilValidate.isNotEmpty(keyStoreName) && UtilValidate.isNotEmpty(keyAlias)) {
             client = new XmlRpcClient(config, keyStoreComponent, keyStoreName, keyAlias);
-        }
-        else{
+        } else {
             client = new XmlRpcClient(config);
         }
         List<ModelParam> inModelParamList = modelService.getInModelParamList();
@@ -127,21 +125,23 @@ public class XMLRPCClientEngine extends
         }
 
         Map<String, Object> result = null;
-        Map<String, Object> params = new HashMap<String, Object>();
+        Map<String, Object> params = new HashMap<>();
         for (ModelParam modelParam: modelService.getModelParamList()) {
             // don't include OUT parameters in this list, only IN and INOUT
-            if (ModelService.OUT_PARAM.equals(modelParam.mode) || modelParam.internal) continue;
+            if (ModelService.OUT_PARAM.equals(modelParam.mode) || modelParam.internal) {
+                continue;
+            }
 
             Object paramValue = context.get(modelParam.name);
             if (paramValue != null) {
                 params.put(modelParam.name, paramValue);
             }
         }
-        
+
         List<Map<String,Object>> listParams = UtilMisc.toList(params);
-        try{
+        try {
             result = UtilGenerics.cast(client.execute(serviceName, listParams.toArray()));
-        }catch (XmlRpcException e) {
+        } catch (XmlRpcException e) {
             result = ServiceUtil.returnError(e.getLocalizedMessage());
         }
         return result;