Author: rickmcguire
Date: Tue Jun  5 05:51:07 2007
New Revision: 544475

URL: http://svn.apache.org/viewvc?view=rev&rev=544475
Log:
Some "Hungry Exception" code cleanup. 


Modified:
    
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
    
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Unmarshaller.java
    
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ConnectorReference.java

Modified: 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
URL: 
http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java?view=diff&rev=544475&r1=544474&r2=544475
==============================================================================
--- 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
 (original)
+++ 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
 Tue Jun  5 05:51:07 2007
@@ -126,7 +126,7 @@
                 PersistenceUnitTransactionType type = 
Enum.valueOf(PersistenceUnitTransactionType.class, 
transactionTypeEnv.toUpperCase());
                 unitInfo.setTransactionType(type);
             } catch (IllegalArgumentException e) {
-                throw new IllegalArgumentException("Unknown " + 
TRANSACTIONTYPE_PROP + ", valid options are " + 
PersistenceUnitTransactionType.JTA + " or " + 
PersistenceUnitTransactionType.RESOURCE_LOCAL);
+                throw (IllegalArgumentException)(new 
IllegalArgumentException("Unknown " + TRANSACTIONTYPE_PROP + ", valid options 
are " + PersistenceUnitTransactionType.JTA + " or " + 
PersistenceUnitTransactionType.RESOURCE_LOCAL).initCause(e));
             }
         } else {
             PersistenceUnitTransactionType type = 
Enum.valueOf(PersistenceUnitTransactionType.class, info.transactionType);

Modified: 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Unmarshaller.java
URL: 
http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Unmarshaller.java?view=diff&rev=544475&r1=544474&r2=544475
==============================================================================
--- 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Unmarshaller.java
 (original)
+++ 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Unmarshaller.java
 Tue Jun  5 05:51:07 2007
@@ -105,14 +105,14 @@
             reader = new InputStreamReader(stream);
             return unmarshalObject(reader, file, jarLocation);
         } catch (IOException e) {
-            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotRead", file, 
jarLocation, e.getLocalizedMessage()));
+            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotRead", file, 
jarLocation, e.getLocalizedMessage()), e);
         } finally {
             try {
                 if (stream != null) stream.close();
                 if (reader != null) reader.close();
                 if (jar != null) jar.close();
             } catch (Exception e) {
-                throw new 
OpenEJBException(EjbJarUtils.messages.format("file.0020", jarLocation, 
e.getLocalizedMessage()));
+                throw new 
OpenEJBException(EjbJarUtils.messages.format("file.0020", jarLocation, 
e.getLocalizedMessage()), e);
             }
         }
     }
@@ -129,13 +129,13 @@
             reader = new InputStreamReader(stream);
             return unmarshalObject(reader, file, directory.getPath());
         } catch (FileNotFoundException e) {
-            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotFindFile", file, 
directory.getPath()));
+            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotFindFile", file, 
directory.getPath()), e);
         } finally {
             try {
                 if (stream != null) stream.close();
                 if (reader != null) reader.close();
             } catch (Exception e) {
-                throw new 
OpenEJBException(EjbJarUtils.messages.format("file.0020", directory.getPath(), 
e.getLocalizedMessage()));
+                throw new 
OpenEJBException(EjbJarUtils.messages.format("file.0020", directory.getPath(), 
e.getLocalizedMessage()), e);
             }
         }
     }
@@ -152,15 +152,15 @@
             reader = new InputStreamReader(stream);
             return unmarshalObject(reader, file, fullURL.getPath());
         } catch (MalformedURLException e) {
-            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotFindFile", file, 
url.getPath()));
+            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotFindFile", file, 
url.getPath()), e);
         } catch (IOException e) {
-            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotRead", file, 
url.getPath(), e.getLocalizedMessage()));
+            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotRead", file, 
url.getPath(), e.getLocalizedMessage()), e);
         } finally {
             try {
                 if (stream != null) stream.close();
                 if (reader != null) reader.close();
             } catch (Exception e) {
-                throw new 
OpenEJBException(EjbJarUtils.messages.format("file.0020", url.getPath(), 
e.getLocalizedMessage()));
+                throw new 
OpenEJBException(EjbJarUtils.messages.format("file.0020", url.getPath(), 
e.getLocalizedMessage()), e);
             }
         }
     }
@@ -173,19 +173,18 @@
             return unmarshaller.unmarshal(reader);
         } catch (MarshalException e) {
             if (e.getCause() instanceof UnknownHostException) {
-                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.unkownHost", file, 
jarLocation, e.getLocalizedMessage()));
+                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.unkownHost", file, 
jarLocation, e.getLocalizedMessage()), e);
             } else if (e.getCause() instanceof org.xml.sax.SAXException) {
-                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotParse", file, 
jarLocation, e.getLocalizedMessage()));
+                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotParse", file, 
jarLocation, e.getLocalizedMessage()), e);
             } else if (e.getCause() instanceof IOException) {
-                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotRead", file, 
jarLocation, e.getLocalizedMessage()));
+                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotRead", file, 
jarLocation, e.getLocalizedMessage()), e);
             } else if (e.getCause() instanceof ValidationException) {
-                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotValidate", file, 
jarLocation, e.getLocalizedMessage()));
+                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotValidate", file, 
jarLocation, e.getLocalizedMessage()), e);
             } else {
-                e.printStackTrace();
-                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotUnmarshal", file, 
jarLocation, e.getLocalizedMessage()));
+                throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotUnmarshal", file, 
jarLocation, e.getLocalizedMessage()), e);
             }
         } catch (ValidationException e) {
-            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotValidate", file, 
jarLocation, e.getLocalizedMessage()));
+            throw new 
OpenEJBException(EjbJarUtils.messages.format("xml.cannotValidate", file, 
jarLocation, e.getLocalizedMessage()), e);
         }
     }
 }

Modified: 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ConnectorReference.java
URL: 
http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ConnectorReference.java?view=diff&rev=544475&r1=544474&r2=544475
==============================================================================
--- 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ConnectorReference.java
 (original)
+++ 
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ConnectorReference.java
 Tue Jun  5 05:51:07 2007
@@ -47,7 +47,7 @@
         try {
             return mngedConFactory.createConnectionFactory(conMngr);
         } catch (javax.resource.ResourceException re) {
-            throw new javax.naming.NamingException("Could not create 
ConnectionFactory from " + mngedConFactory.getClass());
+            throw (javax.naming.NamingException)(new 
javax.naming.NamingException("Could not create ConnectionFactory from " + 
mngedConFactory.getClass()).initCause(re));
         }
 
     }


Reply via email to