Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: run with jar file and not package third lib into jar file, this.getClass().getClassLoader() will be null #3408

Merged
merged 3 commits into from
Dec 31, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
format code
  • Loading branch information
lian00jian@163.com committed Dec 25, 2020
commit 5d3eec449125b06dbe5ea82199703367ea81ba38
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ private File getFileFromFileSystem(String decodedPath) {
// run with jar file and not package third lib into jar file, this.getClass().getClassLoader() will be null
URL resourceUrl = this.getClass().getClassLoader().getResource("");
String[] tryPaths = null;
if(resourceUrl != null){
tryPaths = new String[] {
// first: project dir
resourceUrl.getPath() + decodedPath,
// second: system path
decodedPath
if (resourceUrl != null) {
tryPaths = new String[]{
// first: project dir
resourceUrl.getPath() + decodedPath,
// second: system path
decodedPath
};
} else {
tryPaths = new String[] {
decodedPath
tryPaths = new String[]{
decodedPath
};
}

Expand Down