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 c8d6be8
Show file tree
Hide file tree
Showing 3 changed files with 14 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 @@ -6,6 +6,7 @@
import java.util.List;
import java.util.Set;

import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import org.jboss.logging.Logger;

import io.quarkiverse.roq.generator.runtime.FixedStaticPagesProvider;
Expand All @@ -32,9 +33,10 @@ 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 c8d6be8

Please sign in to comment.