Skip to content

getResource() should never be called with a starting slash when called on a classloader#6553

Closed
ahus1 wants to merge 1 commit intojruby:masterfrom
ahus1:classloader-starting-with-slash
Closed

getResource() should never be called with a starting slash when called on a classloader#6553
ahus1 wants to merge 1 commit intojruby:masterfrom
ahus1:classloader-starting-with-slash

Conversation

@ahus1
Copy link
Contributor

@ahus1 ahus1 commented Feb 8, 2021

Calling it with a slash might or might not work depending on the classloader.
A starting slash is only used when calling getResource() on a class.

JRuby using a "/" at the beginning cased an exception when running this inside the plugin class loader of IntelliJ (asciidoctor/asciidoctor-intellij-plugin#664).
I'd be happy if this could be included in an upcoming patch release, so I can remove a workaround in the IntelliJ AsciiDoc plugin.

See https://stackoverflow.com/questions/47900677/where-does-leading-slash-in-java-class-loader-getresource-leads-to for more information on slashes and classloaders.

…d on a classloader.

Calling it with a slash might or might not work depending on the classloader.
A starting slash is only used when calling getResource() on a class.
@headius
Copy link
Member

headius commented Feb 10, 2021

This is a simple fix. I will cherry-pick it to the 9.2 branch and merge that to master so it is in 9.2.15.0 or 9.3, whichever comes next (hopefully within the next month).

@headius
Copy link
Member

headius commented Feb 10, 2021

Cherry-picked to jruby-9.2 in 0013ec5 and will be merged to master shortly. Thank you!

@headius headius closed this Feb 10, 2021
@headius headius added this to the JRuby 9.2.15.0 milestone Feb 10, 2021
@ahus1 ahus1 deleted the classloader-starting-with-slash branch May 4, 2021 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants