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

RunnerClassLoader sanitizeName cannot handle 0 length name argument #14583

Closed
jamesnetherton opened this issue Jan 25, 2021 · 1 comment · Fixed by #14599
Closed

RunnerClassLoader sanitizeName cannot handle 0 length name argument #14583

jamesnetherton opened this issue Jan 25, 2021 · 1 comment · Fixed by #14599
Labels
area/kotlin kind/bug Something isn't working
Milestone

Comments

@jamesnetherton
Copy link
Contributor

I've been working to make camel-k use the Quarkus fast-jar package format. With Kotlin based Camel routes, the application statup fails.

I'm no Kotlin expert, but its bootstrap is calling getResources("") on the ClassLoader (not sure if that's valid or not). When the name argument passed to RunnerClassLoader.sanitizeName is an empty string, then an exception is thrown:

2021-01-25 13:24:08,916 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): 2021-01-25 14:29:11,572 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
	at java.base/java.lang.String.charAt(String.java:693)
	at io.quarkus.bootstrap.runner.RunnerClassLoader.sanitizeName(RunnerClassLoader.java:150)
	at io.quarkus.bootstrap.runner.RunnerClassLoader.findResources(RunnerClassLoader.java:180)
	at java.base/java.lang.ClassLoader.getResources(ClassLoader.java:1467)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.rawClassPathFromKeyResourcePath(jvmClasspathUtil.kt:130)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.classPathFromTypicalResourceUrls(jvmClasspathUtil.kt:143)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt$classpathFromClassloader$1.invoke(jvmClasspathUtil.kt:87)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt$classpathFromClassloader$1.invoke(jvmClasspathUtil.kt)
	at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:315)
	at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:169)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
	at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:752)
	at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:782)
	at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:773)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.classpathFromClassloader(jvmClasspathUtil.kt:92)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.scriptCompilationClasspathFromContextOrNull(jvmClasspathUtil.kt:275)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.scriptCompilationClasspathFromContext(jvmClasspathUtil.kt:298)
	at kotlin.script.experimental.jvm.JvmScriptCompilationKt.dependenciesFromClassloader(jvmScriptCompilation.kt:57)
	at kotlin.script.experimental.jvm.JvmScriptCompilationKt.dependenciesFromClassloader$default(jvmScriptCompilation.kt:54)
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.

2 participants