You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2003/07/16 06:47:05 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/config ModuleConfigFactory.java

dgraham     2003/07/15 21:47:05

  Modified:    src/share/org/apache/struts/config ModuleConfigFactory.java
  Log:
  Catch only relevant exceptions instead of Throwable and made LOG final.
  
  Revision  Changes    Path
  1.5       +21 -17    jakarta-struts/src/share/org/apache/struts/config/ModuleConfigFactory.java
  
  Index: ModuleConfigFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/ModuleConfigFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ModuleConfigFactory.java	5 Feb 2003 00:51:40 -0000	1.4
  +++ ModuleConfigFactory.java	16 Jul 2003 04:47:05 -0000	1.5
  @@ -74,6 +74,7 @@
    * @see ModuleConfig
    */
   public abstract class ModuleConfigFactory {
  +    
       /**
        * Create and return a newly instansiated {@link ModuleConfig}.
        * This method must be implemented by concrete subclasses.
  @@ -88,7 +89,7 @@
        * The fully qualified class name that is used for
        * <code>ModuleConfigFactory</code> instances.
        * @return class name that is used for
  -     *   <code>ModuleConfigFactory</code> instances
  +     * <code>ModuleConfigFactory</code> instances
        */
       public static String getFactoryClass() {
           return (ModuleConfigFactory.factoryClass);
  @@ -98,7 +99,7 @@
        * Set the fully qualified class name that is used for
        * <code>ModuleConfigFactory</code> instances.
        * @param factoryClass name that is used for
  -     *   <code>ModuleConfigFactory</code> instances
  +     * <code>ModuleConfigFactory</code> instances
        */
       public static void setFactoryClass(String factoryClass) {
           ModuleConfigFactory.factoryClass = factoryClass;
  @@ -116,22 +117,25 @@
        */
       public static ModuleConfigFactory createFactory() {
   
  -        // Construct a new instance of the specified factory class
  +        ModuleConfigFactory factory = null;
  +
           try {
               if (clazz == null) {
                   clazz = RequestUtils.applicationClass(factoryClass);
               }
  -            
  -            ModuleConfigFactory factory =
  -                (ModuleConfigFactory) clazz.newInstance();
  -            
  -            return (factory);
  -            
  -        } catch (Throwable t) {
  -            LOG.error("ModuleConfigFactory.createFactory", t);
  -            return (null);
  +
  +            factory = (ModuleConfigFactory) clazz.newInstance();
  +
  +        } catch (ClassNotFoundException e) {
  +            LOG.error("ModuleConfigFactory.createFactory()", e);
  +        } catch (InstantiationException e) {
  +            LOG.error("ModuleConfigFactory.createFactory()", e);
  +        } catch (IllegalAccessException e) {
  +            LOG.error("ModuleConfigFactory.createFactory()", e);
           }
   
  +        return factory;
  +
       }
   
   
  @@ -144,7 +148,7 @@
       /**
        * Commons Logging instance.
        */
  -    private static Log LOG = LogFactory.getLog(ModuleConfigFactory.class);
  +    private static final Log LOG = LogFactory.getLog(ModuleConfigFactory.class);
   
   
       /**
  
  
  

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