Author: mbrohl
Date: Sun Oct 22 12:46:33 2017 New Revision: 1812908 URL: http://svn.apache.org/viewvc?rev=1812908&view=rev Log: Improved: Fixing defects reported by FindBugs, package org.apache.ofbiz.widget.renderer. (OFBIZ-9704) Applied a modified version of the patch, the null check for menuWarapper in MenuWrapTransfor is needed. Thanks Julian Leichert for reporting and providing the patch. Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java?rev=1812908&r1=1812907&r2=1812908&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java Sun Oct 22 12:46:33 2017 @@ -74,9 +74,10 @@ public class FormRenderer { Locale locale = UtilMisc.ensureLocale(context.get("locale")); String retVal = FlexibleStringExpander.expandString(modelForm.getContainerId(), context, locale); Integer itemIndex = (Integer) context.get("itemIndex"); - if (itemIndex != null/* && "list".equals(modelForm.getType())*/) { + if (itemIndex != null/* && "list".equals(modelForm.getType()) */) { if (UtilValidate.isNotEmpty(context.get("parentItemIndex"))) { - return retVal + context.get("parentItemIndex") + modelForm.getItemIndexSeparator() + itemIndex.intValue(); + return retVal + context.get("parentItemIndex") + modelForm.getItemIndexSeparator() + itemIndex + .intValue(); } return retVal + modelForm.getItemIndexSeparator() + itemIndex.intValue(); } @@ -172,6 +173,9 @@ public class FormRenderer { // don't add to already rendered here, or the hyperlink won't ger rendered: if (alreadyRendered != null) alreadyRendered.add(modelFormField.getName()); } break; + + default: + break; } } return hiddenIgnoredFieldList; @@ -515,6 +519,8 @@ public class FormRenderer { case FieldInfo.HYPERLINK: formStringRenderer.renderHiddenField(writer, context, modelFormField, modelFormField.getEntry(context)); break; + default: + break; } } } @@ -1060,7 +1066,6 @@ public class FormRenderer { nextFormField = null; } else { // at the end... - lastFormField = currentFormField; currentFormField = null; // nextFormField is already null break; @@ -1143,11 +1148,6 @@ public class FormRenderer { nextPositionInRow = Integer.valueOf(nextFormField.getPosition()); } else { positionSpan = positions - currentFormField.getPosition(); - if (!stayingOnRow && nextFormField.getPosition() > 1) { - // TODO: here is a weird case where it is setup such - //that the first position(s) in the row are skipped - // not sure what to do about this right now... - } } } Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java?rev=1812908&r1=1812907&r2=1812908&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java Sun Oct 22 12:46:33 2017 @@ -72,7 +72,7 @@ public class MenuWrapTransform implement public static final String [] upSaveKeyNames = {"globalNodeTrail"}; public static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "renderOnStart", "renderOnClose", "menuDefFile", "menuName", "associatedContentId", "wrapperClassName"}; - + @SuppressWarnings("rawtypes") public Writer getWriter(final Writer out, Map args) { final Environment env = Environment.getCurrentEnvironment(); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java?rev=1812908&r1=1812907&r2=1812908&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java Sun Oct 22 12:46:33 2017 @@ -222,9 +222,8 @@ public class ScreenRenderer { context.put("response", response); context.put("session", session); context.put("application", servletContext); - if (session != null) { - context.put("webappName", session.getAttribute("_WEBAPP_NAME_")); - } + context.put("webappName", session.getAttribute("_WEBAPP_NAME_")); + if (servletContext != null) { String rootDir = (String) context.get("rootDir"); String webSiteId = (String) context.get("webSiteId"); @@ -250,11 +249,11 @@ public class ScreenRenderer { TaglibFactory JspTaglibs = new TaglibFactory(servletContext); context.put("JspTaglibs", JspTaglibs); context.put("requestParameters", UtilHttp.getParameterMap(request)); - + ServletContextHashModel ftlServletContext = (ServletContextHashModel) request.getAttribute("ftlServletContext"); context.put("Application", ftlServletContext); context.put("Request", context.get("requestAttributes")); - + // some information from/about the ControlServlet environment context.put("controlPath", request.getAttribute("_CONTROL_PATH_")); context.put("contextRoot", request.getAttribute("_CONTEXT_ROOT_")); |
Free forum by Nabble | Edit this page |