Author: deepak
Date: Mon Oct 16 10:32:22 2017 New Revision: 1812279 URL: http://svn.apache.org/viewvc?rev=1812279&view=rev Log: Inconsistent String Comparisons, Applied patch for framework entityext, webapp, webtools and widgets classes. Thanks Devanshu Vyas for your contribution (OFBIZ-9254) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/Main.java ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/GenericWebEvent.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.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/html/HtmlMenuRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlTreeRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/Main.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/Main.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/Main.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/Main.java Mon Oct 16 10:32:22 2017 @@ -23,15 +23,15 @@ import org.apache.shiro.crypto.AesCipher public class Main { public static void main(String[] args) throws Exception { - if (args[0].equals("-crypt")) { + if ("-crypt".equals(args[0])) { System.out.println(HashCrypt.cryptUTF8(args[1], null, args[2])); - } else if (args[0].equals("-digest")) { + } else if ("-digest".equals(args[0])) { String digest = HashCrypt.digestHash("SHA", null, args[1]); System.out.println(digest); - } else if (args[0].equals("-kek")) { + } else if ("-kek".equals(args[0])) { AesCipherService cs = new AesCipherService(); System.out.println(Base64.encodeBase64String(cs.generateNewKey().getEncoded())); - } else if (args[0].equals("-kek-old")) { + } else if ("-kek-old".equals(args[0])) { System.out.println(Base64.encodeBase64String(DesCrypt.generateKey().getEncoded())); } } Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java Mon Oct 16 10:32:22 2017 @@ -253,7 +253,7 @@ public class RequestHandler { boolean isForwardedSecure = UtilValidate.isNotEmpty(forwardedProto) && "HTTPS".equals(forwardedProto.toUpperCase()); if ((!request.isSecure() && !isForwardedSecure) && requestMap.securityHttps) { // If the request method was POST then return an error to avoid problems with XSRF where the request may have come from another machine/program and had the same session ID but was not encrypted as it should have been (we used to let it pass to not lose data since it was too late to protect that data anyway) - if (request.getMethod().equalsIgnoreCase("POST")) { + if ("POST".equalsIgnoreCase(request.getMethod())) { // we can't redirect with the body parameters, and for better security from XSRF, just return an error message Locale locale = UtilHttp.getLocale(request); String errMsg = UtilProperties.getMessage("WebappUiLabels", "requestHandler.InsecureFormPostToSecureRequest", locale); @@ -339,7 +339,7 @@ public class RequestHandler { String returnString = this.runEvent(request, response, event, null, "firstvisit"); if (returnString == null || "none".equalsIgnoreCase(returnString)) { interruptRequest = true; - } else if (!returnString.equalsIgnoreCase("success")) { + } else if (!"success".equalsIgnoreCase(returnString)) { throw new EventHandlerException("First-Visit event did not return 'success'."); } } catch (EventHandlerException e) { @@ -359,7 +359,7 @@ public class RequestHandler { String returnString = this.runEvent(request, response, event, null, "preprocessor"); if (returnString == null || "none".equalsIgnoreCase(returnString)) { interruptRequest = true; - } else if (!returnString.equalsIgnoreCase("success")) { + } else if (!"success".equalsIgnoreCase(returnString)) { if (!returnString.contains(":_protect_:")) { throw new EventHandlerException("Pre-Processor event [" + event.invoke + "] did not return 'success'."); } else { // protect the view normally rendered and redirect to error response view @@ -488,7 +488,7 @@ public class RequestHandler { eventReturnBasedRequestResponse = null; } else { eventReturnBasedRequestResponse = requestMap.requestResponseMap.get(eventReturn); - if (eventReturnBasedRequestResponse == null && eventReturn.equals("none")) { + if (eventReturnBasedRequestResponse == null && "none".equals(eventReturn)) { eventReturnBasedRequestResponse = ConfigXMLReader.emptyNoneRequestResponse; } } @@ -540,7 +540,7 @@ public class RequestHandler { if (Debug.verboseOn()) Debug.logVerbose("[RequestHandler]: previousRequest - " + previousRequest + " (" + loginPass + ")" + showSessionId(request), module); // if previous request exists, and a login just succeeded, do that now. - if (previousRequest != null && loginPass != null && loginPass.equalsIgnoreCase("TRUE")) { + if (previousRequest != null && loginPass != null && "TRUE".equalsIgnoreCase(loginPass)) { request.getSession().removeAttribute("_PREVIOUS_REQUEST_"); // special case to avoid login/logout looping: if request was "logout" before the login, change to null for default success view; do the same for "login" to avoid going back to the same page if ("logout".equals(previousRequest) || "/logout".equals(previousRequest) || "login".equals(previousRequest) || "/login".equals(previousRequest) || "checkLogin".equals(previousRequest) || "/checkLogin".equals(previousRequest) || "/checkLogin/login".equals(previousRequest)) { @@ -607,7 +607,7 @@ public class RequestHandler { for (ConfigXMLReader.Event event: controllerConfig.getPostprocessorEventList().values()) { try { String returnString = this.runEvent(request, response, event, requestMap, "postprocessor"); - if (returnString != null && !returnString.equalsIgnoreCase("success")) { + if (returnString != null && !"success".equalsIgnoreCase(returnString)) { throw new EventHandlerException("Post-Processor event did not return 'success'."); } } catch (EventHandlerException e) { @@ -1175,7 +1175,7 @@ public class RequestHandler { for (ConfigXMLReader.Event event: getControllerConfig().getAfterLoginEventList().values()) { try { String returnString = this.runEvent(request, response, event, null, "after-login"); - if (returnString != null && !returnString.equalsIgnoreCase("success")) { + if (returnString != null && !"success".equalsIgnoreCase(returnString)) { throw new EventHandlerException("Pre-Processor event did not return 'success'."); } } catch (EventHandlerException e) { @@ -1192,7 +1192,7 @@ public class RequestHandler { for (ConfigXMLReader.Event event: getControllerConfig().getBeforeLogoutEventList().values()) { try { String returnString = this.runEvent(request, response, event, null, "before-logout"); - if (returnString != null && !returnString.equalsIgnoreCase("success")) { + if (returnString != null && !"success".equalsIgnoreCase(returnString)) { throw new EventHandlerException("Pre-Processor event did not return 'success'."); } } catch (EventHandlerException e) { Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java Mon Oct 16 10:32:22 2017 @@ -312,7 +312,7 @@ public class CoreEvents { Map<String, Object> syncServiceResult = null; // schedule service try { - if (null!=request.getParameter("_RUN_SYNC_") && request.getParameter("_RUN_SYNC_").equals("Y")) { + if (null!=request.getParameter("_RUN_SYNC_") && "Y".equals(request.getParameter("_RUN_SYNC_"))) { syncServiceResult = dispatcher.runSync(serviceName, serviceContext); } else { dispatcher.schedule(jobName, poolName, serviceName, serviceContext, startTime, frequency, interval, count, endTime, maxRetry); @@ -342,7 +342,7 @@ public class CoreEvents { return "error"; } - if (null!=request.getParameter("_CLEAR_PREVIOUS_PARAMS_") && request.getParameter("_CLEAR_PREVIOUS_PARAMS_").equalsIgnoreCase("on")) + if (null!=request.getParameter("_CLEAR_PREVIOUS_PARAMS_") && "on".equalsIgnoreCase(request.getParameter("_CLEAR_PREVIOUS_PARAMS_"))) session.removeAttribute("_SAVED_SYNC_RESULT_"); Map<String, String[]> serviceFieldsToSave = checkMap(request.getParameterMap(), String.class, String[].class); Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/GenericWebEvent.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/GenericWebEvent.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/GenericWebEvent.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/GenericWebEvent.java Mon Oct 16 10:32:22 2017 @@ -151,7 +151,7 @@ public class GenericWebEvent { } // if this is a delete, do that before getting all of the non-pk parameters and validating them - if (updateMode.equals("DELETE")) { + if ("DELETE".equals(updateMode)) { // Remove associated/dependent entries from other tables here // Delete actual main entity last, just in case database is set up to do a cascading delete, caches won't get cleared try { @@ -203,7 +203,7 @@ public class GenericWebEvent { // if the updateMode is CREATE, check to see if an entity with the specified primary key already exists - if (updateMode.equals("CREATE")) { + if ("CREATE".equals(updateMode)) { GenericValue tempEntity = null; try { @@ -291,7 +291,7 @@ public class GenericWebEvent { return "error"; } - if (updateMode.equals("CREATE")) { + if ("CREATE".equals(updateMode)) { try { delegator.create(findByEntity.getEntityName(), findByEntity.getAllFields()); } catch (GenericEntityException e) { @@ -301,7 +301,7 @@ public class GenericWebEvent { request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } - } else if (updateMode.equals("UPDATE")) { + } else if ("UPDATE".equals(updateMode)) { GenericValue value = delegator.makeValue(findByEntity.getEntityName(), findByEntity.getAllFields()); try { Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java Mon Oct 16 10:32:22 2017 @@ -87,7 +87,7 @@ public class ControllerRequestArtifactIn } catch (GeneralException e) { Debug.logWarning(e.toString(), module); } - } else if (response.type.equals("request")) { + } else if ("request".equals(response.type)) { String otherRequestUri = response.value; if (otherRequestUri.startsWith("/")) { otherRequestUri = otherRequestUri.substring(1); @@ -99,12 +99,12 @@ public class ControllerRequestArtifactIn } catch (GeneralException e) { Debug.logWarning(e.toString(), module); } - } else if (response.type.equals("request-redirect")) { + } else if ("request-redirect".equals(response.type)) { String otherRequestUri = response.value; ControllerRequestArtifactInfo artInfo = this.aif.getControllerRequestArtifactInfo(controllerXmlUrl, otherRequestUri); this.requestsThatAreResponsesToThisRequest.add(artInfo); UtilMisc.addToSortedSetInMap(this, this.aif.allRequestInfosReferringToRequest, artInfo.getUniqueId()); - } else if (response.type.equals("request-redirect-noparam")) { + } else if ("request-redirect-noparam".equals(response.type)) { String otherRequestUri = response.value; ControllerRequestArtifactInfo artInfo = this.aif.getControllerRequestArtifactInfo(controllerXmlUrl, otherRequestUri); this.requestsThatAreResponsesToThisRequest.add(artInfo); Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Mon Oct 16 10:32:22 2017 @@ -88,7 +88,7 @@ public class SaveLabelsToXmlFile { } else if (UtilValidate.isNotEmpty(confirm)) { LabelInfo label = labels.get(key + LabelManagerFactory.keySeparator + fileName); // Update a Label - if (updateLabel.equalsIgnoreCase("Y")) { + if ("Y".equalsIgnoreCase(updateLabel)) { if (UtilValidate.isNotEmpty(label)) { factory.updateLabelValue(localeNames, localeValues, localeComments, label, key, keyComment, fileName); } Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java Mon Oct 16 10:32:22 2017 @@ -799,7 +799,7 @@ public abstract class AbstractModelActio // default to false boolean global = "true".equals(globalStr); Object newValue = null; - if (this.fromScope != null && this.fromScope.equals("user")) { + if (this.fromScope != null && "user".equals(this.fromScope)) { if (!this.fromField.isEmpty()) { HttpSession session = (HttpSession) context.get("session"); newValue = getInMemoryPersistedFromField(session, context); @@ -809,7 +809,7 @@ public abstract class AbstractModelActio } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expand(context); } - } else if (this.fromScope != null && this.fromScope.equals("application")) { + } else if (this.fromScope != null && "application".equals(this.fromScope)) { if (!this.fromField.isEmpty()) { ServletContext servletContext = (ServletContext) context.get("application"); newValue = getInMemoryPersistedFromField(servletContext, context); @@ -860,7 +860,7 @@ public abstract class AbstractModelActio Debug.logWarning("Field value not found (empty) for the field: [" + this.field.getOriginalName() + " and there was no default value, so field was not set", module); return; } - if (this.toScope != null && this.toScope.equals("user")) { + if (this.toScope != null && "user".equals(this.toScope)) { String originalName = this.field.getOriginalName(); List<String> currentWidgetTrail = UtilGenerics.toList(context.get("_WIDGETTRAIL_")); String newKey = ""; @@ -876,7 +876,7 @@ public abstract class AbstractModelActio if (Debug.verboseOn()) Debug.logVerbose("In user setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module); - } else if (this.toScope != null && this.toScope.equals("application")) { + } else if (this.toScope != null && "application".equals(this.toScope)) { String originalName = this.field.getOriginalName(); List<String> currentWidgetTrail = UtilGenerics.toList(context.get("_WIDGETTRAIL_")); String newKey = ""; Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java Mon Oct 16 10:32:22 2017 @@ -317,7 +317,7 @@ public class IterateSectionWidget extend StringBuilder linkText = new StringBuilder(targetService); if (linkText.indexOf("?") < 0) linkText.append("?"); else linkText.append("&"); - //if (queryString != null && !queryString.equals("null")) linkText += queryString + "&"; + //if (queryString != null && !"null".equals(queryString)) linkText += queryString + "&"; if (UtilValidate.isNotEmpty(queryString)) { linkText.append(queryString).append("&"); } Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java Mon Oct 16 10:32:22 2017 @@ -629,7 +629,7 @@ public abstract class ModelForm extends for (Element fieldElement : UtilXml.childElementList(formElement, "field")) { ModelFormFieldBuilder builder = new ModelFormFieldBuilder(fieldElement, this, entityModelReader, dispatchContext); FieldInfo fieldInfo = builder.getFieldInfo(); - if (thisType.equals("multi") && fieldInfo instanceof ModelFormField.SubmitField) { + if ("multi".equals(thisType) && fieldInfo instanceof ModelFormField.SubmitField) { multiSubmitBuilders.add(builder); } else { addUpdateField(builder, useWhenFields, fieldBuilderList, fieldBuilderMap); @@ -643,21 +643,21 @@ public abstract class ModelForm extends // read in sort-field for (Element sortFieldElement : UtilXml.childElementList(sortOrderElement)) { String tagName = sortFieldElement.getTagName(); - if (tagName.equals("sort-field")) { + if ("sort-field".equals(tagName)) { String fieldName = sortFieldElement.getAttribute("name"); String position = sortFieldElement.getAttribute("position"); sortOrderFields.add(new SortField(fieldName, position)); fieldGroupMap.put(fieldName, lastFieldGroup); - } else if (tagName.equals("last-field")) { + } else if ("last-field".equals(tagName)) { String fieldName = sortFieldElement.getAttribute("name"); fieldGroupMap.put(fieldName, lastFieldGroup); lastOrderFields.add(fieldName); - } else if (tagName.equals("banner")) { + } else if ("banner".equals(tagName)) { Banner thisBanner = new Banner(sortFieldElement); fieldGroupList.add(thisBanner); lastFieldGroup = new FieldGroup(null, this, sortOrderFields, fieldGroupMap); fieldGroupList.add(lastFieldGroup); - } else if (tagName.equals("field-group")) { + } else if ("field-group".equals(tagName)) { FieldGroup thisFieldGroup = new FieldGroup(sortFieldElement, this, sortOrderFields, fieldGroupMap); fieldGroupList.add(thisFieldGroup); lastFieldGroup = new FieldGroup(null, this, sortOrderFields, fieldGroupMap); @@ -1356,7 +1356,7 @@ public abstract class ModelForm extends + retVal.getClass().getName() + " [" + retVal + "] of form " + getName()); } - if (condTrue && !targetType.equals("inter-app")) { + if (condTrue && !"inter-app".equals(targetType)) { return altTarget.targetExdr.expandString(expanderContext); } } Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java Mon Oct 16 10:32:22 2017 @@ -99,7 +99,7 @@ public abstract class ModelMenuAction { boolean global = "true".equals(globalStr); Object newValue = null; - if (this.fromScope != null && this.fromScope.equals("user")) { + if (this.fromScope != null && "user".equals(this.fromScope)) { if (!this.fromField.isEmpty()) { String originalName = this.fromField.getOriginalName(); String currentWidgetTrail = (String)context.get("_WIDGETTRAIL_"); @@ -111,7 +111,7 @@ public abstract class ModelMenuAction { newValue = this.valueExdr.expandString(context); } - } else if (this.fromScope != null && this.fromScope.equals("application")) { + } else if (this.fromScope != null && "application".equals(this.fromScope)) { if (!this.fromField.isEmpty()) { String originalName = this.fromField.getOriginalName(); String currentWidgetTrail = (String)context.get("_WIDGETTRAIL_"); @@ -154,7 +154,7 @@ public abstract class ModelMenuAction { } } } - if (this.toScope != null && this.toScope.equals("user")) { + if (this.toScope != null && "user".equals(this.toScope)) { String originalName = this.field.getOriginalName(); String currentWidgetTrail = (String)context.get("_WIDGETTRAIL_"); String newKey = currentWidgetTrail + "|" + originalName; @@ -162,7 +162,7 @@ public abstract class ModelMenuAction { session.setAttribute(newKey, newValue); if (Debug.verboseOn()) Debug.logVerbose("In user setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module); - } else if (this.toScope != null && this.toScope.equals("application")) { + } else if (this.toScope != null && "application".equals(this.toScope)) { String originalName = this.field.getOriginalName(); String currentWidgetTrail = (String)context.get("_WIDGETTRAIL_"); String newKey = currentWidgetTrail + "|" + originalName; Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java Mon Oct 16 10:32:22 2017 @@ -110,7 +110,7 @@ public class ModelMenuItem extends Model this.selectedStyle = menuItemElement.getAttribute("selected-style"); String hideIfSelected = menuItemElement.getAttribute("hide-if-selected"); if (!hideIfSelected.isEmpty()) - if (hideIfSelected.equalsIgnoreCase("true")) + if ("true".equalsIgnoreCase(hideIfSelected)) this.hideIfSelected = Boolean.TRUE; else this.hideIfSelected = Boolean.FALSE; Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java Mon Oct 16 10:32:22 2017 @@ -98,7 +98,7 @@ public class ModelTree extends ModelWidg this.rootNodeName = treeElement.getAttribute("root-node-name"); String defaultRenderStyle = UtilXml.checkEmpty(treeElement.getAttribute("default-render-style"), "simple"); // A temporary hack to accommodate those who might still be using "render-style" instead of "default-render-style" - if (defaultRenderStyle.isEmpty() || defaultRenderStyle.equals("simple")) { + if (defaultRenderStyle.isEmpty() || "simple".equals(defaultRenderStyle)) { String rStyle = treeElement.getAttribute("render-style"); if (!rStyle.isEmpty()) defaultRenderStyle = rStyle; @@ -538,7 +538,7 @@ public class ModelTree extends ModelWidg public boolean isExpandCollapse() { boolean isExpCollapse = false; String rStyle = getRenderStyle(); - if (rStyle != null && rStyle.equals("expand-collapse")) + if (rStyle != null && "expand-collapse".equals(rStyle)) isExpCollapse = true; return isExpCollapse; } @@ -546,7 +546,7 @@ public class ModelTree extends ModelWidg public boolean isFollowTrail() { boolean isFollowTrail = false; String rStyle = getRenderStyle(); - if (rStyle != null && (rStyle.equals("follow-trail") || rStyle.equals("show-peers") || rStyle.equals("follow-trail"))) { + if (rStyle != null && ("follow-trail".equals(rStyle) || "show-peers".equals(rStyle) || "follow-trail".equals(rStyle))) { isFollowTrail = true; } return isFollowTrail; @@ -671,7 +671,7 @@ public class ModelTree extends ModelWidg } else if (!isFollowTrail()) { showPeers = true; } else if ((currentDepth < trailSize) && (rStyle != null) - && (rStyle.equals("show-peers") || rStyle.equals("expand-collapse"))) { + && ("show-peers".equals(rStyle) || "expand-collapse".equals(rStyle))) { showPeers = true; } else if (openDepth >= currentDepth) { showPeers = true; 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=1812279&r1=1812278&r2=1812279&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 Mon Oct 16 10:32:22 2017 @@ -97,7 +97,7 @@ public class MenuWrapTransform implement List<Map<String, ? extends Object>> trail = UtilGenerics.checkList(templateCtx.get("globalNodeTrail")); String contentAssocPredicateId = (String)templateCtx.get("contentAssocPredicateId"); String strNullThruDatesOnly = (String)templateCtx.get("nullThruDatesOnly"); - Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && strNullThruDatesOnly.equalsIgnoreCase("true")) ? Boolean.TRUE :Boolean.FALSE; + Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && "true".equalsIgnoreCase(strNullThruDatesOnly)) ? Boolean.TRUE :Boolean.FALSE; GenericValue val = null; try { if (WidgetContentWorker.getContentWorker() != null) { @@ -151,7 +151,7 @@ public class MenuWrapTransform implement @Override public int onStart() throws TemplateModelException, IOException { String renderOnStart = (String)templateCtx.get("renderOnStart"); - if (renderOnStart != null && renderOnStart.equalsIgnoreCase("true")) { + if (renderOnStart != null && "true".equalsIgnoreCase(renderOnStart)) { renderMenu(); } return TransformControl.EVALUATE_BODY; @@ -173,7 +173,7 @@ public class MenuWrapTransform implement String wrappedContent = buf.toString(); out.write(wrappedContent); String renderOnClose = (String)templateCtx.get("renderOnClose"); - if (renderOnClose == null || !renderOnClose.equalsIgnoreCase("false")) { + if (renderOnClose == null || !"false".equalsIgnoreCase(renderOnClose)) { renderMenu(); } FreeMarkerWorker.reloadValues(templateCtx, savedValuesUp, env); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRenderer.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRenderer.java Mon Oct 16 10:32:22 2017 @@ -485,7 +485,7 @@ public class HtmlMenuRenderer extends Ht boolean encode = false; HttpServletResponse response = (HttpServletResponse) context.get("response"); HttpServletRequest request = (HttpServletRequest) context.get("request"); - if (urlMode != null && urlMode.equalsIgnoreCase("ofbiz")) { + if (urlMode != null && "ofbiz".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); @@ -494,7 +494,7 @@ public class HtmlMenuRenderer extends Ht } else { writer.append(src); } - } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { + } else if (urlMode != null && "content".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlTreeRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlTreeRenderer.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlTreeRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlTreeRenderer.java Mon Oct 16 10:32:22 2017 @@ -224,7 +224,7 @@ public class HtmlTreeRenderer extends Ht String prefix = link.getPrefix(context); HttpServletResponse res = (HttpServletResponse) context.get("response"); HttpServletRequest req = (HttpServletRequest) context.get("request"); - if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { + if (urlMode != null && "intra-app".equalsIgnoreCase(urlMode)) { if (req != null && res != null) { WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), link.getFullPath(), link.getSecure(), link.getEncode(), req, res, context); @@ -233,7 +233,7 @@ public class HtmlTreeRenderer extends Ht } else { writer.append(target); } - } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { + } else if (urlMode != null && "content".equalsIgnoreCase(urlMode)) { StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(req, newURL); newURL.append(target); @@ -309,7 +309,7 @@ public class HtmlTreeRenderer extends Ht boolean encode = false; HttpServletResponse response = (HttpServletResponse) context.get("response"); HttpServletRequest request = (HttpServletRequest) context.get("request"); - if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { + if (urlMode != null && "intra-app".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); @@ -318,7 +318,7 @@ public class HtmlTreeRenderer extends Ht } else { writer.append(src); } - } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { + } else if (urlMode != null && "content".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java Mon Oct 16 10:32:22 2017 @@ -1480,7 +1480,7 @@ public final class MacroFormRenderer imp if (UtilValidate.isNotEmpty(queryStringMap)) { inputFields.putAll(queryStringMap); } - if (modelForm.getType().equals("multi")) { + if ("multi".equals(modelForm.getType())) { inputFields = UtilHttp.removeMultiFormParameters(inputFields); } String queryString = UtilHttp.urlEncodeArgs(inputFields); @@ -2319,9 +2319,9 @@ public final class MacroFormRenderer imp commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale")); } // for legacy support, the viewSizeParam is VIEW_SIZE and viewIndexParam is VIEW_INDEX when the fields are "viewSize" and "viewIndex" - if (viewIndexParam.equals("viewIndex" + "_" + paginatorNumber)) + if (("viewIndex" + "_" + paginatorNumber).equals(viewIndexParam)) viewIndexParam = "VIEW_INDEX" + "_" + paginatorNumber; - if (viewSizeParam.equals("viewSize" + "_" + paginatorNumber)) + if (("viewSize" + "_" + paginatorNumber).equals(viewSizeParam)) viewSizeParam = "VIEW_SIZE" + "_" + paginatorNumber; String str = (String) context.get("_QBESTRING_"); // strip legacy viewIndex/viewSize params from the query string @@ -2351,7 +2351,7 @@ public final class MacroFormRenderer imp } else if (!prepLinkText.endsWith("?")) { prepLinkText += "&"; } - if (UtilValidate.isNotEmpty(queryString) && !queryString.equals("null")) { + if (UtilValidate.isNotEmpty(queryString) && !"null".equals(queryString)) { prepLinkText += queryString + "&"; } prepLinkSizeText = prepLinkText + viewSizeParam + "='+this.value+'" + "&" + viewIndexParam + "=0"; @@ -2852,7 +2852,7 @@ public final class MacroFormRenderer imp if (oldSortField.equals(columnField)) { newSortField = "-" + columnField; sortFieldStyle = modelFormField.getSortFieldStyleDesc(); - } else if (oldSortField.equals("-" + columnField)) { + } else if (("-" + columnField).equals(oldSortField)) { newSortField = columnField; sortFieldStyle = modelFormField.getSortFieldStyleAsc(); } @@ -3079,10 +3079,10 @@ public final class MacroFormRenderer imp String viewSizeField = modelForm.getMultiPaginateSizeField(context); int viewIndex = Paginator.getViewIndex(modelForm, context); int viewSize = Paginator.getViewSize(modelForm, context); - if (viewIndexField.equals("viewIndex" + "_" + paginatorNumber)) { + if (("viewIndex" + "_" + paginatorNumber).equals(viewIndexField)) { viewIndexField = "VIEW_INDEX" + "_" + paginatorNumber; } - if (viewSizeField.equals("viewSize" + "_" + paginatorNumber)) { + if (("viewSize" + "_" + paginatorNumber).equals(viewSizeField)) { viewSizeField = "VIEW_SIZE" + "_" + paginatorNumber; } if ("hidden-form".equals(realLinkType)) { Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java Mon Oct 16 10:32:22 2017 @@ -327,7 +327,7 @@ public class MacroScreenRenderer impleme HttpServletResponse response = (HttpServletResponse) context.get("response"); HttpServletRequest request = (HttpServletRequest) context.get("request"); String urlString = ""; - if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { + if (urlMode != null && "intra-app".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); @@ -335,7 +335,7 @@ public class MacroScreenRenderer impleme } else { urlString = src; } - } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { + } else if (urlMode != null && "content".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); @@ -732,15 +732,15 @@ public class MacroScreenRenderer impleme } // for legacy support, the viewSizeParam is VIEW_SIZE and viewIndexParam is VIEW_INDEX when the fields are "viewSize" and "viewIndex" - if (viewIndexParam.equals("viewIndex" + "_" + paginatorNumber)) viewIndexParam = "VIEW_INDEX" + "_" + paginatorNumber; - if (viewSizeParam.equals("viewSize" + "_" + paginatorNumber)) viewSizeParam = "VIEW_SIZE" + "_" + paginatorNumber; + if (("viewIndex" + "_" + paginatorNumber).equals(viewIndexParam)) viewIndexParam = "VIEW_INDEX" + "_" + paginatorNumber; + if (("viewSize" + "_" + paginatorNumber).equals(viewSizeParam)) viewSizeParam = "VIEW_SIZE" + "_" + paginatorNumber; ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); Map<String, Object> inputFields = UtilGenerics.toMap(context.get("requestParameters")); // strip out any multi form fields if the form is of type multi - if (modelForm.getType().equals("multi")) { + if ("multi".equals(modelForm.getType())) { inputFields = UtilHttp.removeMultiFormParameters(inputFields); } String queryString = UtilHttp.urlEncodeArgs(inputFields); @@ -764,7 +764,7 @@ public class MacroScreenRenderer impleme } else if (!prepLinkText.endsWith("?")) { prepLinkText += "&"; } - if (UtilValidate.isNotEmpty(queryString) && !queryString.equals("null")) { + if (UtilValidate.isNotEmpty(queryString) && !"null".equals(queryString)) { prepLinkText += queryString + "&"; } prepLinkText += viewSizeParam + "=" + viewSize + "&" + viewIndexParam + "="; Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java?rev=1812279&r1=1812278&r2=1812279&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java Mon Oct 16 10:32:22 2017 @@ -320,7 +320,7 @@ public class MacroTreeRenderer implement boolean encode = false; String urlString = ""; - if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { + if (urlMode != null && "intra-app".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); @@ -328,7 +328,7 @@ public class MacroTreeRenderer implement } else { urlString = src; } - } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { + } else if (urlMode != null && "content".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); |
Free forum by Nabble | Edit this page |