commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsi...@apache.org
Subject cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging LogFactory.java
Date Fri, 13 Dec 2002 16:55:39 GMT
rsitze      2002/12/13 08:55:39

  Modified:    logging/src/java/org/apache/commons/logging LogFactory.java
  Log:
  Oops.. almost broke type check via typecast!
  
  Revision  Changes    Path
  1.18      +10 -5     jakarta-commons/logging/src/java/org/apache/commons/logging/LogFactory.java
  
  Index: LogFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/LogFactory.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- LogFactory.java	13 Dec 2002 16:48:06 -0000	1.17
  +++ LogFactory.java	13 Dec 2002 16:55:39 -0000	1.18
  @@ -544,7 +544,10 @@
                           if (classLoader != null) {
                               try {
                                   // first the given class loader param (thread class loader)
  -                                return classLoader.loadClass(factoryClass).newInstance();
  +                                
  +                                // warning: must typecast here & allow exception
  +                                // to be generated/caught & recast propertly.
  +                                return (LogFactory)classLoader.loadClass(factoryClass).newInstance();
                               } catch (ClassNotFoundException ex) {
                                   if (classLoader == LogFactory.class.getClassLoader()) {
                                       // Nothing more to try, onwards.
  @@ -571,6 +574,8 @@
                            * b) The Java endorsed library mechanism is instead
                            *    Class.forName(factoryClass);
                            */
  +                        // warning: must typecast here & allow exception
  +                        // to be generated/caught & recast propertly.
                           return (LogFactory)Class.forName(factoryClass).newInstance();
                       } catch (Exception e) {
                           return new LogConfigurationException(e);
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message