Skip to content

Conversation

@kares
Copy link
Contributor

@kares kares commented Feb 12, 2025

while also retaining the original version number in the SNAKEYAML_VERSION constant

closes #711

@kares kares changed the title Jruby: safer engine version resolution jruby: safer engine version resolution Feb 12, 2025
Properties props = new Properties();
try( InputStream is = runtime.getJRubyClassLoader().getResourceAsStream("META-INF/maven/org.snakeyaml/snakeyaml-engine/pom.properties") ) {
props.load(is);
try( InputStream is = SpecVersion.class.getResourceAsStream(POM_PROPERTIES) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using an actual class from the .jar we're trying to locate the resource from should work more reliably (for the common gem case this is going to be the same as before with runtime.getJRubyClassLoader()).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

Properties props = new Properties();
try( InputStream is = runtime.getJRubyClassLoader().getResourceAsStream("META-INF/maven/org.snakeyaml/snakeyaml-engine/pom.properties") ) {
props.load(is);
try( InputStream is = SpecVersion.class.getResourceAsStream(POM_PROPERTIES) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@headius headius merged commit a5744ed into ruby:master Feb 13, 2025
74 checks passed
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.

loading jruby ext can fail with NullPointerException

2 participants