Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in Qute on hot-reload (with generated templates) #43944

Closed
ia3andy opened this issue Oct 17, 2024 · 3 comments · Fixed by #43953
Closed

NPE in Qute on hot-reload (with generated templates) #43944

ia3andy opened this issue Oct 17, 2024 · 3 comments · Fixed by #43953
Assignees
Labels
area/devmode area/qute The template engine kind/bug Something isn't working
Milestone

Comments

@ia3andy
Copy link
Contributor

ia3andy commented Oct 17, 2024

Describe the bug

java.lang.NullPointerException: Cannot invoke "io.quarkus.qute.Template.instance()" because the return value of "io.quarkus.qute.i18n.MessageBundles.getTemplate(String)" is null
    at io.quarkiverse.roq.frontmatter.runtime.RoqFrontMatterMessages_Bundle.pageNumber(Unknown Source)
    at io.quarkiverse.roq.frontmatter.runtime.RoqFrontMatterMessages_Bundle$$function$$2.accept(Unknown Source)
    at io.quarkus.qute.CompletedStage.whenComplete(CompletedStage.java:285)
    at io.quarkiverse.roq.frontmatter.runtime.RoqFrontMatterMessages_Bundle.RoqFrontMatterMessages_Bundle_resolve_0(Unknown Source)
    at io.quarkiverse.roq.frontmatter.runtime.RoqFrontMatterMessages_Bundle.resolve(Unknown Source)
    at io.quarkus.qute.i18n.MessageBundles$1.resolve(MessageBundles.java:103)
    at io.quarkus.qute.EvaluatorImpl.evaluate(EvaluatorImpl.java:77)
    at io.quarkus.qute.ResolutionContextImpl$ChildResolutionContext.evaluate(ResolutionContextImpl.java:92)
    at io.quarkus.qute.ExpressionNode.resolve(ExpressionNode.java:36)
    at io.quarkus.qute.Results.resolveWith(Results.java:107)
    at io.quarkus.qute.Results.resolveAndProcess(Results.java:57)
    at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:238)
    at io.quarkus.qute.IfSectionHelper$SingletonContext.lambda$resolve$0(IfSectionHelper.java:68)
    at io.quarkus.qute.CompletedStage.thenCompose(CompletedStage.java:249)
    at io.quarkus.qute.IfSectionHelper$SingletonContext.resolve(IfSectionHelper.java:64)
    at io.quarkus.qute.IfSectionHelper.resolve(IfSectionHelper.java:45)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:58)
    at io.quarkus.qute.Results.resolveWith(Results.java:110)
    at io.quarkus.qute.Results.resolveAndProcess(Results.java:57)
    at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:238)
    at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:66)
    at io.quarkus.qute.Parser$1.resolve(Parser.java:1331)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.IncludeSectionHelper.resolve(IncludeSectionHelper.java:50)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:58)
    at io.quarkus.qute.Results.resolveWith(Results.java:110)
    at io.quarkus.qute.Results.resolveAndProcess(Results.java:57)
    at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:238)
    at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:66)
    at io.quarkus.qute.Parser$1.resolve(Parser.java:1331)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.IncludeSectionHelper.resolve(IncludeSectionHelper.java:50)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:58)
    at io.quarkus.qute.Results.resolveWith(Results.java:110)
    at io.quarkus.qute.Results.resolveAndProcess(Results.java:57)
    at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:238)
    at io.quarkus.qute.InsertSectionHelper.resolve(InsertSectionHelper.java:28)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:58)
    at io.quarkus.qute.Results.resolveWith(Results.java:110)
    at io.quarkus.qute.Results.resolveAndProcess(Results.java:57)
    at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:238)
    at io.quarkus.qute.InsertSectionHelper.resolve(InsertSectionHelper.java:28)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:58)
    at io.quarkus.qute.Results.resolveWith(Results.java:110)
    at io.quarkus.qute.Results.resolveAndProcess(Results.java:57)
    at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:238)
    at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:66)
    at io.quarkus.qute.Parser$1.resolve(Parser.java:1331)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.IncludeSectionHelper.resolve(IncludeSectionHelper.java:50)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:58)
    at io.quarkus.qute.Results.resolveWith(Results.java:110)
    at io.quarkus.qute.Results.resolveAndProcess(Results.java:50)
    at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:238)
    at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:66)
    at io.quarkus.qute.Parser$1.resolve(Parser.java:1331)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.IncludeSectionHelper.resolve(IncludeSectionHelper.java:50)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:58)
    at io.quarkus.qute.Results.resolveWith(Results.java:110)
    at io.quarkus.qute.Results.resolveAndProcess(Results.java:50)
    at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:238)
    at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:66)
    at io.quarkus.qute.Parser$1.resolve(Parser.java:1331)
    at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
    at io.quarkus.qute.IncludeSectionHelper.resolve(IncludeSectionHelper.java:

Workaround is to type s to trigger a full-restart

@ia3andy ia3andy added the kind/bug Something isn't working label Oct 17, 2024
@quarkus-bot quarkus-bot bot added the area/qute The template engine label Oct 17, 2024
Copy link

quarkus-bot bot commented Oct 17, 2024

/cc @mkouba (qute)

@quarkusio quarkusio deleted a comment from quarkus-bot bot Oct 17, 2024
@ia3andy
Copy link
Contributor Author

ia3andy commented Oct 17, 2024

You can reproduce it on the Roq blog dir
start dev, edit the web-bundler js
and then open the index again

@mkouba mkouba self-assigned this Oct 18, 2024
@mkouba
Copy link
Contributor

mkouba commented Oct 18, 2024

It's the problem connected to io.quarkus.qute.runtime.devmode.QuteSetup. In order to support quarkus.qute.dev-mode.no-restart-templates we attempt to reload all templates when a no-restart change is detected. However, message bundles are not reflected in this logic.

I don't think we could reliably identify the set of templates that need to bo reloaded (because of {#include} etc.).

The correct solution is probably to introduce a dedicated TemplateLocator for message bundles... so that the messages can be reloaded automatically.

@quarkus-bot quarkus-bot bot added this to the 3.17 - main milestone Oct 18, 2024
@gsmet gsmet modified the milestones: 3.17 - main, 3.16.0 Oct 21, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 21, 2024
- introduce a dedicated TemplateLocator so that the message templates
can be reloaded automatically when a no-restart change occurs during the
dev mode
- fixes quarkusio#43944

(cherry picked from commit af45546)
bschuhmann pushed a commit to bschuhmann/quarkus that referenced this issue Nov 16, 2024
- introduce a dedicated TemplateLocator so that the message templates
can be reloaded automatically when a no-restart change occurs during the
dev mode
- fixes quarkusio#43944
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devmode area/qute The template engine kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants