Author: remm
Date: Fri Nov 30 14:23:41 2018
New Revision: 1847826

URL: http://svn.apache.org/viewvc?rev=1847826&view=rev
Log:
Add another missed string, and cleanups

Modified:
    tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/storeconfig/StoreRegistry.java

Modified: 
tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties?rev=1847826&r1=1847825&r2=1847826&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties 
[UTF-8] (original)
+++ tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties 
[UTF-8] Fri Nov 30 14:23:41 2018
@@ -22,6 +22,8 @@ config.storeServerError=Error storing se
 factory.storeNoDescriptor=Descriptor for element class [{0}] not configured!
 factory.storeTag=store tag [{0}] ( Object: [{1}] )
 
+registry.loadClassFailed=Failed to load class [{0}]
+
 storeConfigListener.loadError=Error loading StoreConfig
 storeConfigListener.notServer=The listener was added to component other than 
the Server and will therefore be ignored
 storeConfigListener.registerError=Error registering StoreConfig MBean

Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/StoreRegistry.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/StoreRegistry.java?rev=1847826&r1=1847825&r2=1847826&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/storeconfig/StoreRegistry.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/storeconfig/StoreRegistry.java Fri 
Nov 30 14:23:41 2018
@@ -44,12 +44,14 @@ import org.apache.coyote.UpgradeProtocol
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.http.CookieProcessor;
+import org.apache.tomcat.util.res.StringManager;
 
 /**
  * Central StoreRegistry for all server.xml elements
  */
 public class StoreRegistry {
     private static Log log = LogFactory.getLog(StoreRegistry.class);
+    private static StringManager sm = 
StringManager.getManager(StoreRegistry.class);
 
     private Map<String, StoreDescription> descriptors = new HashMap<>();
 
@@ -71,30 +73,28 @@ public class StoreRegistry {
             CookieProcessor.class };
 
     /**
-     * @return Returns the name.
+     * @return the name
      */
     public String getName() {
         return name;
     }
 
     /**
-     * @param name
-     *            The name to set.
+     * @param name The name to set.
      */
     public void setName(String name) {
         this.name = name;
     }
 
     /**
-     * @return Returns the version.
+     * @return the version
      */
     public String getVersion() {
         return version;
     }
 
     /**
-     * @param version
-     *            The version to set.
+     * @param version The version to set
      */
     public void setVersion(String version) {
         this.version = version;
@@ -105,19 +105,19 @@ public class StoreRegistry {
      * found.
      *
      * @param id The class name
-     * @return The description
+     * @return the description
      */
     public StoreDescription findDescription(String id) {
-        if (log.isDebugEnabled())
+        if (log.isDebugEnabled()) {
             log.debug("search descriptor " + id);
+        }
         StoreDescription desc = descriptors.get(id);
         if (desc == null) {
             Class<?> aClass = null;
             try {
-                aClass = Class.forName(id, true, this.getClass()
-                        .getClassLoader());
+                aClass = Class.forName(id, true, 
this.getClass().getClassLoader());
             } catch (ClassNotFoundException e) {
-                log.error("ClassName:" + id, e);
+                log.error(sm.getString("registry.loadClassFailed", id), e);
             }
             if (aClass != null) {
                 desc = descriptors.get(aClass.getName());
@@ -128,12 +128,14 @@ public class StoreRegistry {
                 }
             }
         }
-        if (log.isDebugEnabled())
-            if (desc != null)
+        if (log.isDebugEnabled()) {
+            if (desc != null) {
                 log.debug("find descriptor " + id + "#" + desc.getTag() + "#"
                         + desc.getStoreFactoryClass());
-            else
+            } else {
                 log.debug(("Can't find descriptor for key " + id));
+            }
+        }
         return desc;
     }
 
@@ -141,7 +143,7 @@ public class StoreRegistry {
      * Find Description by class.
      *
      * @param aClass The class
-     * @return The description
+     * @return the description
      */
     public StoreDescription findDescription(Class<?> aClass) {
         return findDescription(aClass.getName());
@@ -151,14 +153,15 @@ public class StoreRegistry {
      * Find factory from class name.
      *
      * @param aClassName The class name
-     * @return The factory
+     * @return the factory
      */
     public IStoreFactory findStoreFactory(String aClassName) {
         StoreDescription desc = findDescription(aClassName);
-        if (desc != null)
+        if (desc != null) {
             return desc.getStoreFactory();
-        else
+        } else {
             return null;
+        }
 
     }
 
@@ -166,7 +169,7 @@ public class StoreRegistry {
      * Find factory from class.
      *
      * @param aClass The class
-     * @return The factory
+     * @return the factory
      */
     public IStoreFactory findStoreFactory(Class<?> aClass) {
         return findStoreFactory(aClass.getName());
@@ -179,12 +182,14 @@ public class StoreRegistry {
      */
     public void registerDescription(StoreDescription desc) {
         String key = desc.getId();
-        if (key == null || "".equals(key))
+        if (key == null || "".equals(key)) {
             key = desc.getTagClass();
+        }
         descriptors.put(key, desc);
-        if (log.isDebugEnabled())
+        if (log.isDebugEnabled()) {
             log.debug("register store descriptor " + key + "#" + desc.getTag()
                     + "#" + desc.getTagClass());
+        }
     }
 
     /**
@@ -195,15 +200,16 @@ public class StoreRegistry {
      */
     public StoreDescription unregisterDescription(StoreDescription desc) {
         String key = desc.getId();
-        if (key == null || "".equals(key))
+        if (key == null || "".equals(key)) {
             key = desc.getTagClass();
+        }
         return descriptors.remove(key);
     }
 
     // Attributes
 
     /**
-     * @return The encoding
+     * @return the encoding
      */
     public String getEncoding() {
         return encoding;



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

Reply via email to