openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r453712 - /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java
Date Fri, 06 Oct 2006 17:57:24 GMT
Author: mprudhom
Date: Fri Oct  6 10:57:23 2006
New Revision: 453712

URL: http://svn.apache.org/viewvc?view=rev&rev=453712
Log:
Handle exceptions in getFactoryClass() when it is just being used for inclusion in the error
message of an exception.

Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java?view=diff&rev=453712&r1=453711&r2=453712
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java
Fri Oct  6 10:57:23 2006
@@ -60,10 +60,10 @@
             if (cause instanceof OpenJPAException)
                 throw (OpenJPAException) cause;
             throw new InternalException(s_loc.get("new-brokerfactory-excep",
-                getFactoryClass(conf, loader)), cause);
+                getFactoryClassName(conf, loader)), cause);
         } catch (Exception e) {
             throw new UserException(s_loc.get("bad-new-brokerfactory",
-                getFactoryClass(conf, loader)), e).setFatal(true);
+                getFactoryClassName(conf, loader)), e).setFatal(true);
         }
     }
 
@@ -88,10 +88,10 @@
             if (cause instanceof OpenJPAException)
                 throw (OpenJPAException) cause;
             throw new InternalException(s_loc.get("brokerfactory-excep",
-                getFactoryClass(conf, loader)), cause);
+                getFactoryClassName(conf, loader)), cause);
         } catch (Exception e) {
             throw new UserException(s_loc.get("bad-brokerfactory",
-                getFactoryClass(conf, loader)), e).setFatal(true);
+                getFactoryClassName(conf, loader)), e).setFatal(true);
         }
     }
 
@@ -115,6 +115,15 @@
         }
 
         return (BrokerFactory) meth.invoke(null, new Object[]{ conf });
+    }
+
+    private static String getFactoryClassName(ConfigurationProvider conf,
+        ClassLoader loader) {
+        try {
+            return getFactoryClass(conf, loader).getName();
+        } catch (Exception e) {
+            return "<" + e.toString() + ">";
+        }
     }
 
     /**



Mime
View raw message