Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed Jun 27, 2024
1 parent 08a59e7 commit c4324eb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties

.quarkus
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem;
import io.quarkus.vertx.http.deployment.spi.StaticResourcesBuildItem;
Expand All @@ -32,9 +33,11 @@ FeatureBuildItem feature() {
}

@BuildStep
void produceBeans(BuildProducer<AdditionalBeanBuildItem> additionalBeanProducer) {
void produceBeans(BuildProducer<AdditionalBeanBuildItem> additionalBeanProducer,
BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClassProducer) {
additionalBeanProducer.produce(AdditionalBeanBuildItem.unremovableOf(RoqGenerator.class));
additionalBeanProducer.produce(AdditionalBeanBuildItem.unremovableOf(FixedStaticPagesProvider.class));
runtimeInitializedClassProducer.produce(new RuntimeInitializedClassBuildItem(FixedStaticPagesProvider.class.getName()));
}

@BuildStep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@Singleton
public class FixedStaticPagesProvider {
private static String targetDir;
private static volatile String targetDir;
@Inject
RoqGeneratorConfig config;

Expand Down Expand Up @@ -42,13 +42,16 @@ StaticPages produce() {
StaticPages.add(StaticPage.builder().path(p).fixed().build());
continue;
}
// Try to detect fixed paths from glob pattern
for (String staticPath : staticPaths) {
PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + p);
if (matcher.matches(Path.of(staticPath))) {
StaticPages.add(StaticPage.builder().fixed().path(staticPath).build());
if (staticPaths != null) {
// Try to detect fixed paths from glob pattern
for (String staticPath : staticPaths) {
PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + p);
if (matcher.matches(Path.of(staticPath))) {
StaticPages.add(StaticPage.builder().fixed().path(staticPath).build());
}
}
}

}
return new StaticPages(StaticPages);
}
Expand Down

0 comments on commit c4324eb

Please sign in to comment.