svn commit: r1812264 - in /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service: ./ calendar/ eca/ engine/ group/ jms/ mail/ rmi/

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

svn commit: r1812264 - in /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service: ./ calendar/ eca/ engine/ group/ jms/ mail/ rmi/

Deepak Dixit-5
Author: deepak
Date: Mon Oct 16 09:25:36 2017
New Revision: 1812264

URL: http://svn.apache.org/viewvc?rev=1812264&view=rev
Log:
Inconsistent String Comparisons, Applied patch for framework service classes.
Thanks Devanshu Vyas for your contribution (OFBIZ-9254)

Modified:
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaAction.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java Mon Oct 16 09:25:36 2017
@@ -1116,7 +1116,7 @@ public class ModelService extends Abstra
     public synchronized void interfaceUpdate(DispatchContext dctx) throws GenericServiceException {
         if (!inheritedParameters) {
             // services w/ engine 'group' auto-implement the grouped services
-            if (this.engineName.equals("group") && implServices.size() == 0) {
+            if ("group".equals(this.engineName) && implServices.size() == 0) {
                 GroupModel group = internalGroup;
                 if (group == null) {
                     group = ServiceGroupReader.getGroupModel(this.location);

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java Mon Oct 16 09:25:36 2017
@@ -50,7 +50,7 @@ public class RecurrenceInfo {
     /** Creates new RecurrenceInfo */
     public RecurrenceInfo(GenericValue info) throws RecurrenceInfoException {
         this.info = info;
-        if (!info.getEntityName().equals("RecurrenceInfo"))
+        if (!"RecurrenceInfo".equals(info.getEntityName()))
             throw new RecurrenceInfoException("Invalid RecurrenceInfo Value object.");
         init();
     }

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java Mon Oct 16 09:25:36 2017
@@ -106,7 +106,7 @@ public class RecurrenceRule {
      */
     public RecurrenceRule(GenericValue rule) throws RecurrenceRuleException {
         this.rule = rule;
-        if (!rule.getEntityName().equals("RecurrenceRule"))
+        if (!"RecurrenceRule".equals(rule.getEntityName()))
             throw new RecurrenceRuleException("Invalid RecurrenceRule Value object.");
         init();
     }
@@ -140,19 +140,19 @@ public class RecurrenceRule {
     private boolean checkFreq(String freq) {
         if (freq == null)
             return false;
-        if (freq.equalsIgnoreCase("SECONDLY"))
+        if ("SECONDLY".equalsIgnoreCase(freq))
             return true;
-        if (freq.equalsIgnoreCase("MINUTELY"))
+        if ("MINUTELY".equalsIgnoreCase(freq))
             return true;
-        if (freq.equalsIgnoreCase("HOURLY"))
+        if ("HOURLY".equalsIgnoreCase(freq))
             return true;
-        if (freq.equalsIgnoreCase("DAILY"))
+        if ("DAILY".equalsIgnoreCase(freq))
             return true;
-        if (freq.equalsIgnoreCase("WEEKLY"))
+        if ("WEEKLY".equalsIgnoreCase(freq))
             return true;
-        if (freq.equalsIgnoreCase("MONTHLY"))
+        if ("MONTHLY".equalsIgnoreCase(freq))
             return true;
-        if (freq.equalsIgnoreCase("YEARLY"))
+        if ("YEARLY".equalsIgnoreCase(freq))
             return true;
         return false;
     }
@@ -208,19 +208,19 @@ public class RecurrenceRule {
 
         if (freq == null)
             return 0;
-        if (freq.equalsIgnoreCase("SECONDLY"))
+        if ("SECONDLY".equalsIgnoreCase(freq))
             return SECONDLY;
-        if (freq.equalsIgnoreCase("MINUTELY"))
+        if ("MINUTELY".equalsIgnoreCase(freq))
             return MINUTELY;
-        if (freq.equalsIgnoreCase("HOURLY"))
+        if ("HOURLY".equalsIgnoreCase(freq))
             return HOURLY;
-        if (freq.equalsIgnoreCase("DAILY"))
+        if ("DAILY".equalsIgnoreCase(freq))
             return DAILY;
-        if (freq.equalsIgnoreCase("WEEKLY"))
+        if ("WEEKLY".equalsIgnoreCase(freq))
             return WEEKLY;
-        if (freq.equalsIgnoreCase("MONTHLY"))
+        if ("MONTHLY".equalsIgnoreCase(freq))
             return MONTHLY;
-        if (freq.equalsIgnoreCase("YEARLY"))
+        if ("YEARLY".equalsIgnoreCase(freq))
             return YEARLY;
         return 0;
     }
@@ -724,19 +724,19 @@ public class RecurrenceRule {
     private int getCalendarDay(String day) {
         if (day != null) {
             day = day.trim();
-            if (day.equalsIgnoreCase("MO"))
+            if ("MO".equalsIgnoreCase(day))
                 return Calendar.MONDAY;
-            if (day.equalsIgnoreCase("TU"))
+            if ("TU".equalsIgnoreCase(day))
                 return Calendar.TUESDAY;
-            if (day.equalsIgnoreCase("WE"))
+            if ("WE".equalsIgnoreCase(day))
                 return Calendar.WEDNESDAY;
-            if (day.equalsIgnoreCase("TH"))
+            if ("TH".equalsIgnoreCase(day))
                 return Calendar.THURSDAY;
-            if (day.equalsIgnoreCase("FR"))
+            if ("FR".equalsIgnoreCase(day))
                 return Calendar.FRIDAY;
-            if (day.equalsIgnoreCase("SA"))
+            if ("SA".equalsIgnoreCase(day))
                 return Calendar.SATURDAY;
-            if (day.equalsIgnoreCase("SU"))
+            if ("SU".equalsIgnoreCase(day))
                 return Calendar.SUNDAY;
         }
         return 0;

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java Mon Oct 16 09:25:36 2017
@@ -112,22 +112,22 @@ public class ServiceEcaAction implements
         }
 
         if (eventName.startsWith("global-")) {
-            if (eventName.equals("global-rollback")) {
+            if ("global-rollback".equals(eventName)) {
                 ServiceSynchronization.registerRollbackService(dctx, serviceName, runAsUser, context, "async".equals(serviceMode), persist); // using the actual context so we get updates
-            } else if (eventName.equals("global-commit")) {
+            } else if ("global-commit".equals(eventName)) {
                 ServiceSynchronization.registerCommitService(dctx, serviceName, runAsUser, context, "async".equals(serviceMode), persist); // using the actual context so we get updates
-            } else if (eventName.equals("global-commit-post-run")) {
+            } else if ("global-commit-post-run".equals(eventName)) {
                 ServiceSynchronization.registerCommitService(dctx, serviceName, runAsUser, context, "async".equals(serviceMode), persist); // using the actual context so we get updates
             }
         } else {
             // standard ECA
-            if (this.serviceMode.equals("sync")) {
+            if ("sync".equals(this.serviceMode)) {
                 if (newTransaction) {
                     actionResult = dispatcher.runSync(this.serviceName, actionContext, -1, true);
                 } else {
                     actionResult = dispatcher.runSync(this.serviceName, actionContext);
                 }
-            } else if (this.serviceMode.equals("async")) {
+            } else if ("async".equals(this.serviceMode)) {
                 dispatcher.runAsync(serviceName, actionContext, persist);
             }
         }

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/HttpEngine.java Mon Oct 16 09:25:36 2017
@@ -146,7 +146,7 @@ public class HttpEngine extends GenericA
             try {
                 ModelService model = dispatcher.getDispatchContext().getModelService(serviceName);
                 if (model.export || exportAll) {
-                    if (serviceMode.equals("ASYNC")) {
+                    if ("ASYNC".equals(serviceMode)) {
                         dispatcher.runAsync(serviceName, context);
                     } else {
                         result = dispatcher.runSync(serviceName, context);

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java Mon Oct 16 09:25:36 2017
@@ -125,16 +125,16 @@ public class GroupModel {
      */
     public Map<String, Object> run(ServiceDispatcher dispatcher, String localName, Map<String, Object> context)
             throws GenericServiceException {
-        if (this.getSendMode().equals("all")) {
+        if ("all".equals(this.getSendMode())) {
             return runAll(dispatcher, localName, context);
-        } else if (this.getSendMode().equals("round-robin")) {
+        } else if ("round-robin".equals(this.getSendMode())) {
             return runIndex(dispatcher, localName, context, (++lastServiceRan % services.size()));
-        } else if (this.getSendMode().equals("random")) {
+        } else if ("random".equals(this.getSendMode())) {
             int randomIndex = (int) (Math.random() * (services.size()));
             return runIndex(dispatcher, localName, context, randomIndex);
-        } else if (this.getSendMode().equals("first-available")) {
+        } else if ("first-available".equals(this.getSendMode())) {
             return runOne(dispatcher, localName, context);
-        } else if (this.getSendMode().equals("none")) {
+        } else if ("none".equals(this.getSendMode())) {
             return new HashMap<String, Object>();
         } else {
             throw new GenericServiceException("This mode is not currently supported");

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java Mon Oct 16 09:25:36 2017
@@ -47,8 +47,8 @@ public class GroupServiceModel {
     public GroupServiceModel(Element service) {
         this.serviceName = service.getAttribute("name");
         this.serviceMode = service.getAttribute("mode");
-        this.resultToContext = service.getAttribute("result-to-context").equalsIgnoreCase("true");
-        this.optionalParams = service.getAttribute("parameters").equalsIgnoreCase("optional");
+        this.resultToContext = "true".equalsIgnoreCase(service.getAttribute("result-to-context"));
+        this.optionalParams = "optional".equalsIgnoreCase(service.getAttribute("parameters"));
     }
 
     /**
@@ -107,7 +107,7 @@ public class GroupServiceModel {
 
         Map<String, Object> thisContext = model.makeValid(context, ModelService.IN_PARAM);
         Debug.logInfo("Running grouped service [" + serviceName + "]", module);
-        if (getMode().equals("async")) {
+        if ("async".equals(getMode())) {
             List<String> requiredOut = model.getParameterNames(ModelService.OUT_PARAM, false);
             if (requiredOut.size() > 0) {
                 Debug.logWarning("Grouped service (" + getName() + ") requested 'async' invocation; running sync because of required OUT parameters.", module);

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java Mon Oct 16 09:25:36 2017
@@ -138,9 +138,9 @@ public class JmsListenerFactory implemen
         String className = server.getListenerClass();
 
         if (UtilValidate.isEmpty(className)) {
-            if (type.equals("topic"))
+            if ("topic".equals(type))
                 className = JmsListenerFactory.TOPIC_LISTENER_CLASS;
-            else if (type.equals("queue"))
+            else if ("queue".equals(type))
                 className = JmsListenerFactory.QUEUE_LISTENER_CLASS;
         }
 

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java Mon Oct 16 09:25:36 2017
@@ -108,9 +108,9 @@ public class JmsServiceEngine extends Ab
         String sendMode = serviceElement.getAttribute("send-mode");
         List<? extends Element> serverList = UtilXml.childElementList(serviceElement, "server");
 
-        if (sendMode.equals("none")) {
+        if ("none".equals(sendMode)) {
             return new ArrayList<Element>();
-        } else if (sendMode.equals("all")) {
+        } else if ("all".equals(sendMode)) {
             return serverList;
         } else {
             throw new GenericServiceException("Requested send mode not supported.");
@@ -312,9 +312,9 @@ public class JmsServiceEngine extends Ab
         Map<String, Object> result = new HashMap<String, Object>();
         for (Server server: serverList) {
             String serverType = server.getType();
-            if (serverType.equals("topic"))
+            if ("topic".equals(serverType))
                 result.putAll(runTopic(modelService, context, server));
-            else if (serverType.equals("queue"))
+            else if ("queue".equals(serverType))
                 result.putAll(runQueue(modelService, context, server));
             else
                 throw new GenericServiceException("Illegal server messaging type.");

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaAction.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaAction.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaAction.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaAction.java Mon Oct 16 09:25:36 2017
@@ -56,14 +56,14 @@ public class ServiceMcaAction implements
         serviceContext.putAll(UtilMisc.toMap("messageWrapper", messageWrapper, "userLogin", userLogin));
         serviceContext.put("userLogin", ServiceUtil.getUserLogin(dispatcher.getDispatchContext(), serviceContext, runAsUser));
 
-        if (serviceMode.equals("sync")) {
+        if ("sync".equals(serviceMode)) {
             Map<String, Object> result = dispatcher.runSync(serviceName, serviceContext);
             if (ServiceUtil.isError(result)) {
                 Debug.logError(ServiceUtil.getErrorMessage(result), module);
                 return false;
             }
             return true;
-        } else if (serviceMode.equals("async")) {
+        } else if ("async".equals(serviceMode)) {
             dispatcher.runAsync(serviceName, serviceContext, persist);
             return true;
         } else {

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java?rev=1812264&r1=1812263&r2=1812264&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java Mon Oct 16 09:25:36 2017
@@ -141,7 +141,7 @@ public class RmiServiceContainer impleme
             throw new ContainerException("Unable to start the RMI dispatcher", e);
         }
 
-        if (!useCtx.equalsIgnoreCase("true")) {
+        if (!"true".equalsIgnoreCase(useCtx)) {
             // bind RMIDispatcher to RMI Naming (Must be JRMP protocol)
             try {
                 Naming.rebind("//" + host + ":" + port + "/" + name, remote);