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

Qute type-safe expression in type-safe message results in NPE #16590

Closed
manuelbl opened this issue Apr 16, 2021 · 2 comments · Fixed by #16618
Closed

Qute type-safe expression in type-safe message results in NPE #16590

manuelbl opened this issue Apr 16, 2021 · 2 comments · Fixed by #16618
Assignees
Labels
area/qute The template engine env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@manuelbl
Copy link

Describe the bug

If a collection-like parameter for a Qute template is declared using the {@type name} syntax and collection items are then used as a parameter for type-safe messages, Quarkus is unable to build and start.

Expected behavior

Type-safe message parameters work whether the argument type has been declared in the template or not.

Actual behavior

Quarkus is unable to build (or start in dev mode) as a NullPointerException occurs during the build phase.

The bug does not occur for simple types, but for collection types.

Stack trace:

2021-04-16 17:53:59,592 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (vert.x-worker-thread-1) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
java.lang.NullPointerException
	at io.quarkus.qute.deployment.Types.isAssignableFrom(Types.java:116)
	at io.quarkus.qute.deployment.MessageBundleProcessor.validateMessageBundleMethodsInTemplates(MessageBundleProcessor.java:410)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
	at java.base/java.lang.Thread.run(Thread.java:832)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Resulted in: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.qute.deployment.MessageBundleProcessor#validateMessageBundleMethodsInTemplates threw an exception: java.lang.NullPointerException
	at io.quarkus.qute.deployment.Types.isAssignableFrom(Types.java:116)
	at io.quarkus.qute.deployment.MessageBundleProcessor.validateMessageBundleMethodsInTemplates(MessageBundleProcessor.java:410)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
	at java.base/java.lang.Thread.run(Thread.java:832)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

	at io.quarkus.builder.Execution.run(Execution.java:116)
	at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
	at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:153)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:394)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.reloadExistingApplication(AugmentActionImpl.java:282)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.reloadExistingApplication(AugmentActionImpl.java:66)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:189)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:175)
	at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:254)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:62)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:52)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:832)
Resulted in: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.qute.deployment.MessageBundleProcessor#validateMessageBundleMethodsInTemplates threw an exception: java.lang.NullPointerException
	at io.quarkus.qute.deployment.Types.isAssignableFrom(Types.java:116)
	at io.quarkus.qute.deployment.MessageBundleProcessor.validateMessageBundleMethodsInTemplates(MessageBundleProcessor.java:410)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
	at java.base/java.lang.Thread.run(Thread.java:832)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:396)
	... 12 more

To Reproduce

Minimal project to reproduce: message-in-loop.zip

The problematic line is the first line of page.txt (see snippet below). It results in an exception. If it is removed, it no longer crashes and the page can be opened from a browser at http://localhost:8080/hello-resteasy

{@java.util.List<java.lang.String> names}
{#each names}
    {msg:hello(it)}
{/each}

Steps to reproduce the behavior:

  1. Start the attached project in dev mode: mvnw compile quarkus:dev

Environment (please complete the following information):

Output of uname -a or ver

Microsoft Windows [Version 10.0.19042.928]

Output of java -version

openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment (build 14.0.1+7)
OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)

Quarkus version or git rev

1.32.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\xxx\.m2\wrapper\dists\apache-maven-3.6.3-bin\1iopthnavndlasol9gbrbg6bf2\apache-maven-3.6.3
Java version: 14.0.1, vendor: Oracle Corporation, runtime: C:\Users\xxx\.jdks\openjdk-14.0.1
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
@manuelbl manuelbl added the kind/bug Something isn't working label Apr 16, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 16, 2021

/cc @mkouba

@quarkus-bot quarkus-bot bot added area/qute The template engine env/windows Impacts Windows machines labels Apr 16, 2021
@mkouba mkouba self-assigned this Apr 19, 2021
mkouba added a commit to mkouba/quarkus that referenced this issue Apr 19, 2021
- NPE is currently thrown if a type-safe message expression references a
parent expression via hint
- resolves quarkusio#16590
@mkouba
Copy link
Contributor

mkouba commented Apr 19, 2021

Thanks for reporting! This bug should be fixed in #16618.

@quarkus-bot quarkus-bot bot added this to the 2.0 - main milestone Apr 20, 2021
@gsmet gsmet modified the milestones: 2.0.0.Alpha1, 1.13.3.Final Apr 26, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Apr 26, 2021
- NPE is currently thrown if a type-safe message expression references a
parent expression via hint
- resolves quarkusio#16590

(cherry picked from commit cb2305f)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Apr 26, 2021
- NPE is currently thrown if a type-safe message expression references a
parent expression via hint
- resolves quarkusio#16590

(cherry picked from commit cb2305f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/qute The template engine env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants