Skip to content

Commit de3580a

Browse files
committed
Ensure we have a classloader to boot from
If JRuby is loaded in the bootstrap classloader, the direct getClassLoader for a Class object might return null. Use the alternative Ruby.getClassLoader instead which will fall back on the standard system classloader.
1 parent ca5b4cb commit de3580a

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

core/src/main/java/org/jruby/Ruby.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,7 @@ public RubyObjectSpecializer getObjectSpecializer() {
26302630
}
26312631

26322632
public static ClassLoader getClassLoader() {
2633-
// we try to getService the classloader that loaded JRuby, falling back on System
2633+
// we try to get the classloader that loaded JRuby, falling back on System
26342634
ClassLoader loader = Ruby.class.getClassLoader();
26352635
if (loader == null) {
26362636
loader = ClassLoader.getSystemClassLoader();

core/src/main/java/org/jruby/ext/bigdecimal/BigDecimalLibrary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ public void load(Ruby runtime, boolean wrap) throws IOException {
4343
RubyBigDecimal.createBigDecimal(context);
4444

4545
// using load since this file does not exist in MRI
46-
loadService(context).loadFromClassLoader(Ruby.class.getClassLoader(), "jruby/bigdecimal.rb", false);
46+
loadService(context).loadFromClassLoader(Ruby.getClassLoader(), "jruby/bigdecimal.rb", false);
4747
}
4848
}// BigDecimalLibrary

core/src/main/java/org/jruby/javasupport/Java.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void load(Ruby runtime, boolean wrap) {
139139
RubyClass objectClass = (RubyClass) getProxyClass(context, java.lang.Object.class);
140140

141141
// load Ruby parts of the 'java' library
142-
loadService(context).loadFromClassLoader(Ruby.class.getClassLoader(), "jruby/java.rb", false);
142+
loadService(context).loadFromClassLoader(Ruby.getClassLoader(), "jruby/java.rb", false);
143143

144144
// rewire ArrayJavaProxy superclass to point at Object, so it inherits Object behaviors
145145
Access.getClass(context, "ArrayJavaProxy").

0 commit comments

Comments
 (0)