Author: ffang
Date: Fri Sep 28 02:39:08 2007
New Revision: 580269

URL: http://svn.apache.org/viewvc?rev=580269&view=rev
Log:
[CXF-1033] ensure we can catch MissingResourceException when we create Logger 
by reflection

Modified:
    
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java

Modified: 
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java?rev=580269&r1=580268&r2=580269&view=diff
==============================================================================
--- 
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java
 (original)
+++ 
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java
 Fri Sep 28 02:39:08 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.common.logging;
 
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.text.MessageFormat;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
@@ -83,9 +84,13 @@
                 if (name == null) {
                     try {
                         return (Logger) cns.newInstance(cls.getName(), 
BundleUtils.getBundleName(cls));
-                    } catch (MissingResourceException rex) {
-                        return (Logger) cns.newInstance(cls.getName(), null);
-                    }
+                    } catch (InvocationTargetException ite) {
+                        if (ite.getTargetException() instanceof 
MissingResourceException) {
+                            return (Logger) cns.newInstance(cls.getName(), 
null);
+                        } else {
+                            throw ite;
+                        }
+                    } 
                 } else {
                     return (Logger) cns.newInstance(cls.getName(), 
BundleUtils.getBundleName(cls, name));
                 }


Reply via email to