File tree 1 file changed +14
-4
lines changed
core/src/main/java/org/jruby
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -1407,7 +1407,15 @@ public void setProfilingService( String service ) {
1407
1407
}
1408
1408
1409
1409
private static ClassLoader setupLoader () {
1410
- return RubyInstanceConfig .class .getClassLoader ();
1410
+ ClassLoader loader = RubyInstanceConfig .class .getClassLoader ();
1411
+
1412
+ // loader can be null for example when jruby comes from the boot-classLoader
1413
+
1414
+ if (loader == null ) {
1415
+ loader = Thread .currentThread ().getContextClassLoader ();
1416
+ }
1417
+
1418
+ return loader ;
1411
1419
}
1412
1420
1413
1421
////////////////////////////////////////////////////////////////////////////
@@ -1454,9 +1462,11 @@ private static ClassLoader setupLoader() {
1454
1462
private ProfileOutput profileOutput = new ProfileOutput (System .err );
1455
1463
private String profilingService ;
1456
1464
1457
- private ClassLoader thisLoader = setupLoader ();
1458
- // thisLoader can be null for example when jruby comes from the boot-classLoader
1459
- private ClassLoader loader = thisLoader == null ? Thread .currentThread ().getContextClassLoader () : thisLoader ;
1465
+ private ClassLoader loader = setupLoader ();
1466
+
1467
+ public ClassLoader getCurrentThreadClassLoader () {
1468
+ return Thread .currentThread ().getContextClassLoader ();
1469
+ }
1460
1470
1461
1471
// from CommandlineParser
1462
1472
private List <String > loadPaths = new ArrayList <String >();
You can’t perform that action at this time.
0 commit comments