Partial fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=48644
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 27 Sep 2010 22:22:02 +0000 (22:22 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 27 Sep 2010 22:22:02 +0000 (22:22 +0000)
Some Throwables must always be re-thrown

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1001938 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/naming/NamingService.java
java/org/apache/naming/factory/ResourceFactory.java
java/org/apache/naming/factory/webservices/ServiceRefFactory.java

index f995bb2..92ee1a5 100644 (file)
@@ -156,7 +156,7 @@ public final class NamingService
                                    + ".java.javaURLContextFactory");
             }
             
-        } catch (Throwable t) {
+        } catch (Exception e) {
             state = STOPPED;
             notification = new AttributeChangeNotification
                 (this, sequenceNumber++, System.currentTimeMillis(), 
@@ -198,11 +198,9 @@ public final class NamingService
             System.setProperty(Context.URL_PKG_PREFIXES, oldUrlValue);
             System.setProperty(Context.INITIAL_CONTEXT_FACTORY, oldIcValue);
             
-        } catch (Throwable t) {
-            
+        } catch (Exception e) {
             // FIXME
-            t.printStackTrace();
-            
+            e.printStackTrace();
         }
         
         state = STOPPED;
index d3f4967..1779175 100644 (file)
@@ -98,12 +98,12 @@ public class ResourceFactory
                 if (factoryClass != null) {
                     try {
                         factory = (ObjectFactory) factoryClass.newInstance();
-                    } catch (Throwable t) {
-                        if (t instanceof NamingException)
-                            throw (NamingException) t;
+                    } catch (Exception e) {
+                        if (e instanceof NamingException)
+                            throw (NamingException) e;
                         NamingException ex = new NamingException
                             ("Could not create resource factory instance");
-                        ex.initCause(t);
+                        ex.initCause(e);
                         throw ex;
                     }
                 }
@@ -116,10 +116,10 @@ public class ResourceFactory
                         factory = (ObjectFactory) 
                             Class.forName(javaxSqlDataSourceFactoryClassName)
                             .newInstance();
-                    } catch (Throwable t) {
+                    } catch (Exception e) {
                         NamingException ex = new NamingException
                             ("Could not create resource factory instance");
-                        ex.initCause(t);
+                        ex.initCause(e);
                         throw ex;
                     }
                 } else if (ref.getClassName().equals("javax.mail.Session")) {
index c43a04d..2382b4c 100644 (file)
@@ -143,10 +143,10 @@ public class ServiceRefFactory
                         service = factory.createService( new URL(wsdlRefAddr),
                                 serviceQname );
                     }
-                } catch (Throwable t) {
+                } catch (Exception e) {
                     NamingException ex = new NamingException
                     ("Could not create service");
-                    ex.initCause(t);
+                    ex.initCause(e);
                     throw ex;
                 }
             } else {
@@ -175,10 +175,10 @@ public class ServiceRefFactory
                                 serviceInterfaceClass,
                                 new Properties() );
                     }
-                } catch (Throwable t) {
+                } catch (Exception e) {
                     NamingException ex = new NamingException
                     ("Could not create service");
-                    ex.initCause(t);
+                    ex.initCause(e);
                     throw ex;
                 }
             }
@@ -207,10 +207,10 @@ public class ServiceRefFactory
                         m.invoke(service, new Object[] {port.getName(), endpoint });
                         portComponentRef.put(endpoint, new QName(port.getName()));
                     }
-                } catch (Throwable t) {
+                } catch (Exception e) {
                     NamingException ex = new NamingException
                     ("Error while reading Wsdl File");
-                    ex.initCause(t);
+                    ex.initCause(e);
                     throw ex;
                 }
             }