Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48282
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 27 Nov 2009 17:17:12 +0000 (17:17 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 27 Nov 2009 17:17:12 +0000 (17:17 +0000)
Correct possible NPE
Patch provided by sebb

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@884914 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/modeler/Registry.java

index 62c8c01..2ac06d2 100644 (file)
@@ -429,8 +429,10 @@ public class Registry implements RegistryMBean, MBeanRegistration  {
         Iterator<ManagedBean> items = descriptors.values().iterator();
         while (items.hasNext()) {
             ManagedBean item = items.next();
-            if ((group == null) && (item.getGroup() == null)) {
-                results.add(item.getName());
+            if ((group == null)) {
+                if (item.getGroup() == null){
+                    results.add(item.getName());
+                }
             } else if (group.equals(item.getGroup())) {
                 results.add(item.getName());
             }
@@ -678,7 +680,7 @@ public class Registry implements RegistryMBean, MBeanRegistration  {
         } else if( source instanceof InputStream ) {
             type=param;
             inputsource=source;
-        } else if( source instanceof Class ) {
+        } else if( source instanceof Class<?> ) {
             location=((Class<?>)source).getName();
             type=param;
             inputsource=source;