File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -529,14 +529,16 @@ public Class<?> loadClass(String name)
529529 // However, as the default class loader does not reload classes that have changed
530530 // we use the handle to the class to try and get it's actual .class definition
531531 // which we then define in THIS ClassLoader subclass. Hence: dynamic class reloading :)
532- InputStream s1 = c .getResourceAsStream (c .getName () + ".class" );
533- if (s1 == null )
534- return c ;
535- s = new DataInputStream (s1 );
536- int len = s .available ();
537- byte [] data = new byte [len ];
538- s .readFully (data );
539- return defineClass (name , data , 0 , len );
532+ String path = ClassLoader .getSystemResource (c .getName ().replaceAll ("\\ ." , String .valueOf (File .separatorChar )) + ".class" ).getFile ();
533+ File f = new File (path );
534+ if (!f .exists ()) {
535+ return c ;
536+ }
537+ int len = (int ) f .length ();
538+ byte [] data = new byte [len ];
539+ s = new DataInputStream (new FileInputStream (f ));
540+ s .readFully (data );
541+ return defineClass (name , data , 0 , len );
540542 }
541543 catch (Exception e )
542544 {
You can’t perform that action at this time.
0 commit comments