Commit 76ed52c2 authored by Andy Wilkinson's avatar Andy Wilkinson

Polish "Support nested jar paths in loader.path"

Closes gh-11121
parent 9eb8e3d4
......@@ -121,6 +121,8 @@ public class PropertiesLauncher extends Launcher {
private static final Pattern WORD_SEPARATOR = Pattern.compile("\\W+");
private static final String NESTED_ARCHIVE_SEPARATOR = "!" + File.separator;
private final File home;
private List<String> paths = new ArrayList<>();
......@@ -452,6 +454,7 @@ public class PropertiesLauncher extends Launcher {
private List<Archive> getClassPathArchives(String path) throws Exception {
String root = cleanupPath(stripFileUrlPrefix(path));
System.out.println(root);
List<Archive> lib = new ArrayList<>();
File file = new File(root);
if (!"/".equals(root)) {
......@@ -483,8 +486,7 @@ public class PropertiesLauncher extends Launcher {
}
private Archive getArchive(File file) throws IOException {
// Nested path never exists as plain jar file, which should be ignored here.
if (file.getPath().contains("!")) {
if (isNestedArchivePath(file)) {
return null;
}
String name = file.getName().toLowerCase();
......@@ -494,6 +496,10 @@ public class PropertiesLauncher extends Launcher {
return null;
}
private boolean isNestedArchivePath(File file) {
return file.getPath().contains(NESTED_ARCHIVE_SEPARATOR);
}
private List<Archive> getNestedArchives(String path) throws Exception {
Archive parent = this.parent;
String root = path;
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment