tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1848408 - in /tomcat/trunk/java/org/apache: catalina/mbeans/ tomcat/util/modeler/
Date Fri, 07 Dec 2018 15:24:06 GMT
Author: remm
Date: Fri Dec  7 15:24:06 2018
New Revision: 1848408

URL: http://svn.apache.org/viewvc?rev=1848408&view=rev
Log:
Add i18n for mbeans package.

Modified:
    tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java
    tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java
    tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java
    tomcat/trunk/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
    tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java
    tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/mbeans/MBeanDumper.java
    tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java
    tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
    tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
    tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java
    tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java
    tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java Fri Dec  7 15:24:06 2018
@@ -52,8 +52,8 @@ public class ConnectorMBean extends Clas
         // Validate the input parameters
         if (name == null) {
             throw new RuntimeOperationsException(
-                    new IllegalArgumentException("Attribute name is null"),
-                    "Attribute name is null");
+                    new IllegalArgumentException(sm.getString("mBean.nullName")),
+                    sm.getString("mBean.nullName"));
         }
 
         Connector connector = doGetManagedResource();
@@ -81,14 +81,14 @@ public class ConnectorMBean extends Clas
         // Validate the input parameters
         if (attribute == null) {
             throw new RuntimeOperationsException(new IllegalArgumentException(
-                    "Attribute is null"), "Attribute is null");
+                    sm.getString("mBean.nullAttribute")), sm.getString("mBean.nullAttribute"));
         }
         String name = attribute.getName();
         Object value = attribute.getValue();
         if (name == null) {
             throw new RuntimeOperationsException(
-                    new IllegalArgumentException("Attribute name is null"),
-                    "Attribute name is null");
+                    new IllegalArgumentException(sm.getString("mBean.nullName")),
+                    sm.getString("mBean.nullName"));
         }
 
         Connector connector = doGetManagedResource();

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java Fri Dec  7
15:24:06 2018
@@ -52,8 +52,8 @@ public class ContextResourceLinkMBean ex
         // Validate the input parameters
         if (name == null) {
             throw new RuntimeOperationsException(
-                    new IllegalArgumentException("Attribute name is null"),
-                    "Attribute name is null");
+                    new IllegalArgumentException(sm.getString("mBean.nullName")),
+                    sm.getString("mBean.nullName"));
         }
 
         ContextResourceLink cl = doGetManagedResource();
@@ -70,7 +70,7 @@ public class ContextResourceLinkMBean ex
         } else {
             value = (String) cl.getProperty(name);
             if (value == null) {
-                throw new AttributeNotFoundException("Cannot find attribute [" + name + "]");
+                throw new AttributeNotFoundException(sm.getString("mBean.attributeNotFound",
name));
             }
         }
 
@@ -98,16 +98,16 @@ public class ContextResourceLinkMBean ex
         // Validate the input parameters
         if (attribute == null) {
             throw new RuntimeOperationsException(
-                    new IllegalArgumentException("Attribute is null"),
-                    "Attribute is null");
+                    new IllegalArgumentException(sm.getString("mBean.nullAttribute")),
+                    sm.getString("mBean.nullAttribute"));
         }
 
         String name = attribute.getName();
         Object value = attribute.getValue();
         if (name == null) {
             throw new RuntimeOperationsException(
-                    new IllegalArgumentException("Attribute name is null"),
-                    "Attribute name is null");
+                    new IllegalArgumentException(sm.getString("mBean.nullName")),
+                    sm.getString("mBean.nullName"));
         }
 
         ContextResourceLink crl = doGetManagedResource();

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java Fri Dec  7 15:24:06
2018
@@ -52,8 +52,8 @@ public class ContextResourceMBean extend
         // Validate the input parameters
         if (name == null) {
             throw new RuntimeOperationsException(
-                    new IllegalArgumentException("Attribute name is null"),
-                    "Attribute name is null");
+                    new IllegalArgumentException(sm.getString("mBean.nullName")),
+                    sm.getString("mBean.nullName"));
         }
 
         ContextResource cr = doGetManagedResource();
@@ -72,8 +72,7 @@ public class ContextResourceMBean extend
         } else {
             value = (String) cr.getProperty(name);
             if (value == null) {
-                throw new AttributeNotFoundException
-                    ("Cannot find attribute [" + name + "]");
+                throw new AttributeNotFoundException(sm.getString("mBean.attributeNotFound",
name));
             }
         }
 
@@ -101,15 +100,15 @@ public class ContextResourceMBean extend
         // Validate the input parameters
         if (attribute == null) {
             throw new RuntimeOperationsException(
-                    new IllegalArgumentException("Attribute is null"),
-                    "Attribute is null");
+                    new IllegalArgumentException(sm.getString("mBean.nullAttribute")),
+                    sm.getString("mBean.nullAttribute"));
         }
         String name = attribute.getName();
         Object value = attribute.getValue();
         if (name == null) {
             throw new RuntimeOperationsException(
-                    new IllegalArgumentException("Attribute name is null"),
-                    "Attribute name is null");
+                    new IllegalArgumentException(sm.getString("mBean.nullName")),
+                    sm.getString("mBean.nullName"));
         }
 
         ContextResource cr = doGetManagedResource();

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java Fri
Dec  7 15:24:06 2018
@@ -37,6 +37,7 @@ import org.apache.catalina.UserDatabase;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
 
 
 /**
@@ -50,6 +51,7 @@ import org.apache.tomcat.util.modeler.Re
 public class GlobalResourcesLifecycleListener implements LifecycleListener {
 
     private static final Log log = LogFactory.getLog(GlobalResourcesLifecycleListener.class);
+    protected static final StringManager sm = StringManager.getManager(GlobalResourcesLifecycleListener.class);
 
 
     // ----------------------------------------------------- Instance Variables
@@ -97,7 +99,7 @@ public class GlobalResourcesLifecycleLis
         try {
             context = (Context) (new InitialContext()).lookup("java:/");
         } catch (NamingException e) {
-            log.error("No global naming context defined for server");
+            log.error(sm.getString("globalResources.noNamingContext"));
             return;
         }
 
@@ -105,7 +107,7 @@ public class GlobalResourcesLifecycleLis
         try {
             createMBeans("", context);
         } catch (NamingException e) {
-            log.error("Exception processing Global JNDI Resources", e);
+            log.error(sm.getString("globalResources.createError"), e);
         }
     }
 
@@ -141,14 +143,14 @@ public class GlobalResourcesLifecycleLis
                     try {
                         createMBeans(name, (UserDatabase) value);
                     } catch (Exception e) {
-                        log.error("Exception creating UserDatabase MBeans for " + name, e);
+                        log.error(sm.getString("globalResources.userDatabaseCreateError",
name), e);
                     }
                 }
             }
-        } catch( RuntimeException ex) {
-            log.error("RuntimeException " + ex);
-        } catch( OperationNotSupportedException ex) {
-            log.error("Operation not supported " + ex);
+        } catch (RuntimeException ex) {
+            log.error(sm.getString("globalResources.createError.runtime"), ex);
+        } catch (OperationNotSupportedException ex) {
+            log.error(sm.getString("globalResources.createError.operation"), ex);
         }
     }
 
@@ -171,8 +173,7 @@ public class GlobalResourcesLifecycleLis
         try {
             MBeanUtils.createMBean(database);
         } catch(Exception e) {
-            throw new IllegalArgumentException(
-                    "Cannot create UserDatabase MBean for resource " + name, e);
+            throw new IllegalArgumentException(sm.getString("globalResources.createError.userDatabase",
name), e);
         }
 
         // Create the MBeans for each defined Role
@@ -185,7 +186,7 @@ public class GlobalResourcesLifecycleLis
             try {
                 MBeanUtils.createMBean(role);
             } catch (Exception e) {
-                throw new IllegalArgumentException("Cannot create Role MBean for role " +
role, e);
+                throw new IllegalArgumentException(sm.getString("globalResources.createError.userDatabase.role",
role), e);
             }
         }
 
@@ -199,8 +200,7 @@ public class GlobalResourcesLifecycleLis
             try {
                 MBeanUtils.createMBean(group);
             } catch (Exception e) {
-                throw new IllegalArgumentException(
-                        "Cannot create Group MBean for group " + group, e);
+                throw new IllegalArgumentException(sm.getString("globalResources.createError.userDatabase.group",
group), e);
             }
         }
 
@@ -214,8 +214,7 @@ public class GlobalResourcesLifecycleLis
             try {
                 MBeanUtils.createMBean(user);
             } catch (Exception e) {
-                throw new IllegalArgumentException(
-                        "Cannot create User MBean for user " + user, e);
+                throw new IllegalArgumentException(sm.getString("globalResources.createError.userDatabase.user",
user), e);
             }
         }
     }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java Fri Dec  7 15:24:06 2018
@@ -65,8 +65,7 @@ public class GroupMBean extends BaseMode
                 ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), role);
                 results.add(oname.toString());
             } catch (MalformedObjectNameException e) {
-                IllegalArgumentException iae = new IllegalArgumentException(
-                        "Cannot create object name for role " + role);
+                IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createError.role",
role));
                 iae.initCause(e);
                 throw iae;
             }
@@ -90,8 +89,7 @@ public class GroupMBean extends BaseMode
                 ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), user);
                 results.add(oname.toString());
             } catch (MalformedObjectNameException e) {
-                IllegalArgumentException iae = new IllegalArgumentException(
-                        "Cannot create object name for user " + user);
+                IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createError.user",
user));
                 iae.initCause(e);
                 throw iae;
             }
@@ -113,7 +111,7 @@ public class GroupMBean extends BaseMode
         }
         Role role = group.getUserDatabase().findRole(rolename);
         if (role == null) {
-            throw new IllegalArgumentException("Invalid role name '" + rolename + "'");
+            throw new IllegalArgumentException(sm.getString("userMBean.invalidRole", rolename));
         }
         group.addRole(role);
     }
@@ -132,7 +130,7 @@ public class GroupMBean extends BaseMode
         }
         Role role = group.getUserDatabase().findRole(rolename);
         if (role == null) {
-            throw new IllegalArgumentException("Invalid role name [" + rolename + "]");
+            throw new IllegalArgumentException(sm.getString("userMBean.invalidRole", rolename));
         }
         group.removeRole(role);
     }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties [UTF-8] (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties [UTF-8] Fri Dec 
7 15:24:06 2018
@@ -13,6 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+globalResources.createError=Exception processing global JNDI Resources
+globalResources.createError.operation=Operation not supported error creating MBeans
+globalResources.createError.runtime=Unexpected error creating MBeans
+globalResources.createError.userDatabase=Cannot create UserDatabase MBean for resource [{0}]
+globalResources.createError.userDatabase.group=Cannot create Group MBean for group [{0}]
+globalResources.createError.userDatabase.role=Cannot create Role MBean for role [{0}]
+globalResources.createError.userDatabase.user=Cannot create User MBean for user [{0}]
+globalResources.noNamingContext=No global naming context defined for server
+globalResources.userDatabaseCreateError=Exception creating UserDatabase MBeans for [{0}]
+
 jmxRemoteLifecycleListener.createRegistryFailed=Unable to create the RMI registry for the
[{0}] server using port [{1}]
 jmxRemoteLifecycleListener.createServerFailed=The JMX connector server could not be created
or failed to start for the [{0}] server
 jmxRemoteLifecycleListener.destroyServerFailed=The JMX connector server could not be stopped
for the [{0}] server
@@ -20,4 +30,38 @@ jmxRemoteLifecycleListener.invalidRmiBin
 jmxRemoteLifecycleListener.invalidURL=The JMX Service URL requested for the [{0}] server,
[{1}], was invalid
 jmxRemoteLifecycleListener.start=The JMX Remote Listener has configured the registry on port
[{0}] and the server on port [{1}] for the [{2}] server
 
+mBean.attributeNotFound=Cannot find attribute [{0}]
+mBean.nullAttribute=Attribute is null
+mBean.nullName=Attribute name is null
+
+mBeanDumper.getAttributeError=Error getting attribute [{0}] for object name [{1}]
+
+mBeanFactory.contextDestroyError=Error during context [{0}] destroy
 mBeanFactory.managerContext=Manager components may only be added to Contexts.
+mBeanFactory.noDeployer=Deployer not found for host [{0}]
+mBeanFactory.noService=Service with the domain [{0}] was not found
+mBeanFactory.notServer=The container is not a Server
+
+mBeanUtils.noManagedBean=ManagedBean is not found with [{0}]
+
+namingResourcesMBean.addAlreadyExists.environment=Specified environment already exists with
name [{0}]
+namingResourcesMBean.addAlreadyExists.resource=Specified resource name already exists with
name [{0}]
+namingResourcesMBean.addAlreadyExists.resourceLink=Specified resource link already exists
with name [{0}]
+namingResourcesMBean.createObjectNameError.environment=Cannot create object name for environment
[{0}]
+namingResourcesMBean.createObjectNameError.resource=Cannot create object name for resource
[{0}]
+namingResourcesMBean.createObjectNameError.resourceLink=Cannot create object name for resource
link [{0}]
+namingResourcesMBean.removeNotFound.environment=Specified environment does not exist with
name [{0}]
+namingResourcesMBean.removeNotFound.resource=Specified resource does not exist with name
[{0}]
+namingResourcesMBean.removeNotFound.resourceLink=Specified resource link does not exist with
name [{0}]
+
+userMBean.createError.group=Cannot create object name for group [{0}]
+userMBean.createError.role=Cannot create object name for role [{0}]
+userMBean.createError.user=Cannot create object name for user [{0}]
+userMBean.createMBeanError.group=Exception creating group [{0}] MBean
+userMBean.createMBeanError.role=Exception creating role [{0}] MBean
+userMBean.createMBeanError.user=Exception creating user [{0}] MBean
+userMBean.destroyError.group=Exception destroying group [{0}] MBean
+userMBean.destroyError.role=Exception destroying role [{0}] MBean
+userMBean.destroyError.user=Exception destroying user [{0}] MBean
+userMBean.invalidGroup=Invalid group name [{0}]
+userMBean.invalidRole=Invalid role name [{0}]

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/MBeanDumper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/MBeanDumper.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/MBeanDumper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/MBeanDumper.java Fri Dec  7 15:24:06 2018
@@ -31,6 +31,7 @@ import javax.management.openmbean.Tabula
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
+import org.apache.tomcat.util.res.StringManager;
 
 /**
  * General helper to dump MBean contents to the log.
@@ -38,6 +39,7 @@ import org.apache.tomcat.util.ExceptionU
 public class MBeanDumper {
 
     private static final Log log = LogFactory.getLog(MBeanDumper.class);
+    protected static final StringManager sm = StringManager.getManager(MBeanDumper.class);
 
     private static final String CRLF = "\r\n";
 
@@ -87,19 +89,19 @@ public class MBeanDumper {
                         Throwable cause = rme.getCause();
                         if (cause instanceof UnsupportedOperationException) {
                             if (log.isDebugEnabled()) {
-                                log.debug("Error getting attribute " + oname + " " + attName,
rme);
+                                log.debug(sm.getString("mBeanDumper.getAttributeError", attName,
oname), rme);
                             }
                         } else if (cause instanceof NullPointerException) {
                             if (log.isDebugEnabled()) {
-                                log.debug("Error getting attribute " + oname + " " + attName,
rme);
+                                log.debug(sm.getString("mBeanDumper.getAttributeError", attName,
oname), rme);
                             }
                         } else {
-                            log.error("Error getting attribute " + oname + " " + attName,
rme);
+                            log.error(sm.getString("mBeanDumper.getAttributeError", attName,
oname), rme);
                         }
                         continue;
                     } catch (Throwable t) {
                         ExceptionUtils.handleThrowable(t);
-                        log.error("Error getting attribute " + oname + " " + attName, t);
+                        log.error(sm.getString("mBeanDumper.getAttributeError", attName,
oname), t);
                         continue;
                     }
                     if (value == null) {

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java Fri Dec  7 15:24:06 2018
@@ -182,7 +182,7 @@ public class MBeanFactory {
         }
         if (service == null ||
                 !service.getObjectName().getDomain().equals(domain)) {
-            throw new Exception("Service with the domain is not found");
+            throw new Exception(sm.getString("mBeanFactory.noService", domain));
         }
         return service;
 
@@ -461,7 +461,7 @@ public class MBeanFactory {
                            new Object [] {contextName},
                            new String [] {"java.lang.String"});
         } else {
-            log.warn("Deployer not found for "+pname.getKeyProperty("host"));
+            log.warn(sm.getString("mBeanFactory.noDeployer", pname.getKeyProperty("host")));
             Service service = getService(pname);
             Engine engine = service.getContainer();
             Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
@@ -535,7 +535,7 @@ public class MBeanFactory {
             String defaultHost, String baseDir) throws Exception{
 
         if (!(container instanceof Server)) {
-            throw new Exception("Container not Server");
+            throw new Exception(sm.getString("mBeanFactory.notServer"));
         }
 
         StandardEngine engine = new StandardEngine();
@@ -752,7 +752,7 @@ public class MBeanFactory {
                            new Object[] {pathStr},
                            new String[] {"java.lang.String"});
         } else {
-            log.warn("Deployer not found for "+hostName);
+            log.warn(sm.getString("mBeanFactory.noDeployer", hostName));
             Host host = (Host) engine.findChild(hostName);
             Context context = (Context) host.findChild(pathStr);
             // Remove this component from its parent component
@@ -761,7 +761,7 @@ public class MBeanFactory {
             try {
                 context.destroy();
             } catch (Exception e) {
-                log.warn("Error during context [" + context.getName() + "] destroy ", e);
+                log.warn(sm.getString("mBeanFactory.contextDestroyError"), e);
            }
 
         }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java Fri Dec  7 15:24:06 2018
@@ -38,6 +38,7 @@ import org.apache.tomcat.util.descriptor
 import org.apache.tomcat.util.descriptor.web.ContextResourceLink;
 import org.apache.tomcat.util.modeler.ManagedBean;
 import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
 
 
 /**
@@ -50,6 +51,8 @@ public class MBeanUtils {
 
     // ------------------------------------------------------- Static Variables
 
+    protected static final StringManager sm = StringManager.getManager(MBeanUtils.class);
+
     /**
      * The set of exceptions to the normal rules used by
      * <code>createManagedBean()</code>.  The first element of each pair
@@ -118,7 +121,7 @@ public class MBeanUtils {
         String mname = createManagedName(environment);
         ManagedBean managed = registry.findManagedBean(mname);
         if (managed == null) {
-            Exception e = new Exception("ManagedBean is not found with "+mname);
+            Exception e = new Exception(sm.getString("mBeanUtils.noManagedBean", mname));
             throw new MBeanException(e);
         }
         String domain = managed.getDomain();
@@ -149,7 +152,7 @@ public class MBeanUtils {
         String mname = createManagedName(resource);
         ManagedBean managed = registry.findManagedBean(mname);
         if (managed == null) {
-            Exception e = new Exception("ManagedBean is not found with "+mname);
+            Exception e = new Exception(sm.getString("mBeanUtils.noManagedBean", mname));
             throw new MBeanException(e);
         }
         String domain = managed.getDomain();
@@ -180,7 +183,7 @@ public class MBeanUtils {
         String mname = createManagedName(resourceLink);
         ManagedBean managed = registry.findManagedBean(mname);
         if (managed == null) {
-            Exception e = new Exception("ManagedBean is not found with "+mname);
+            Exception e = new Exception(sm.getString("mBeanUtils.noManagedBean", mname));
             throw new MBeanException(e);
         }
         String domain = managed.getDomain();
@@ -211,7 +214,7 @@ public class MBeanUtils {
         String mname = createManagedName(group);
         ManagedBean managed = registry.findManagedBean(mname);
         if (managed == null) {
-            Exception e = new Exception("ManagedBean is not found with "+mname);
+            Exception e = new Exception(sm.getString("mBeanUtils.noManagedBean", mname));
             throw new MBeanException(e);
         }
         String domain = managed.getDomain();
@@ -242,7 +245,7 @@ public class MBeanUtils {
         String mname = createManagedName(role);
         ManagedBean managed = registry.findManagedBean(mname);
         if (managed == null) {
-            Exception e = new Exception("ManagedBean is not found with "+mname);
+            Exception e = new Exception(sm.getString("mBeanUtils.noManagedBean", mname));
             throw new MBeanException(e);
         }
         String domain = managed.getDomain();
@@ -273,7 +276,7 @@ public class MBeanUtils {
         String mname = createManagedName(user);
         ManagedBean managed = registry.findManagedBean(mname);
         if (managed == null) {
-            Exception e = new Exception("ManagedBean is not found with "+mname);
+            Exception e = new Exception(sm.getString("mBeanUtils.noManagedBean", mname));
             throw new MBeanException(e);
         }
         String domain = managed.getDomain();
@@ -304,7 +307,7 @@ public class MBeanUtils {
         String mname = createManagedName(userDatabase);
         ManagedBean managed = registry.findManagedBean(mname);
         if (managed == null) {
-            Exception e = new Exception("ManagedBean is not found with "+mname);
+            Exception e = new Exception(sm.getString("mBeanUtils.noManagedBean", mname));
             throw new MBeanException(e);
         }
         String domain = managed.getDomain();

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java Fri Dec  7 15:24:06
2018
@@ -133,8 +133,7 @@ public class MemoryUserDatabaseMBean ext
         try {
             MBeanUtils.createMBean(group);
         } catch (Exception e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Exception creating group [" + groupname + "] MBean");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createMBeanError.group",
groupname));
             iae.initCause(e);
             throw iae;
         }
@@ -155,8 +154,7 @@ public class MemoryUserDatabaseMBean ext
         try {
             MBeanUtils.createMBean(role);
         } catch (Exception e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Exception creating role [" + rolename + "] MBean");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createMBeanError.role",
rolename));
             iae.initCause(e);
             throw iae;
         }
@@ -178,8 +176,7 @@ public class MemoryUserDatabaseMBean ext
         try {
             MBeanUtils.createMBean(user);
         } catch (Exception e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Exception creating user [" + username + "] MBean");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createMBeanError.user",
username));
             iae.initCause(e);
             throw iae;
         }
@@ -204,8 +201,7 @@ public class MemoryUserDatabaseMBean ext
             ObjectName oname = MBeanUtils.createObjectName(managedGroup.getDomain(), group);
             return oname.toString();
         } catch (MalformedObjectNameException e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Cannot create object name for group [" + groupname + "]");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createError.group",
groupname));
             iae.initCause(e);
             throw iae;
         }
@@ -229,8 +225,7 @@ public class MemoryUserDatabaseMBean ext
             ObjectName oname = MBeanUtils.createObjectName(managedRole.getDomain(), role);
             return oname.toString();
         } catch (MalformedObjectNameException e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Cannot create object name for role [" + rolename + "]");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createError.role",
rolename));
             iae.initCause(e);
             throw iae;
         }
@@ -255,8 +250,7 @@ public class MemoryUserDatabaseMBean ext
             ObjectName oname = MBeanUtils.createObjectName(managedUser.getDomain(), user);
             return oname.toString();
         } catch (MalformedObjectNameException e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Cannot create object name for user [" + username + "]");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createError.user",
username));
             iae.initCause(e);
             throw iae;
         }
@@ -278,8 +272,7 @@ public class MemoryUserDatabaseMBean ext
             MBeanUtils.destroyMBean(group);
             database.removeGroup(group);
         } catch (Exception e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Exception destroying group [" + groupname + "] MBean");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.destroyError.group",
groupname));
             iae.initCause(e);
             throw iae;
         }
@@ -301,8 +294,7 @@ public class MemoryUserDatabaseMBean ext
             MBeanUtils.destroyMBean(role);
             database.removeRole(role);
         } catch (Exception e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Exception destroying role [" + rolename + "] MBean");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.destroyError.role",
rolename));
             iae.initCause(e);
             throw iae;
         }
@@ -324,8 +316,7 @@ public class MemoryUserDatabaseMBean ext
             MBeanUtils.destroyMBean(user);
             database.removeUser(user);
         } catch (Exception e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "Exception destroying user [" + username + "] MBean");
+            IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.destroyError.user",
username));
             iae.initCause(e);
             throw iae;
         }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java Fri Dec  7 15:24:06
2018
@@ -67,8 +67,8 @@ public class NamingResourcesMBean extend
                 ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
                 results.add(oname.toString());
             } catch (MalformedObjectNameException e) {
-                IllegalArgumentException iae = new IllegalArgumentException (
-                        "Cannot create object name for environment " + envs[i]);
+                IllegalArgumentException iae = new IllegalArgumentException(
+                        sm.getString("namingResourcesMBean.createObjectNameError.environment",
envs[i]));
                 iae.initCause(e);
                 throw iae;
             }
@@ -91,7 +91,7 @@ public class NamingResourcesMBean extend
                 results.add(oname.toString());
             } catch (MalformedObjectNameException e) {
                 IllegalArgumentException iae = new IllegalArgumentException(
-                        "Cannot create object name for resource " + resources[i]);
+                        sm.getString("namingResourcesMBean.createObjectNameError.resource",
resources[i]));
                 iae.initCause(e);
                 throw iae;
             }
@@ -116,7 +116,7 @@ public class NamingResourcesMBean extend
                 results.add(oname.toString());
             } catch (MalformedObjectNameException e) {
                 IllegalArgumentException iae = new IllegalArgumentException(
-                        "Cannot create object name for resource " + resourceLinks[i]);
+                        sm.getString("namingResourcesMBean.createObjectNameError.resourceLink",
resourceLinks[i]));
                 iae.initCause(e);
                 throw iae;
             }
@@ -145,8 +145,7 @@ public class NamingResourcesMBean extend
         }
         ContextEnvironment env = nresources.findEnvironment(envName);
         if (env != null) {
-            throw new IllegalArgumentException(
-                    "Invalid environment name - already exists '" + envName + "'");
+            throw new IllegalArgumentException(sm.getString("namingResourcesMBean.addAlreadyExists.environment",
envName));
         }
         env = new ContextEnvironment();
         env.setName(envName);
@@ -178,8 +177,7 @@ public class NamingResourcesMBean extend
         }
         ContextResource resource = nresources.findResource(resourceName);
         if (resource != null) {
-            throw new IllegalArgumentException(
-                    "Invalid resource name - already exists'" + resourceName + "'");
+            throw new IllegalArgumentException(sm.getString("namingResourcesMBean.addAlreadyExists.resource",
resourceName));
         }
         resource = new ContextResource();
         resource.setName(resourceName);
@@ -211,8 +209,7 @@ public class NamingResourcesMBean extend
         ContextResourceLink resourceLink =
                             nresources.findResourceLink(resourceLinkName);
         if (resourceLink != null) {
-            throw new IllegalArgumentException(
-                    "Invalid resource link name - already exists'" + resourceLinkName + "'");
+            throw new IllegalArgumentException(sm.getString("namingResourcesMBean.addAlreadyExists.resourceLink",
resourceLinkName));
         }
         resourceLink = new ContextResourceLink();
         resourceLink.setName(resourceLinkName);
@@ -238,7 +235,7 @@ public class NamingResourcesMBean extend
         }
         ContextEnvironment env = nresources.findEnvironment(envName);
         if (env == null) {
-            throw new IllegalArgumentException("Invalid environment name '" + envName + "'");
+            throw new IllegalArgumentException(sm.getString("namingResourcesMBean.removeNotFound.environment",
envName));
         }
         nresources.removeEnvironment(envName);
     }
@@ -257,7 +254,7 @@ public class NamingResourcesMBean extend
         }
         ContextResource resource = nresources.findResource(resourceName);
         if (resource == null) {
-            throw new IllegalArgumentException("Invalid resource name '" + resourceName +
"'");
+            throw new IllegalArgumentException(sm.getString("namingResourcesMBean.removeNotFound.resource",
resourceName));
         }
         nresources.removeResource(resourceName);
     }
@@ -276,8 +273,7 @@ public class NamingResourcesMBean extend
         }
         ContextResourceLink resourceLink = nresources.findResourceLink(resourceLinkName);
         if (resourceLink == null) {
-            throw new IllegalArgumentException(
-                    "Invalid resource Link name '" + resourceLinkName + "'");
+            throw new IllegalArgumentException(sm.getString("namingResourcesMBean.removeNotFound.resourceLink",
resourceLinkName));
         }
         nresources.removeResourceLink(resourceLinkName);
     }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java Fri Dec  7 15:24:06 2018
@@ -72,8 +72,7 @@ public class UserMBean extends BaseModel
                     MBeanUtils.createObjectName(managed.getDomain(), group);
                 results.add(oname.toString());
             } catch (MalformedObjectNameException e) {
-                IllegalArgumentException iae = new IllegalArgumentException
-                    ("Cannot create object name for group " + group);
+                IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createError.group",
group));
                 iae.initCause(e);
                 throw iae;
             }
@@ -98,8 +97,7 @@ public class UserMBean extends BaseModel
                     MBeanUtils.createObjectName(managed.getDomain(), role);
                 results.add(oname.toString());
             } catch (MalformedObjectNameException e) {
-                IllegalArgumentException iae = new IllegalArgumentException
-                    ("Cannot create object name for role " + role);
+                IllegalArgumentException iae = new IllegalArgumentException(sm.getString("userMBean.createError.role",
role));
                 iae.initCause(e);
                 throw iae;
             }
@@ -123,7 +121,7 @@ public class UserMBean extends BaseModel
         }
         Group group = user.getUserDatabase().findGroup(groupname);
         if (group == null) {
-            throw new IllegalArgumentException("Invalid group name '" + groupname + "'");
+            throw new IllegalArgumentException(sm.getString("userMBean.invalidGroup", groupname));
         }
         user.addGroup(group);
     }
@@ -142,7 +140,7 @@ public class UserMBean extends BaseModel
         }
         Role role = user.getUserDatabase().findRole(rolename);
         if (role == null) {
-            throw new IllegalArgumentException("Invalid role name '" + rolename + "'");
+            throw new IllegalArgumentException(sm.getString("userMBean.invalidRole", rolename));
         }
         user.addRole(role);
     }
@@ -161,7 +159,7 @@ public class UserMBean extends BaseModel
         }
         Group group = user.getUserDatabase().findGroup(groupname);
         if (group == null) {
-            throw new IllegalArgumentException("Invalid group name '" + groupname + "'");
+            throw new IllegalArgumentException(sm.getString("userMBean.invalidGroup", groupname));
         }
         user.removeGroup(group);
     }
@@ -180,7 +178,7 @@ public class UserMBean extends BaseModel
         }
         Role role = user.getUserDatabase().findRole(rolename);
         if (role == null) {
-            throw new IllegalArgumentException("Invalid role name '" + rolename + "'");
+            throw new IllegalArgumentException(sm.getString("userMBean.invalidRole", rolename));
         }
         user.removeRole(role);
     }

Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java?rev=1848408&r1=1848407&r2=1848408&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java Fri Dec  7 15:24:06
2018
@@ -48,6 +48,7 @@ import javax.management.modelmbean.Model
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
 
 /*
  * Changes from commons.modeler:
@@ -104,6 +105,7 @@ public class BaseModelMBean implements D
         ModelMBeanNotificationBroadcaster {
 
     private static final Log log = LogFactory.getLog(BaseModelMBean.class);
+    protected static final StringManager sm = StringManager.getManager(BaseModelMBean.class);
 
     // ----------------------------------------------------- Instance Variables
 



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


Mime
View raw message