svn commit: r1818335 - /ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/

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

svn commit: r1818335 - /ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/

mbrohl
Author: mbrohl
Date: Fri Dec 15 20:56:29 2017
New Revision: 1818335

URL: http://svn.apache.org/viewvc?rev=1818335&view=rev
Log:
Improved: General refactoring and code improvements, package
org.apache.ofbiz.content.webapp.ftl.
(OFBIZ-10080)

Thanks Julian Leichert for reporting and providing the patches.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/OfbizContentAltUrlTransforms.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java Fri Dec 15 20:56:29 2017
@@ -82,6 +82,7 @@ public class CheckPermissionTransform im
     }
 
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final StringBuilder buf = new StringBuilder();
@@ -94,7 +95,7 @@ public class CheckPermissionTransform im
         FreeMarkerWorker.overrideWithArgs(templateCtx, args);
         final String mode = (String)templateCtx.get("mode");
         final String quickCheckContentId = (String)templateCtx.get("quickCheckContentId");
-        final Map<String, Object> savedValues = new HashMap<String, Object>();
+        final Map<String, Object> savedValues = new HashMap<>();
 
         return new LoopWriter(out) {
 
@@ -137,7 +138,7 @@ public class CheckPermissionTransform im
                 String passedStatusId = (String)templateCtx.get("statusId");
                 List<String> statusList = StringUtil.split(passedStatusId, "|");
                 if (statusList == null) {
-                    statusList = new LinkedList<String>();
+                    statusList = new LinkedList<>();
                 }
                 if (UtilValidate.isNotEmpty(statusId) && !statusList.contains(statusId)) {
                     statusList.add(statusId);
@@ -155,7 +156,7 @@ public class CheckPermissionTransform im
                 if (targetOperationList.size() == 0) {
                     throw new IOException("targetOperationList has zero size.");
                 }
-                List<String> roleList = new LinkedList<String>();
+                List<String> roleList = new LinkedList<>();
 
                 String privilegeEnumId = (String)currentContent.get("privilegeEnumId");
                 Map<String, Object> results = EntityPermissionChecker.checkPermission(currentContent, statusList, userLogin, purposeList, targetOperationList, roleList, delegator, security, entityOperation, privilegeEnumId, quickCheckContentId);
@@ -179,16 +180,15 @@ public class CheckPermissionTransform im
 
                 if (permissionStatus != null && "granted".equalsIgnoreCase(permissionStatus)) {
                     FreeMarkerWorker.saveContextValues(templateCtx, saveKeyNames, savedValues);
-                    if (mode == null || !"not-equals".equalsIgnoreCase(mode))
-                        return TransformControl.EVALUATE_BODY;
-                    else
-                        return TransformControl.SKIP_BODY;
-                } else {
-                    if (mode == null || !"not-equals".equalsIgnoreCase(mode))
-                        return TransformControl.SKIP_BODY;
-                    else
+                    if (mode == null || !"not-equals".equalsIgnoreCase(mode)) {
                         return TransformControl.EVALUATE_BODY;
+                    }
+                    return TransformControl.SKIP_BODY;
+                }
+                if (mode == null || !"not-equals".equalsIgnoreCase(mode)) {
+                    return TransformControl.SKIP_BODY;
                 }
+                return TransformControl.EVALUATE_BODY;
             }
 
             @Override

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java Fri Dec 15 20:56:29 2017
@@ -77,6 +77,7 @@ public class EditRenderSubContentCacheTr
         return FreeMarkerWorker.getArg(args, key, ctx);
     }
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final StringBuilder buf = new StringBuilder();
@@ -126,7 +127,7 @@ public class EditRenderSubContentCacheTr
         templateCtx.put("dataResourceId", dataResourceId);
         templateCtx.put("subContentIdSub", subContentIdSub);
         templateCtx.put("subDataResourceTypeId", subDataResourceTypeId);
-        final Map<String, Object> savedValues = new HashMap<String, Object>();
+        final Map<String, Object> savedValues = new HashMap<>();
         FreeMarkerWorker.saveContextValues(templateCtx, saveKeyNames, savedValues);
 
         return new Writer(out) {
@@ -173,12 +174,9 @@ public class EditRenderSubContentCacheTr
                     }
                     try {
                         ContentWorker.renderContentAsText(dispatcher, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, true);
-                    } catch (IOException e) {
+                    } catch (IOException | GeneralException e) {
                         Debug.logError(e, "Error rendering content" + e.getMessage(), module);
                         throw new IOException("Error rendering content" + e.toString());
-                    } catch (GeneralException e2) {
-                        Debug.logError(e2, "Error rendering content" + e2.getMessage(), module);
-                        throw new IOException("Error rendering content" + e2.toString());
                     }
                 } else {
                     out.write(wrappedContent);

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java Fri Dec 15 20:56:29 2017
@@ -75,6 +75,7 @@ public class EditRenderSubContentTransfo
         return FreeMarkerWorker.getArg(args, key, ctx);
     }
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final StringBuilder buf = new StringBuilder();
@@ -96,7 +97,7 @@ public class EditRenderSubContentTransfo
         final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
         final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env);
         GenericValue subContentDataResourceViewTemp = FreeMarkerWorker.getWrappedObject("subContentDataResourceView", env);
-        
+
         ctx.put("mapKey", mapKey);
         ctx.put("subDataResourceTypeIdTemp", subDataResourceTypeIdTemp);
         ctx.put("contentId", contentId);
@@ -193,12 +194,9 @@ public class EditRenderSubContentTransfo
 
                         try {
                             ContentWorker.renderContentAsText(dispatcher, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, false);
-                        } catch (IOException e) {
+                        } catch (IOException | GeneralException e) {
                             Debug.logError(e, "Error rendering content" + e.getMessage(), module);
                             throw new IOException("Error rendering content" + e.toString());
-                        } catch (GeneralException e2) {
-                            Debug.logError(e2, "Error rendering content" + e2.getMessage(), module);
-                            throw new IOException("Error rendering content" + e2.toString());
                         }
 
                         FreeMarkerWorker.getWrappedObject("context", env);

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java Fri Dec 15 20:56:29 2017
@@ -74,6 +74,7 @@ public class InjectNodeTrailCsvTransform
         return FreeMarkerWorker.getArg(args, key, ctx);
     }
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final StringBuilder buf = new StringBuilder();
@@ -104,34 +105,46 @@ public class InjectNodeTrailCsvTransform
 
                 List<Map<String, ? extends Object>> trail = UtilGenerics.checkList(templateCtx.get("globalNodeTrail"));
 
-                if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), trail:"+trail,module);
+                if (Debug.infoOn()) {
+                    Debug.logInfo("in InjectNodeTrailCsv(0), trail:"+trail,module);
+                }
                 // This will build a nodeTrail if none exists
                 // Maybe only contentId or subContentId are passed in
                 String redo = (String)templateCtx.get("redo");
 
                 if (UtilValidate.isEmpty(trail) || (redo != null && "true".equalsIgnoreCase(redo))) {
                     String subContentId = (String)templateCtx.get("subContentId");
-                    if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), subContentId:"+subContentId,module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("in InjectNodeTrailCsv(0), subContentId:"+subContentId,module);
+                    }
                     String contentId = (String)templateCtx.get("contentId");
-                    if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), contentId:"+contentId,module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("in InjectNodeTrailCsv(0), contentId:"+contentId,module);
+                    }
                     String contentAssocTypeId = (String)templateCtx.get("contentAssocTypeId");
-                    if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), contentAssocTypeId:"+contentAssocTypeId,module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("in InjectNodeTrailCsv(0), contentAssocTypeId:"+contentAssocTypeId,module);
+                    }
                     try {
                         if (UtilValidate.isNotEmpty(subContentId)) {
                             csvTrail = ContentWorker.getContentAncestryNodeTrailCsv(delegator, subContentId, contentAssocTypeId, "to");
-                            if (UtilValidate.isNotEmpty(csvTrail))
+                            if (UtilValidate.isNotEmpty(csvTrail)) {
                                 csvTrail += ",";
+                            }
                             csvTrail += subContentId;
                         } else if (UtilValidate.isNotEmpty(contentId)) {
                             csvTrail = ContentWorker.getContentAncestryNodeTrailCsv(delegator, contentId, contentAssocTypeId, "to");
-                            if (UtilValidate.isNotEmpty(csvTrail))
+                            if (UtilValidate.isNotEmpty(csvTrail)) {
                                 csvTrail += ",";
+                            }
                             csvTrail += contentId;
                         }
                     } catch (GenericEntityException e) {
                         throw new RuntimeException("Error getting current content. " + e.toString());
                     }
-                    if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), csvTrail:"+csvTrail,module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("in InjectNodeTrailCsv(0), csvTrail:"+csvTrail,module);
+                    }
                 } else {
                     // Build nodeTrail if one does not exist
                     if (UtilValidate.isNotEmpty(passedCsv)) {

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java Fri Dec 15 20:56:29 2017
@@ -87,6 +87,7 @@ public class LimitedSubContentCacheTrans
         return FreeMarkerWorker.getArg(args, key, ctx);
     }
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final StringBuilder buf = new StringBuilder();
@@ -95,9 +96,9 @@ public class LimitedSubContentCacheTrans
         final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
         final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env);
         FreeMarkerWorker.getSiteParameters(request, templateRoot);
-        final Map<String, Object> savedValuesUp = new HashMap<String, Object>();
+        final Map<String, Object> savedValuesUp = new HashMap<>();
         FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp);
-        final Map<String, Object> savedValues = new HashMap<String, Object>();
+        final Map<String, Object> savedValues = new HashMap<>();
         FreeMarkerWorker.overrideWithArgs(templateRoot, args);
 
         String contentAssocTypeId = (String) templateRoot.get("contentAssocTypeId");
@@ -106,7 +107,7 @@ public class LimitedSubContentCacheTrans
             templateRoot.put("contentAssocTypeId ", contentAssocTypeId);
         }
 
-        final Map<String, GenericValue> pickedEntityIds = new HashMap<String, GenericValue>();
+        final Map<String, GenericValue> pickedEntityIds = new HashMap<>();
         List<String> assocTypes = StringUtil.split(contentAssocTypeId, "|");
 
         String contentPurposeTypeId = (String) templateRoot.get("contentPurposeTypeId");
@@ -118,7 +119,7 @@ public class LimitedSubContentCacheTrans
             templateRoot.put("locale", locale);
         }
 
-        Map<String, Object> whenMap = new HashMap<String, Object>();
+        Map<String, Object> whenMap = new HashMap<>();
         whenMap.put("followWhen", templateRoot.get("followWhen"));
         whenMap.put("pickWhen", templateRoot.get("pickWhen"));
         whenMap.put("returnBeforePickWhen", templateRoot.get("returnBeforePickWhen"));
@@ -137,7 +138,7 @@ public class LimitedSubContentCacheTrans
         String limitSize = (String) templateRoot.get("limitSize");
         final int returnLimit = Integer.parseInt(limitSize);
         String orderBy = (String) templateRoot.get("orderBy");
-        
+
         // NOTE this was looking for subContentId, but that doesn't make ANY sense, so changed to contentId
         String contentId = (String) templateRoot.get("contentId");
 
@@ -148,9 +149,7 @@ public class LimitedSubContentCacheTrans
         String contentAssocPredicateId = (String) templateRoot.get("contentAssocPredicateId");
         try {
             results = ContentServicesComplex.getAssocAndContentAndDataResourceCacheMethod(delegator, contentId, null, "From", fromDate, null, assocTypes, null, Boolean.TRUE, contentAssocPredicateId, orderBy);
-        } catch (MiniLangException e) {
-            throw new RuntimeException(e.getMessage(), e);
-        } catch (GenericEntityException e) {
+        } catch (MiniLangException | GenericEntityException e) {
             throw new RuntimeException(e.getMessage(), e);
         }
         List<GenericValue> longList = UtilGenerics.checkList(results.get("entityList"));
@@ -177,9 +176,8 @@ public class LimitedSubContentCacheTrans
                 FreeMarkerWorker.saveContextValues(templateRoot, saveKeyNames, savedValues);
                 if (inProgress) {
                     return TransformControl.EVALUATE_BODY;
-                } else {
-                    return TransformControl.SKIP_BODY;
                 }
+                return TransformControl.SKIP_BODY;
             }
 
             @Override
@@ -198,9 +196,8 @@ public class LimitedSubContentCacheTrans
                 FreeMarkerWorker.saveContextValues(templateRoot, saveKeyNames, savedValues);
                 if (inProgress) {
                     return TransformControl.REPEAT_EVALUATION;
-                } else {
-                    return TransformControl.END_EVALUATION;
                 }
+                return TransformControl.END_EVALUATION;
             }
 
             @Override
@@ -232,7 +229,7 @@ public class LimitedSubContentCacheTrans
                         isPickObj.booleanValue()) || (isFollowObj != null && isFollowObj.booleanValue()))) {
                     List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.checkList(ctx.get("globalNodeTrail"));
                     if (globalNodeTrail == null) {
-                        globalNodeTrail = new LinkedList<Map<String,? extends Object>>();
+                        globalNodeTrail = new LinkedList<>();
                     }
                     globalNodeTrail.add(trailNode);
                     ctx.put("globalNodeTrail", globalNodeTrail);
@@ -254,15 +251,16 @@ public class LimitedSubContentCacheTrans
                     env.setVariable("mimeTypeId", FreeMarkerWorker.autoWrap(mimeTypeId, env));
                     env.setVariable("subContentId", FreeMarkerWorker.autoWrap(subContentIdSub, env));
                     return true;
-                } else {
-                    return false;
                 }
+                return false;
             }
 
             public GenericValue getRandomEntity() {
                 GenericValue pickEntity = null;
                 List<GenericValue> lst = UtilGenerics.checkList(templateRoot.get("entityList"));
-                if (Debug.verboseOn()) Debug.logVerbose("in limited, lst:" + lst, "");
+                if (Debug.verboseOn()) {
+                    Debug.logVerbose("in limited, lst:" + lst, "");
+                }
 
                 while (pickEntity == null && lst.size() > 0) {
                     double randomValue = Math.random();
@@ -289,8 +287,9 @@ public class LimitedSubContentCacheTrans
                     } catch (GeneralException e) {
                         throw new IOException(e.getMessage());
                     }
-                    if (!matchFound)
+                    if (!matchFound) {
                         pickEntity = getRandomEntity();
+                    }
                 }
                 return matchFound;
             }

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java Fri Dec 15 20:56:29 2017
@@ -84,7 +84,9 @@ public class LoopSubContentTransform imp
     public static boolean prepCtx(Delegator delegator, Map<String, Object> ctx) {
         List<GenericValue> lst = UtilGenerics.checkList(ctx.get("entityList"));
         Integer idx = (Integer) ctx.get("entityIndex");
-        if (idx == null) idx = Integer.valueOf(0);
+        if (idx == null) {
+            idx = Integer.valueOf(0);
+        }
         int i = idx.intValue();
         if (UtilValidate.isEmpty(lst)) {
             return false;
@@ -147,6 +149,7 @@ public class LoopSubContentTransform imp
         return true;
     }
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final StringBuilder buf = new StringBuilder();
@@ -176,7 +179,9 @@ public class LoopSubContentTransform imp
         if (UtilValidate.isNotEmpty(fromDateStr)) {
             fromDate = UtilDateTime.toTimestamp(fromDateStr);
         }
-        if (fromDate == null) fromDate = UtilDateTime.nowTimestamp();
+        if (fromDate == null) {
+            fromDate = UtilDateTime.nowTimestamp();
+        }
 
         String thisContentId = (String) templateCtx.get("contentId");
 
@@ -204,9 +209,8 @@ public class LoopSubContentTransform imp
                 boolean inProgress = prepCtx(delegator, templateCtx);
                 if (inProgress) {
                     return TransformControl.EVALUATE_BODY;
-                } else {
-                    return TransformControl.SKIP_BODY;
                 }
+                return TransformControl.SKIP_BODY;
             }
 
             @Override
@@ -214,9 +218,8 @@ public class LoopSubContentTransform imp
                 boolean inProgress = prepCtx(delegator, templateCtx);
                 if (inProgress) {
                     return TransformControl.REPEAT_EVALUATION;
-                } else {
-                    return TransformControl.END_EVALUATION;
                 }
+                return TransformControl.END_EVALUATION;
             }
 
             @Override
@@ -238,7 +241,9 @@ public class LoopSubContentTransform imp
                     templateRoot.put("context", templateCtx);
 
                     Locale locale = (Locale) templateCtx.get("locale");
-                    if (locale == null) locale = Locale.getDefault();
+                    if (locale == null) {
+                        locale = Locale.getDefault();
+                    }
                     String mimeTypeId = (String) templateCtx.get("mimeTypeId");
                     try {
                         ContentWorker.renderContentAsText(dispatcher, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, true);

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/OfbizContentAltUrlTransforms.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/OfbizContentAltUrlTransforms.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/OfbizContentAltUrlTransforms.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/OfbizContentAltUrlTransforms.java Fri Dec 15 20:56:29 2017
@@ -61,23 +61,23 @@ public class OfbizContentAltUrlTransform
         }
         return null;
     }
-    
+
     @Override
     public Writer getWriter(final Writer out, final Map args)
             throws TemplateModelException, IOException {
         final StringBuilder buf = new StringBuilder();
         return new Writer(out) {
-            
+
             @Override
             public void write(char[] cbuf, int off, int len) throws IOException {
                 buf.append(cbuf, off, len);
             }
-            
+
             @Override
             public void flush() throws IOException {
                 out.flush();
             }
-            
+
             @Override
             public void close() throws IOException {
                 try {
@@ -130,8 +130,6 @@ public class OfbizContentAltUrlTransform
             }
         } catch (GenericEntityException gee) {
             Debug.logWarning("[Exception] : " + gee.getMessage(), module);
-        } catch (Exception e) {
-            Debug.logWarning("[Exception] : " + e.getMessage(), module);
         }
 
         if (UtilValidate.isEmpty(url)) {

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java Fri Dec 15 20:56:29 2017
@@ -46,6 +46,7 @@ public class RenderContentAndSubContent
 
     public static final String module = RenderContentAndSubContent.class.getName();
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final Environment env = Environment.getCurrentEnvironment();
@@ -54,7 +55,9 @@ public class RenderContentAndSubContent
         final Map<String, Object> envMap = FreeMarkerWorker.createEnvironmentMap(env);
         final MapStack<String> templateRoot = MapStack.create();
         ((MapStack)templateRoot).push(envMap);
-        if (Debug.verboseOn()) Debug.logVerbose("in RenderContentAndSubContent, contentId(0):" + templateRoot.get("contentId"), module);
+        if (Debug.verboseOn()) {
+            Debug.logVerbose("in RenderContentAndSubContent, contentId(0):" + templateRoot.get("contentId"), module);
+        }
         FreeMarkerWorker.getSiteParameters(request, templateRoot);
         FreeMarkerWorker.overrideWithArgs(templateRoot, args);
 
@@ -84,8 +87,12 @@ public class RenderContentAndSubContent
                     locale = UtilMisc.ensureLocale(localeObject);
                 }
 
-                if (Debug.verboseOn()) Debug.logVerbose("in RenderContentAndSubContent, contentId(2):" + templateRoot.get("contentId"), module);
-                if (Debug.verboseOn()) Debug.logVerbose("in RenderContentAndSubContent, subContentId(2):" + templateRoot.get("subContentId"), module);
+                if (Debug.verboseOn()) {
+                    Debug.logVerbose("in RenderContentAndSubContent, contentId(2):" + templateRoot.get("contentId"), module);
+                }
+                if (Debug.verboseOn()) {
+                    Debug.logVerbose("in RenderContentAndSubContent, subContentId(2):" + templateRoot.get("subContentId"), module);
+                }
                     try {
                         String contentId = (String)templateRoot.get("contentId");
                         String mapKey = (String)templateRoot.get("mapKey");

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java Fri Dec 15 20:56:29 2017
@@ -55,6 +55,7 @@ public class RenderContentAsText impleme
     static final String [] upSaveKeyNames = {"globalNodeTrail"};
     static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale",  "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"};
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final Environment env = Environment.getCurrentEnvironment();
@@ -66,7 +67,7 @@ public class RenderContentAsText impleme
             Debug.logVerbose("in RenderSubContent, contentId(0):" + templateRoot.get("contentId"), module);
         }
         FreeMarkerWorker.getSiteParameters(request, templateRoot);
-        final Map<String, Object> savedValuesUp = new HashMap<String, Object>();
+        final Map<String, Object> savedValuesUp = new HashMap<>();
         FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp);
         FreeMarkerWorker.overrideWithArgs(templateRoot, args);
         if (Debug.verboseOn()) {
@@ -79,7 +80,7 @@ public class RenderContentAsText impleme
             Debug.logVerbose("in Render(0), directAssocMode ." + directAssocMode , module);
         }
 
-        final Map<String, Object> savedValues = new HashMap<String, Object>();
+        final Map<String, Object> savedValues = new HashMap<>();
 
         return new Writer(out) {
 

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java?rev=1818335&r1=1818334&r2=1818335&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java Fri Dec 15 20:56:29 2017
@@ -51,6 +51,7 @@ public class RenderContentTransform impl
 
     public static final String module = RenderContentTransform.class.getName();
 
+    @Override
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final Environment env = Environment.getCurrentEnvironment();