Skip to content

Commit

Permalink
avoid npe when starting wstools
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Apr 8, 2021
1 parent 9466fe7 commit ff6f3a9
Showing 1 changed file with 10 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -90,9 +90,10 @@ static int invoke(String mainClass, String[] args) throws Throwable {
ClassLoader oldcc = Thread.currentThread().getContextClassLoader();
try {
ClassLoader cl = Invoker.class.getClassLoader();
if(Arrays.asList(args).contains("-Xendorsed"))
cl = createClassLoader(cl); // perform JDK6 workaround hack
else {
//XXX - kept here for the future to resurect ability to run with older apis
// if(Arrays.asList(args).contains("-Xendorsed"))
// cl = createClassLoader(cl); // perform JDK6 workaround hack
// else {
int targetArgIndex = Arrays.asList(args).indexOf("-target");
Options.Target targetVersion;
if (targetArgIndex != -1) {
Expand All @@ -112,6 +113,11 @@ static int invoke(String mainClass, String[] args) throws Throwable {
return -1;
}

// }
//if loaded by bootstrap, cl can be null, let's use the loader
//we have in that case
if (cl == null) {
cl = oldcc;
}
//if loaded by bootstrap, cl can be null, let's use the loader
//we have in that case
Expand Down

0 comments on commit ff6f3a9

Please sign in to comment.