This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new a174848fad Cleanup
a174848fad is described below

commit a174848fadd11da2b5e4c64a107746b8ccca49d4
Author: remm <r...@apache.org>
AuthorDate: Mon Sep 18 12:36:33 2023 +0200

    Cleanup
    
    Remove old comments. This is a part of Tomcat and is supported.
    Found by coverity.
---
 .../tomcat/util/modeler/LocalStrings.properties       |  1 +
 java/org/apache/tomcat/util/modeler/Registry.java     | 19 ++++---------------
 .../modules/MbeansDescriptorsDigesterSource.java      |  6 ++++--
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/util/modeler/LocalStrings.properties 
b/java/org/apache/tomcat/util/modeler/LocalStrings.properties
index 57e76a890c..8c0825d81c 100644
--- a/java/org/apache/tomcat/util/modeler/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/modeler/LocalStrings.properties
@@ -38,6 +38,7 @@ modules.digesterParseError=Error parsing registry data
 modules.readDescriptorsError=Error reading descriptors
 
 registry.initError=Error initializing [{0}]
+registry.invalidSource=Invalid source specified, must be either URL, File, 
Class or InputStream
 registry.loadError=Error loading descriptors from [{0}]
 registry.noDisable=The MBean registry cannot be disabled because it has 
already been initialised
 registry.noMetadata=Cannot find metadata for object [{0}]
diff --git a/java/org/apache/tomcat/util/modeler/Registry.java 
b/java/org/apache/tomcat/util/modeler/Registry.java
index 2d981b41db..eaa9961a26 100644
--- a/java/org/apache/tomcat/util/modeler/Registry.java
+++ b/java/org/apache/tomcat/util/modeler/Registry.java
@@ -42,16 +42,6 @@ import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.modeler.modules.ModelerSource;
 import org.apache.tomcat.util.res.StringManager;
 
-/*
-   Issues:
-   - exceptions - too many "throws Exception"
-   - double check the interfaces
-   - start removing the use of the experimental methods in tomcat, then remove
-     the methods ( before 1.1 final )
-   - is the security enough to prevent Registry being used to avoid the
-     permission checks in the mbean server ?
- */
-
 /**
  * Registry for modeler MBeans.
  *
@@ -60,9 +50,6 @@ import org.apache.tomcat.util.res.StringManager;
  *
  * This class is itself an mbean.
  *
- * IMPORTANT: public methods not marked with {@code @since x.x} are 
experimental
- * or internal. Should not be used.
- *
  * @author Craig R. McClanahan
  * @author Costin Manolache
  */
@@ -520,7 +507,7 @@ public class Registry implements RegistryMBean, 
MBeanRegistration {
 
 
     /**
-     * EXPERIMENTAL Convert a string to object, based on type. Used by several
+     * Convert a string to object, based on type. Used by several
      * components. We could provide some pluggability. It is here to keep 
things
      * consistent and avoid duplication in other tasks
      *
@@ -552,7 +539,7 @@ public class Registry implements RegistryMBean, 
MBeanRegistration {
 
 
     /**
-     * Experimental. Load descriptors.
+     * Load descriptors.
      *
      * @param sourceType The source type
      * @param source The bean
@@ -593,6 +580,8 @@ public class Registry implements RegistryMBean, 
MBeanRegistration {
             if (sourceType == null) {
                 sourceType = "MbeansDescriptorsIntrospectionSource";
             }
+        } else {
+            throw new 
IllegalArgumentException(sm.getString("registry.invalidSource"));
         }
 
         if (sourceType == null) {
diff --git 
a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
 
b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
index 5052291723..5aeb701c24 100644
--- 
a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
+++ 
b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
@@ -46,9 +46,11 @@ public class MbeansDescriptorsDigesterSource extends 
ModelerSource
         digester.setValidating(false);
         URL url = Registry.getRegistry(null, null).getClass().getResource
             ("/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd");
-        digester.register
+        if (url != null) {
+            digester.register
             ("-//Apache Software Foundation//DTD Model MBeans Configuration 
File",
-                url.toString());
+                    url.toString());
+        }
 
         // Configure the parsing rules
         digester.addObjectCreate


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to