Skip to content

Commit

Permalink
Be more defensive about Paths in bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Jan 29, 2025
1 parent ed97778 commit 2258646
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ private ArchiveRootBuildItem(Builder builder, QuarkusBuildCloseablesBuildItem bu
final PathList.Builder rootDirs = PathList.builder();
final PathList.Builder paths = PathList.builder();
for (Path root : builder.archiveRoots) {
if (!Files.exists(root)) {
continue;
}
paths.add(root);
if (Files.isDirectory(root)) {
rootDirs.add(root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.io.Serializable;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.ProtectionDomain;
import java.util.Collection;
Expand Down Expand Up @@ -341,15 +342,19 @@ public QuarkusClassLoader createDeploymentClassLoader() {
.setAggregateParentResources(true);

for (Path root : quarkusBootstrap.getApplicationRoot()) {
builder.addNormalPriorityElement(ClassPathElement.fromPath(root, true));
if (Files.exists(root)) {
builder.addNormalPriorityElement(ClassPathElement.fromPath(root, true));
}
}

builder.setResettableElement(new MemoryClassPathElement(Collections.emptyMap(), false));

//additional user class path elements first
for (AdditionalDependency i : quarkusBootstrap.getAdditionalApplicationArchives()) {
for (Path root : i.getResolvedPaths()) {
builder.addNormalPriorityElement(ClassPathElement.fromPath(root, true));
if (Files.exists(root)) {
builder.addNormalPriorityElement(ClassPathElement.fromPath(root, true));
}
}
}
for (ResolvedDependency dependency : appModel.getDependencies()) {
Expand All @@ -361,7 +366,9 @@ public QuarkusClassLoader createDeploymentClassLoader() {
}
}
for (Path root : configuredClassLoading.getAdditionalClasspathElements()) {
builder.addNormalPriorityElement(ClassPathElement.fromPath(root, true));
if (Files.exists(root)) {
builder.addNormalPriorityElement(ClassPathElement.fromPath(root, true));
}
}
return builder.build();
}
Expand Down

0 comments on commit 2258646

Please sign in to comment.