svn commit: r1811467 - in /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group: GroupModel.java GroupServiceModel.java ServiceGroupReader.java

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

svn commit: r1811467 - in /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group: GroupModel.java GroupServiceModel.java ServiceGroupReader.java

mbrohl
Author: mbrohl
Date: Sun Oct  8 10:28:57 2017
New Revision: 1811467

URL: http://svn.apache.org/viewvc?rev=1811467&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.service.group.
(OFBIZ-9684)

I modified the patch to make ServiceGroupReader#groupsCache private.

Thanks Julian Leichert for reporting and providing the patch.

Modified:
    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/group/ServiceGroupReader.java

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=1811467&r1=1811466&r2=1811467&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 Sun Oct  8 10:28:57 2017
@@ -53,7 +53,7 @@ public class GroupModel {
         this.services = new LinkedList<GroupServiceModel>();
         this.lastServiceRan = -1;
 
-        if (groupName == null) {
+        if (groupName.isEmpty()) {
             throw new IllegalArgumentException("Group Definition found with no name attribute! : " + group);
         }
 

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=1811467&r1=1811466&r2=1811467&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 Sun Oct  8 10:28:57 2017
@@ -104,8 +104,6 @@ public class GroupServiceModel {
     public Map<String, Object> invoke(ServiceDispatcher dispatcher, String localName, Map<String, Object> context) throws GenericServiceException {
         DispatchContext dctx = dispatcher.getLocalContext(localName);
         ModelService model = dctx.getModelService(getName());
-        if (model == null)
-            throw new GenericServiceException("Group defined service (" + getName() + ") is not a defined service.");
 
         Map<String, Object> thisContext = model.makeValid(context, ModelService.IN_PARAM);
         Debug.logInfo("Running grouped service [" + serviceName + "]", module);

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java?rev=1811467&r1=1811466&r2=1811467&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java Sun Oct  8 10:28:57 2017
@@ -40,7 +40,7 @@ public class ServiceGroupReader {
     public static final String module = ServiceGroupReader.class.getName();
 
     // using a cache is dangerous here because if someone clears it the groups won't work at all: public static UtilCache groupsCache = new UtilCache("service.ServiceGroups", 0, 0, false);
-    public static Map<String, GroupModel> groupsCache = new ConcurrentHashMap<String, GroupModel>();
+    private static final Map<String, GroupModel> groupsCache = new ConcurrentHashMap<String, GroupModel>();
 
     public static void readConfig() {
         List<ServiceGroups> serviceGroupsList = null;
@@ -75,7 +75,7 @@ public class ServiceGroupReader {
 
         for (Element group: UtilXml.childElementList(rootElement, "group")) {
             String groupName = group.getAttribute("name");
-            if (groupName == null || groupName.isEmpty()) {
+            if (groupName.isEmpty()) {
                 Debug.logError("XML Parsing error: <group> element 'name' attribute null or empty", module);
                 continue;
             }