You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2018/12/06 21:20:30 UTC
[4/6] tomee git commit: TOMEE-2322 restore previous classloader at
the end
TOMEE-2322 restore previous classloader at the end
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/2b7a105a
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2b7a105a
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2b7a105a
Branch: refs/heads/tomee-7.1.x
Commit: 2b7a105a8183afcb9554e52b8cb24844f13780d0
Parents: bb583e4
Author: Jonathan Gallimore <jg...@tomitribe.com>
Authored: Thu Dec 6 15:09:10 2018 +0000
Committer: Jonathan Gallimore <jg...@tomitribe.com>
Committed: Thu Dec 6 20:58:20 2018 +0000
----------------------------------------------------------------------
.../src/main/java/org/apache/openejb/cli/Bootstrap.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/2b7a105a/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java b/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java
index b5508a3..95e879e 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java
@@ -175,10 +175,12 @@ public class Bootstrap {
* Read commands from BASE_PATH (using XBean's ResourceFinder) and execute the one specified on the command line
*/
public static void main(final String[] args) throws Exception {
+ ClassLoader cl = null;
setupHome(args);
try (final URLClassLoader loader = setupClasspath()) {
if (loader != null) {
+ cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(loader);
if (loader != ClassLoader.getSystemClassLoader()) {
System.setProperty("openejb.classloader.first.disallow-system-loading", "true");
@@ -200,6 +202,10 @@ public class Bootstrap {
throw Error.class.cast(cause);
}
throw new IllegalStateException(cause);
+ } finally {
+ if (cl != null) {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
}
}
}