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

Potential NPE thrown from QuarkusClassLoader.getResources #40438

Closed
jamesnetherton opened this issue May 3, 2024 · 4 comments · Fixed by #40440
Closed

Potential NPE thrown from QuarkusClassLoader.getResources #40438

jamesnetherton opened this issue May 3, 2024 · 4 comments · Fixed by #40440
Assignees
Labels
area/kotlin kind/bug Something isn't working
Milestone

Comments

@jamesnetherton
Copy link
Contributor

Describe the bug

There's an issue observed on the Camel Quarkus nightly build with Quarkus 999-SNAPSHOT.

The following change:

9daa467

Causes the camel-quarkus-kotlin-dsl tests to fail:

Caused by: java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
	at java.base/java.util.ImmutableCollections$List12.<init>(ImmutableCollections.java:563)
	at java.base/java.util.List.of(List.java:937)
	at io.quarkus.bootstrap.classloading.ClassPathElement.getResources(ClassPathElement.java:147)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.getResources(QuarkusClassLoader.java:270)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.getResources(QuarkusClassLoader.java:210)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.rawClassPathFromKeyResourcePath(jvmClasspathUtil.kt:139)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.classPathFromTypicalResourceUrls(jvmClasspathUtil.kt:152)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt$classpathFromClassloader$1.invoke(jvmClasspathUtil.kt:96)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt$classpathFromClassloader$1.invoke(jvmClasspathUtil.kt:77)

Seems that MemoryClassPathElement uses the default impl of ClassPathElement.getResources. If getResource(name) returns null, then it causes an NPE because it's passed into List.of().

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

  1. Clone the camel-quarkus project
  2. git checkout quarkus-main
  3. mvn clean install -Dquickly -T1C
  4. cd integration-tests/kotlin-dsl
  5. mvn clean test

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

999-SNAPSHOT

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

No response

Additional information

No response

@jamesnetherton jamesnetherton added the kind/bug Something isn't working label May 3, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented May 3, 2024

/cc @geoand (kotlin)

@geoand
Copy link
Contributor

geoand commented May 3, 2024

cc @stuartwdouglas

@dmlloyd
Copy link
Member

dmlloyd commented May 3, 2024

I can take this one.

@dmlloyd dmlloyd self-assigned this May 3, 2024
dmlloyd added a commit to dmlloyd/quarkus that referenced this issue May 3, 2024
dmlloyd added a commit to dmlloyd/quarkus that referenced this issue May 3, 2024
@geoand
Copy link
Contributor

geoand commented May 3, 2024

👌

@quarkus-bot quarkus-bot bot added this to the 3.11 - main milestone May 10, 2024
@gsmet gsmet modified the milestones: 3.11 - main, 3.10.1 May 10, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kotlin kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants