Skip to content

Commit

Permalink
#5701 Fixed resetting environment after merge. (#5753)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalgce authored and scottdraves committed Jul 28, 2017
1 parent eafcd99 commit 256550b
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,24 @@ private MagicCommandItem sendErrorMessage(Message message, String messageText, i
}

private Collection<String> addJars(String path) {
Map<Path, String> addedJars = Maps.newHashMap();
List<String> addedJarsName = Lists.newLinkedList();

if (doesPathContainsWildCards(path)) {
Map<Path, String> collect = getPaths(path).keySet().stream()
.filter(
currentPath -> kernel.addJarToClasspath(new PathToJar(currentPath.toString())))
.collect(Collectors.toMap(o -> o, Path::toString));
addedJars.putAll(collect);
List<PathToJar> pathsToJars = getPaths(path).keySet().stream()
.map(currentPath -> new PathToJar(currentPath.toString()))
.collect(Collectors.toList());

List<Path> addedPaths = kernel.addJarsToClasspath(pathsToJars);
addedJarsName.addAll(addedPaths.stream().map(Path::toString).collect(Collectors.toList()));

} else {
Path currentPath = Paths.get(path);
if (this.kernel.addJarToClasspath(new PathToJar(path))) {
addedJars.put(currentPath, currentPath.getFileName().toString());
addedJarsName.add(currentPath.getFileName().toString());
}
}
return addedJars.values();

return addedJarsName;
}

private Boolean containsSingleWildcardSymbol(String path) {
Expand All @@ -232,8 +236,8 @@ private Map<Path, String> getPaths(String pathWithWildcard) {
try {

return Files.list(Paths.get(pathWithoutWildcards))
.filter(path -> path.toString().toLowerCase().endsWith(".jar"))
.collect(Collectors.toMap(p -> p, o -> o.getFileName().toString()));
.filter(path -> path.toString().toLowerCase().endsWith(".jar"))
.collect(Collectors.toMap(p -> p, o -> o.getFileName().toString()));

} catch (IOException e) {
throw new IllegalStateException("Cannot find any jars files in selected path");
Expand Down

0 comments on commit 256550b

Please sign in to comment.