svn commit: r1818544 - /ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/

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

svn commit: r1818544 - /ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/

mbrohl
Author: mbrohl
Date: Mon Dec 18 09:51:44 2017
New Revision: 1818544

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

Thanks Dennis Balkir for reporting and providing the patches.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FtpServices.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/KeywordSearchUtil.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java Mon Dec 18 09:51:44 2017
@@ -75,13 +75,7 @@ public class CdyneServices {
         } catch (HttpClientException e) {
             Debug.logError(e, "Error calling CDyne service at URL [" + serviceUrl + "]: " + e.toString(), module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonCDyneCallingError", UtilMisc.toMap("serviceUrl", serviceUrl, "errorString", e.toString()), locale));
-        } catch (SAXException e) {
-            Debug.logError(e, "Error parsing XML result from CDyne service at URL [" + serviceUrl + "]: " + e.toString(), module);
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonCDyneParsingError", UtilMisc.toMap("serviceUrl", serviceUrl, "errorString", e.toString()), locale));
-        } catch (ParserConfigurationException e) {
-            Debug.logError(e, "Error parsing XML result from CDyne service at URL [" + serviceUrl + "]: " + e.toString(), module);
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonCDyneParsingError", UtilMisc.toMap("serviceUrl", serviceUrl, "errorString", e.toString()), locale));
-        } catch (IOException e) {
+        } catch (SAXException | ParserConfigurationException | IOException e) {
             Debug.logError(e, "Error parsing XML result from CDyne service at URL [" + serviceUrl + "]: " + e.toString(), module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonCDyneParsingError", UtilMisc.toMap("serviceUrl", serviceUrl, "errorString", e.toString()), locale));
         }

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java Mon Dec 18 09:51:44 2017
@@ -102,8 +102,9 @@ public class CommonEvents {
 
         if (visit != null && visit.getString("sessionId").equals(sessionId) && appletSessions.containsKey(sessionId)) {
             Map<String, String> sessionMap = appletSessions.get(sessionId);
-            if (sessionMap != null && sessionMap.containsKey("followPage"))
+            if (sessionMap != null && sessionMap.containsKey("followPage")) {
                 responseString = sessionMap.remove("followPage");
+            }
         }
 
         try {
@@ -164,12 +165,16 @@ public class CommonEvents {
         Security security = (Security) request.getAttribute("security");
         GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
         String visitId = request.getParameter("visitId");
-        if (visitId != null) request.setAttribute("visitId", visitId);
+        if (visitId != null) {
+            request.setAttribute("visitId", visitId);
+        }
         if (security.hasPermission("SEND_CONTROL_APPLET", userLogin)) {
             String followerSessionId = request.getParameter("followerSid");
             String followSessionId = request.getParameter("followSid");
             Map<String, String> follow = appletSessions.get(followSessionId);
-            if (follow == null) follow = new LinkedHashMap<String, String>();
+            if (follow == null) {
+                follow = new LinkedHashMap<>();
+            }
             appletSessions.put(followSessionId, follow);
             appletSessions.put(followerSessionId, null);
         }
@@ -180,12 +185,16 @@ public class CommonEvents {
         Security security = (Security) request.getAttribute("security");
         GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
         String visitId = request.getParameter("visitId");
-        if (visitId != null) request.setAttribute("visitId", visitId);
+        if (visitId != null) {
+            request.setAttribute("visitId", visitId);
+        }
         if (security.hasPermission("SEND_CONTROL_APPLET", userLogin)) {
             String followerSessionId = request.getParameter("followerSid");
             String pageUrl = request.getParameter("pageUrl");
             Map<String, String> follow = appletSessions.get(followerSessionId);
-            if (follow == null) follow = new LinkedHashMap<String, String>();
+            if (follow == null) {
+                follow = new LinkedHashMap<>();
+            }
             follow.put("followPage", pageUrl);
             appletSessions.put(followerSessionId, follow);
         }
@@ -350,13 +359,13 @@ public class CommonEvents {
             return "error";
         }
         Locale locale = UtilHttp.getLocale(request);
-        Map<String, List<String>> uiLabelMap = new HashMap<String, List<String>>();
+        Map<String, List<String>> uiLabelMap = new HashMap<>();
         Set<Map.Entry<String, List<String>>> entrySet = uiLabelObject.entrySet();
         for (Map.Entry<String, List<String>> entry : entrySet) {
             String resource = entry.getKey();
             List<String> resourceKeys = entry.getValue();
             if (resourceKeys != null) {
-                List<String> labels = new ArrayList<String>(resourceKeys.size());
+                List<String> labels = new ArrayList<>(resourceKeys.size());
                 for (String resourceKey : resourceKeys) {
                     String label = UtilProperties.getMessage(resource, resourceKey, locale);
                     labels.add(label);
@@ -384,7 +393,7 @@ public class CommonEvents {
             return "error";
         }
         Locale locale = UtilHttp.getLocale(request);
-        Map<String, String> uiLabelMap = new HashMap<String, String>();
+        Map<String, String> uiLabelMap = new HashMap<>();
         Set<Map.Entry<String, String>> entrySet = uiLabelObject.entrySet();
         for (Map.Entry<String, String> entry : entrySet) {
             String resource = entry.getKey();
@@ -400,7 +409,7 @@ public class CommonEvents {
 
     public static String getCaptcha(HttpServletRequest request, HttpServletResponse response) {
         try {
-            Delegator delegator = (Delegator) request.getAttribute("delegator");
+            Delegator delegator = (Delegator) request.getAttribute("delegator");
             final String captchaSizeConfigName = StringUtils.defaultIfEmpty(request.getParameter("captchaSize"), "default");
             final String captchaSizeConfig = EntityUtilProperties.getPropertyValue("captcha", "captcha." + captchaSizeConfigName, delegator);
             final String[] captchaSizeConfigs = captchaSizeConfig.split("\\|");
@@ -485,7 +494,7 @@ public class CommonEvents {
             HttpSession session = request.getSession();
             Map<String, String> captchaCodeMap = UtilGenerics.checkMap(session.getAttribute("_CAPTCHA_CODE_"));
             if (captchaCodeMap == null) {
-                captchaCodeMap = new HashMap<String, String>();
+                captchaCodeMap = new HashMap<>();
                 session.setAttribute("_CAPTCHA_CODE_", captchaCodeMap);
             }
             captchaCodeMap.put(captchaCodeId, captchaCode);

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java Mon Dec 18 09:51:44 2017
@@ -22,7 +22,6 @@ import static org.apache.ofbiz.base.util
 import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
 
 import java.io.BufferedReader;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -112,7 +111,7 @@ public class CommonServices {
         Delegator delegator = dctx.getDelegator();
         Map<String, Object> response = ServiceUtil.returnSuccess();
 
-        List<GenericValue> testingNodes = new LinkedList<GenericValue>();
+        List<GenericValue> testingNodes = new LinkedList<>();
         for (int i = 0; i < 3; i ++) {
             GenericValue testingNode = delegator.makeValue("TestingNode");
             testingNode.put("testingNodeId", "TESTING_NODE" + i);
@@ -178,8 +177,9 @@ public class CommonServices {
 
         // check for a party id
         if (partyId == null) {
-            if (userLogin != null && userLogin.get("partyId") != null)
+            if (userLogin != null && userLogin.get("partyId") != null) {
                 partyId = userLogin.getString("partyId");
+            }
         }
 
         Map<String, Object> fields = UtilMisc.toMap("noteId", noteId, "noteName", noteName, "noteInfo", note,
@@ -227,7 +227,7 @@ public class CommonServices {
      * This service does not have required parameters and does not validate
      */
      public static Map<String, Object> echoService(DispatchContext dctx, Map<String, ?> context) {
-         Map<String, Object> result =  new LinkedHashMap<String, Object>();
+         Map<String, Object> result =  new LinkedHashMap<>();
          result.putAll(context);
          result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
          return result;
@@ -282,7 +282,7 @@ public class CommonServices {
     /** Test entity sorting */
     public static Map<String, Object> entitySortTest(DispatchContext dctx, Map<String, ?> context) {
         Delegator delegator = dctx.getDelegator();
-        Set<ModelEntity> set = new TreeSet<ModelEntity>();
+        Set<ModelEntity> set = new TreeSet<>();
 
         set.add(delegator.getModelEntity("Person"));
         set.add(delegator.getModelEntity("PartyRole"));
@@ -357,14 +357,12 @@ public class CommonServices {
         String outputPath1 = ofbizHome + (fileName1.startsWith("/") ? fileName1 : "/" + fileName1);
         String outputPath2 = ofbizHome + (fileName2.startsWith("/") ? fileName2 : "/" + fileName2);
         RandomAccessFile file1 = null, file2 = null;
-        
+
         try {
             file1 = new RandomAccessFile(outputPath1, "rw");
             file2 = new RandomAccessFile(outputPath2, "rw");
             file1.write(buffer1.array());
             file2.write(buffer2.array());
-        } catch (FileNotFoundException e) {
-            Debug.logError(e, module);
         } catch (IOException e) {
             Debug.logError(e, module);
         } finally {
@@ -387,7 +385,7 @@ public class CommonServices {
         String fileName = (String) context.get("_uploadFile_fileName");
         String contentType = (String) context.get("_uploadFile_contentType");
 
-        Map<String, Object> createCtx =  new LinkedHashMap<String, Object>();
+        Map<String, Object> createCtx =  new LinkedHashMap<>();
         createCtx.put("binData", array);
         createCtx.put("dataResourceTypeId", "OFBIZ_FILE");
         createCtx.put("dataResourceName", fileName);
@@ -409,7 +407,7 @@ public class CommonServices {
 
         GenericValue dataResource = (GenericValue) createResp.get("dataResource");
         if (dataResource != null) {
-            Map<String, Object> contentCtx =  new LinkedHashMap<String, Object>();
+            Map<String, Object> contentCtx =  new LinkedHashMap<>();
             contentCtx.put("dataResourceId", dataResource.getString("dataResourceId"));
             contentCtx.put("localeString", ((Locale) context.get("locale")).toString());
             contentCtx.put("contentTypeId", "DOCUMENT");
@@ -510,16 +508,15 @@ public class CommonServices {
             Map<String, Object> result = ServiceUtil.returnSuccess();
             result.put("message", message);
             return result;
-        } else {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonPingDatasourceInvalidCount", locale));
         }
+        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonPingDatasourceInvalidCount", locale));
     }
 
     public static Map<String, Object> getAllMetrics(DispatchContext dctx, Map<String, ?> context) {
-        List<Map<String, Object>> metricsMapList = new LinkedList<Map<String, Object>>();
+        List<Map<String, Object>> metricsMapList = new LinkedList<>();
         Collection<Metrics> metricsList = MetricsFactory.getMetrics();
         for (Metrics metrics : metricsList) {
-            Map<String, Object> metricsMap =  new LinkedHashMap<String, Object>();
+            Map<String, Object> metricsMap =  new LinkedHashMap<>();
             metricsMap.put("name", metrics.getName());
             metricsMap.put("serviceRate", metrics.getServiceRate());
             metricsMap.put("threshold", metrics.getThreshold());

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java Mon Dec 18 09:51:44 2017
@@ -45,7 +45,7 @@ public final class CommonWorkers {
     private CommonWorkers() {}
 
     public static List<GenericValue> getCountryList(Delegator delegator) {
-        List<GenericValue> geoList = new LinkedList<GenericValue>();
+        List<GenericValue> geoList = new LinkedList<>();
         String defaultCountry = EntityUtilProperties.getPropertyValue("general", "country.geo.id.default", delegator);
         GenericValue defaultGeo = null;
         if (UtilValidate.isNotEmpty(defaultCountry)) {
@@ -63,7 +63,7 @@ public final class CommonWorkers {
             exprs.add(EntityCondition.makeCondition("geoId", EntityOperator.IN, countriesAvailable));
         }
 
-        List<GenericValue> countriesList = new LinkedList<GenericValue>();
+        List<GenericValue> countriesList = new LinkedList<>();
         try {
             countriesList = EntityQuery.use(delegator).from("Geo").where(exprs).orderBy("geoName").cache(true).queryList();
         } catch (GenericEntityException e) {
@@ -90,7 +90,7 @@ public final class CommonWorkers {
     }
 
     public static List<GenericValue> getStateList(Delegator delegator) {
-        List<GenericValue> geoList = new LinkedList<GenericValue>();
+        List<GenericValue> geoList = new LinkedList<>();
         EntityCondition condition = EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"), EntityCondition.makeCondition("geoTypeId", "TERRITORY"),
                 EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"));
         try {
@@ -119,7 +119,7 @@ public final class CommonWorkers {
         }
         List<String> sortList = UtilMisc.toList(listOrderBy);
 
-        List<GenericValue> geoList = new LinkedList<GenericValue>();
+        List<GenericValue> geoList = new LinkedList<>();
         try {
             // Check if the country is a country group and get recursively the
             // states
@@ -174,7 +174,7 @@ public final class CommonWorkers {
      * @param parentTypeField Field in Type entity which stores the parent type.
      * @param parentType      Value of the parent type against which check is performed.
      * @return boolean value based on the check results.
-     *
+     *
      * @deprecated Moved to {@link org.apache.ofbiz.entity.util.EntityTypeUtil#hasParentType(Delegator, String, String, String, String, String) EntityTypeUtil}
      */
     @Deprecated

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java Mon Dec 18 09:51:44 2017
@@ -72,7 +72,7 @@ public class FindServices {
     public static final Map<String, EntityComparisonOperator<?, ?>> entityOperators;
 
     static {
-        entityOperators =  new LinkedHashMap<String, EntityComparisonOperator<?, ?>>();
+        entityOperators =  new LinkedHashMap<>();
         entityOperators.put("between", EntityOperator.BETWEEN);
         entityOperators.put("equals", EntityOperator.EQUALS);
         entityOperators.put("greaterThan", EntityOperator.GREATER_THAN);
@@ -112,7 +112,7 @@ public class FindServices {
         // Note that "normalizedFields" will contain values other than those
         // Contained in the associated entity.
         // Those extra fields will be ignored in the second half of this method.
-        Map<String, Map<String, Map<String, Object>>> normalizedFields = new LinkedHashMap<String, Map<String, Map<String, Object>>>();
+        Map<String, Map<String, Map<String, Object>>> normalizedFields = new LinkedHashMap<>();
         for (Entry<String, ?> entry : inputFields.entrySet()) { // The name as it appears in the HTML form
             String fieldNameRaw = entry.getKey();
             String fieldNameRoot = null; // The entity field name. Everything to the left of the first "_" if
@@ -183,19 +183,19 @@ public class FindServices {
             }
             subMap = normalizedFields.get(fieldNameRoot);
             if (subMap == null) {
-                subMap = new LinkedHashMap<String, Map<String, Object>>();
+                subMap = new LinkedHashMap<>();
                 normalizedFields.put(fieldNameRoot, subMap);
             }
             subMap2 = subMap.get(fieldPair);
             if (subMap2 == null) {
-                subMap2 = new LinkedHashMap<String, Object>();
+                subMap2 = new LinkedHashMap<>();
                 subMap.put(fieldPair, subMap2);
             }
             subMap2.put(fieldMode, fieldValue);
 
             List<Object[]> origList = origValueMap.get(fieldNameRoot);
             if (origList == null) {
-                origList = new LinkedList<Object[]>();
+                origList = new LinkedList<>();
                 origValueMap.put(fieldNameRoot, origList);
             }
             Object [] origValues = {fieldNameRaw, fieldValue};
@@ -215,13 +215,13 @@ public class FindServices {
      * @return returns an EntityCondition list
      */
     public static List<EntityCondition> createConditionList(Map<String, ? extends Object> parameters, List<ModelField> fieldList, Map<String, Object> queryStringMap, Delegator delegator, Map<String, ?> context) {
-        Set<String> processed = new LinkedHashSet<String>();
-        Set<String> keys = new LinkedHashSet<String>();
-        Map<String, ModelField> fieldMap = new LinkedHashMap<String, ModelField>();
+        Set<String> processed = new LinkedHashSet<>();
+        Set<String> keys = new LinkedHashSet<>();
+        Map<String, ModelField> fieldMap = new LinkedHashMap<>();
         for (ModelField modelField : fieldList) {
             fieldMap.put(modelField.getName(), modelField);
         }
-        List<EntityCondition> result = new LinkedList<EntityCondition>();
+        List<EntityCondition> result = new LinkedList<>();
         for (Map.Entry<String, ? extends Object> entry : parameters.entrySet()) {
             String parameterName = entry.getKey();
             if (processed.contains(parameterName)) {
@@ -282,7 +282,7 @@ public class FindServices {
 
     /**
      * Creates a single <code>EntityCondition</code> based on a set of parameters.
-     *
+     *
      * @param modelField
      * @param operation
      * @param fieldValue
@@ -373,7 +373,7 @@ public class FindServices {
         Object fieldValue = null; // If it is a "value" field, it will be the value to be used in the query.
                                   // If it is an "op" field, it will be "equals", "greaterThan", etc.
         EntityCondition cond = null;
-        List<EntityCondition> tmpList = new LinkedList<EntityCondition>();
+        List<EntityCondition> tmpList = new LinkedList<>();
         String opString = null;
         boolean ignoreCase = false;
         List<ModelField> fields = modelEntity.getFieldsUnmodifiable();
@@ -391,7 +391,7 @@ public class FindServices {
                 continue;
             }
             ignoreCase = "Y".equals(subMap2.get("ic"));
-            cond = createSingleCondition(modelField, opString, fieldValue, ignoreCase, delegator, context);
+            cond = createSingleCondition(modelField, opString, fieldValue, ignoreCase, delegator, context);
             tmpList.add(cond);
             subMap2 = subMap.get("fld1");
             if (subMap2 == null) {
@@ -403,7 +403,7 @@ public class FindServices {
                 continue;
             }
             ignoreCase = "Y".equals(subMap2.get("ic"));
-            cond = createSingleCondition(modelField, opString, fieldValue, ignoreCase, delegator, context);
+            cond = createSingleCondition(modelField, opString, fieldValue, ignoreCase, delegator, context);
             tmpList.add(cond);
             // add to queryStringMap
             List<Object[]> origList = origValueMap.get(fieldName);
@@ -430,10 +430,14 @@ public class FindServices {
      */
     public static Map<String, Object> performFindList(DispatchContext dctx, Map<String, Object> context) {
         Integer viewSize = (Integer) context.get("viewSize");
-        if (viewSize == null) viewSize = Integer.valueOf(20);       // default
+        if (viewSize == null) {
+            viewSize = Integer.valueOf(20);       // default
+        }
         context.put("viewSize", viewSize);
         Integer viewIndex = (Integer) context.get("viewIndex");
-        if (viewIndex == null)  viewIndex = Integer.valueOf(0);  // default
+        if (viewIndex == null) {
+            viewIndex = Integer.valueOf(0);  // default
+        }
         context.put("viewIndex", viewIndex);
 
         Map<String, Object> result = performFind(dctx,context);
@@ -528,7 +532,9 @@ public class FindServices {
         }
 
         if (executeResult.get("listIt") == null) {
-            if (Debug.verboseOn()) Debug.logVerbose("No list iterator found for query string + [" + prepareResult.get("queryString") + "]", module);
+            if (Debug.verboseOn()) {
+                Debug.logVerbose("No list iterator found for query string + [" + prepareResult.get("queryString") + "]", module);
+            }
         }
 
         Map<String, Object> results = ServiceUtil.returnSuccess();
@@ -568,7 +574,7 @@ public class FindServices {
         String fromDateName = (String) context.get("fromDateName");
         String thruDateName = (String) context.get("thruDateName");
 
-        Map<String, Object> queryStringMap = new LinkedHashMap<String, Object>();
+        Map<String, Object> queryStringMap = new LinkedHashMap<>();
         ModelEntity modelEntity = delegator.getModelEntity(entityName);
         List<EntityCondition> tmpList = createConditionList(inputFields, modelEntity.getFieldsUnmodifiable(), queryStringMap, delegator, context);
 
@@ -579,10 +585,16 @@ public class FindServices {
         if (tmpList.size() > 0 || "Y".equals(noConditionFind)) {
             if ("Y".equals(filterByDate)) {
                 queryStringMap.put("filterByDate", filterByDate);
-                if (UtilValidate.isEmpty(fromDateName)) fromDateName = "fromDate";
-                else queryStringMap.put("fromDateName", fromDateName);
-                if (UtilValidate.isEmpty(thruDateName)) thruDateName = "thruDate";
-                else queryStringMap.put("thruDateName", thruDateName);
+                if (UtilValidate.isEmpty(fromDateName)) {
+                    fromDateName = "fromDate";
+                } else {
+                    queryStringMap.put("fromDateName", fromDateName);
+                }
+                if (UtilValidate.isEmpty(thruDateName)) {
+                    thruDateName = "thruDate";
+                } else {
+                    queryStringMap.put("thruDateName", thruDateName);
+                }
                 if (UtilValidate.isEmpty(filterByDateValue)) {
                     EntityCondition filterByDateCondition = EntityUtil.getFilterByDateExpr(fromDateName, thruDateName);
                     tmpList.add(filterByDateCondition);
@@ -695,7 +707,7 @@ public class FindServices {
         // Contained in the associated entity.
         // Those extra fields will be ignored in the second half of this method.
         ModelEntity modelEntity = delegator.getModelEntity(entityName);
-        Map<String, Object> normalizedFields = new LinkedHashMap<String, Object>();
+        Map<String, Object> normalizedFields = new LinkedHashMap<>();
         //StringBuffer queryStringBuf = new StringBuffer();
         for (Entry<String, ?> entry : inputFields.entrySet()) { // The name as it appears in the HTML form
             String fieldNameRaw = entry.getKey();
@@ -711,7 +723,6 @@ public class FindServices {
                 continue;
             }
 
-            //queryStringBuffer.append(fieldNameRaw + "=" + fieldValue);
             iPos = fieldNameRaw.indexOf('_'); // Look for suffix
 
             // This is a hack to skip fields from "multi" forms
@@ -745,7 +756,7 @@ public class FindServices {
      *
      * @param dctx
      * @param context
-     * @return returns the first item
+     * @return returns the first item
      */
     public static Map<String, Object> performFindItem(DispatchContext dctx, Map<String, Object> context) {
         context.put("viewSize", 1);

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FtpServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FtpServices.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FtpServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FtpServices.java Mon Dec 18 09:51:44 2017
@@ -42,7 +42,7 @@ import org.apache.ofbiz.service.ServiceU
 
 /**
  * FTP Services.
- *
+ *
  */
 public class FtpServices {
 
@@ -59,7 +59,7 @@ public class FtpServices {
             Debug.logError(ioe, "[putFile] Problem opening local file", module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonFtpFileCannotBeOpen", locale));
         }
-        List<String> errorList = new LinkedList<String>();
+        List<String> errorList = new LinkedList<>();
         FTPClient ftp = new FTPClient();
         try {
             Integer defaultTimeout = (Integer) context.get("defaultTimeout");
@@ -144,7 +144,7 @@ public class FtpServices {
             Debug.logError(ioe, "[getFile] Problem opening local file", module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonFtpFileCannotBeOpen", locale));
         }
-        List<String> errorList = new LinkedList<String>();
+        List<String> errorList = new LinkedList<>();
         FTPClient ftp = new FTPClient();
         try {
             Integer defaultTimeout = (Integer) context.get("defaultTimeout");

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java Mon Dec 18 09:51:44 2017
@@ -52,10 +52,10 @@ public class JsLanguageFileMappingCreato
         String encoding = (String) context.get("encoding"); // default value: UTF-8
 
         List<Locale> localeList = UtilMisc.availableLocales();
-        Map<String, Object> jQueryLocaleFile = new LinkedHashMap<String, Object>();
-        Map<String, String> dateJsLocaleFile = new LinkedHashMap<String, String>();
-        Map<String, String> validationLocaleFile = new LinkedHashMap<String, String>();
-        Map<String, String> dateTimePickerLocaleFile = new LinkedHashMap<String, String>();
+        Map<String, Object> jQueryLocaleFile = new LinkedHashMap<>();
+        Map<String, String> dateJsLocaleFile = new LinkedHashMap<>();
+        Map<String, String> validationLocaleFile = new LinkedHashMap<>();
+        Map<String, String> dateTimePickerLocaleFile = new LinkedHashMap<>();
 
         // setup some variables to locate the js files
         String componentRoot = "component://common-theme/webapp";
@@ -185,7 +185,7 @@ public class JsLanguageFileMappingCreato
         // check the template file
         String template = "themes/common/template/JsLanguageFilesMapping.ftl";
         String output = "framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java";
-        Map<String, Object> mapWrapper = new HashMap<String, Object>();
+        Map<String, Object> mapWrapper = new HashMap<>();
         mapWrapper.put("datejs", dateJsLocaleFile);
         mapWrapper.put("jquery", jQueryLocaleFile);
         mapWrapper.put("validation", validationLocaleFile);

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/KeywordSearchUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/KeywordSearchUtil.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/KeywordSearchUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/KeywordSearchUtil.java Mon Dec 18 09:51:44 2017
@@ -42,8 +42,8 @@ public final class KeywordSearchUtil {
 
     public static final String module = KeywordSearchUtil.class.getName();
 
-    private static Set<String> thesaurusRelsToInclude = new HashSet<String>();
-    private static Set<String> thesaurusRelsForReplace = new HashSet<String>();
+    private static Set<String> thesaurusRelsToInclude = new HashSet<>();
+    private static Set<String> thesaurusRelsForReplace = new HashSet<>();
 
     static {
         thesaurusRelsToInclude.add("KWTR_UF");
@@ -77,7 +77,7 @@ public final class KeywordSearchUtil {
     }
     public static Set<String> getStemSet() {
         String stemBag = UtilProperties.getPropertyValue("keywordsearch", "stem.bag");
-        Set<String> stemSet = new TreeSet<String>();
+        Set<String> stemSet = new TreeSet<>();
         if (UtilValidate.isNotEmpty(stemBag)) {
             String curToken;
             StringTokenizer tokenizer = new StringTokenizer(stemBag, ": ");
@@ -151,9 +151,13 @@ public final class KeywordSearchUtil {
 
             if (forSearch) {
                 StringBuilder strSb = new StringBuilder();
-                if (anyPrefix) strSb.append('%');
+                if (anyPrefix) {
+                    strSb.append('%');
+                }
                 strSb.append(token);
-                if (anySuffix) strSb.append('%');
+                if (anySuffix) {
+                    strSb.append('%');
+                }
                 // replace all %% with %
                 int dblPercIdx = -1;
                 while ((dblPercIdx = strSb.indexOf("%%")) >= 0) {
@@ -173,9 +177,11 @@ public final class KeywordSearchUtil {
     }
 
     public static Set<String> makeKeywordSet(String str, String separators, boolean forSearch) {
-        if (separators == null) separators = getSeparators();
+        if (separators == null) {
+            separators = getSeparators();
+        }
 
-        Set<String> keywords = new TreeSet<String>();
+        Set<String> keywords = new TreeSet<>();
         if (str.length() > 0) {
             // strip off weird characters
             str = str.replaceAll("\\\302\\\240|\\\240", " ");
@@ -183,10 +189,18 @@ public final class KeywordSearchUtil {
             if (forSearch) {
                 // remove %_*? from separators if is for a search
                 StringBuilder sb = new StringBuilder(separators);
-                if (sb.indexOf("%") >= 0) sb.deleteCharAt(sb.indexOf("%"));
-                if (sb.indexOf("_") >= 0) sb.deleteCharAt(sb.indexOf("_"));
-                if (sb.indexOf("*") >= 0) sb.deleteCharAt(sb.indexOf("*"));
-                if (sb.indexOf("?") >= 0) sb.deleteCharAt(sb.indexOf("?"));
+                if (sb.indexOf("%") >= 0) {
+                    sb.deleteCharAt(sb.indexOf("%"));
+                }
+                if (sb.indexOf("_") >= 0) {
+                    sb.deleteCharAt(sb.indexOf("_"));
+                }
+                if (sb.indexOf("*") >= 0) {
+                    sb.deleteCharAt(sb.indexOf("*"));
+                }
+                if (sb.indexOf("?") >= 0) {
+                    sb.deleteCharAt(sb.indexOf("?"));
+                }
                 separators = sb.toString();
             }
 
@@ -208,7 +222,7 @@ public final class KeywordSearchUtil {
 }
 
     public static Set<String> fixKeywordsForSearch(Set<String> keywordSet, boolean anyPrefix, boolean anySuffix, boolean removeStems, boolean isAnd) {
-        Map<String, Long> keywords = new LinkedHashMap<String, Long>();
+        Map<String, Long> keywords = new LinkedHashMap<>();
         fixupKeywordSet(keywordSet, keywords, getStopWordBagAnd(), getStopWordBagOr(), removeStems, getStemSet(), true, anyPrefix, anySuffix, isAnd);
         return keywords.keySet();
     }

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java?rev=1818544&r1=1818543&r2=1818544&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java Mon Dec 18 09:51:44 2017
@@ -42,11 +42,11 @@ import org.apache.ofbiz.webapp.WebAppUti
 import org.apache.ofbiz.webapp.website.WebSiteWorker;
 
 public final class UrlServletHelper {
-    
+
     public final static String module = UrlServletHelper.class.getName();
-    
+
     private UrlServletHelper() {}
-    
+
     public static void setRequestAttributes(ServletRequest request, Delegator delegator, ServletContext servletContext) {
         HttpServletRequest httpRequest = (HttpServletRequest) request;
         // check if multi tenant is enabled
@@ -72,7 +72,7 @@ public final class UrlServletHelper {
                     delegator = DelegatorFactory.getDelegator(tenantDelegatorName);
                     servletContext.setAttribute("delegator", delegator);
                 }
-                
+
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, "Unable to get Tenant", module);
             }
@@ -87,7 +87,7 @@ public final class UrlServletHelper {
             httpRequest.getSession().setAttribute("webSiteId", httpRequest.getSession().getServletContext().getAttribute("webSiteId"));
         }
     }
-    
+
     public static void setViewQueryParameters(ServletRequest request, StringBuilder urlBuilder) {
         HttpServletRequest httpRequest = (HttpServletRequest) request;
         if (UtilValidate.isEmpty(httpRequest.getServletPath())) {
@@ -98,7 +98,7 @@ public final class UrlServletHelper {
         String viewSize = null;
         String viewSort = null;
         String searchString = null;
-        
+
         int queryStringIndex = pathInfo.indexOf("?");
         if (queryStringIndex >= 0) {
             List<String> queryStringTokens = StringUtil.split(pathInfo.substring(queryStringIndex + 1), "&");
@@ -106,7 +106,7 @@ public final class UrlServletHelper {
                 int equalIndex = queryStringToken.indexOf("=");
                 String name = queryStringToken.substring(0, equalIndex - 1);
                 String value = queryStringToken.substring(equalIndex + 1, queryStringToken.length() - 1);
-                
+
                 if ("viewIndex".equals(name)) {
                     viewIndex = value;
                 } else if ("viewSize".equals(name)) {
@@ -118,7 +118,7 @@ public final class UrlServletHelper {
                 }
             }
         }
-        
+
         if (UtilValidate.isNotEmpty(httpRequest.getParameter("viewIndex"))) {
             viewIndex = httpRequest.getParameter("viewIndex");
         }
@@ -131,7 +131,7 @@ public final class UrlServletHelper {
         if (UtilValidate.isNotEmpty(httpRequest.getParameter("searchString"))) {
             searchString = httpRequest.getParameter("searchString");
         }
-        
+
         //Set query string parameters to url
         if(UtilValidate.isNotEmpty(viewIndex)){
             urlBuilder.append("/~VIEW_INDEX=" + viewIndex);
@@ -177,9 +177,7 @@ public final class UrlServletHelper {
                 try {
                     rd.forward(request, response);
                     return;
-                } catch (ServletException e) {
-                    Debug.logWarning(e, module);
-                } catch (IOException e) {
+                } catch (ServletException | IOException e) {
                     Debug.logWarning(e, module);
                 }
             }
@@ -194,14 +192,12 @@ public final class UrlServletHelper {
                     httpResponse.sendError(HttpServletResponse.SC_NOT_FOUND, "Not Found");
                     return;
                 }
-            } catch (GenericEntityException e) {
-                Debug.logError(e, module);
-            } catch (IOException e) {
+            } catch (GenericEntityException | IOException e) {
                 Debug.logError(e, module);
             }
         }
     }
-    
+
     public static String invalidCharacter(String str) {
         str = str.replace("&", "-");
         str = str.replace("\"", "-");