mirror of https://github.com/apache/openjpa.git
Handle exceptions in getFactoryClass() when it is just being used for inclusion in the error message of an exception.
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@453712 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dc09b61954
commit
27e8bd4849
|
@ -60,10 +60,10 @@ public class Bootstrap {
|
||||||
if (cause instanceof OpenJPAException)
|
if (cause instanceof OpenJPAException)
|
||||||
throw (OpenJPAException) cause;
|
throw (OpenJPAException) cause;
|
||||||
throw new InternalException(s_loc.get("new-brokerfactory-excep",
|
throw new InternalException(s_loc.get("new-brokerfactory-excep",
|
||||||
getFactoryClass(conf, loader)), cause);
|
getFactoryClassName(conf, loader)), cause);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserException(s_loc.get("bad-new-brokerfactory",
|
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 @@ public class Bootstrap {
|
||||||
if (cause instanceof OpenJPAException)
|
if (cause instanceof OpenJPAException)
|
||||||
throw (OpenJPAException) cause;
|
throw (OpenJPAException) cause;
|
||||||
throw new InternalException(s_loc.get("brokerfactory-excep",
|
throw new InternalException(s_loc.get("brokerfactory-excep",
|
||||||
getFactoryClass(conf, loader)), cause);
|
getFactoryClassName(conf, loader)), cause);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserException(s_loc.get("bad-brokerfactory",
|
throw new UserException(s_loc.get("bad-brokerfactory",
|
||||||
getFactoryClass(conf, loader)), e).setFatal(true);
|
getFactoryClassName(conf, loader)), e).setFatal(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,15 @@ public class Bootstrap {
|
||||||
return (BrokerFactory) meth.invoke(null, new Object[]{ conf });
|
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() + ">";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate the factory class designated in properties.
|
* Instantiate the factory class designated in properties.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue