@@ -95,57 +95,15 @@ public SixModelObject getInteropForClass(Class<?> c) {
95
95
96
96
/** Main entry point for OO-ish callouts. */
97
97
public SixModelObject typeForName (String name ) {
98
+ Class <?> klass = null ;
99
+ ClassLoader syscl = ClassLoader .getSystemClassLoader ();
98
100
try {
99
- return getSTableForClass (Class .forName (name )).WHAT ;
100
- } catch (ClassNotFoundException e ) {
101
- try {
102
- String cfname = name .replace ("." , "/" );
103
- String cpStr = System .getProperty ("java.class.path" );
104
- String [] cps = cpStr .split ("[;:]" );
105
- String cfpath = null ;
106
- File cf = null ;
107
- for (int i = 0 ; i < cps .length ; i ++) {
108
- cf = new File (cps [i ] + "/" + cfname + ".class" );
109
- if (cf .exists ()) {
110
- cfpath = cf .toString ().replace (cfname + ".class" , "" );
111
- break ;
112
- }
113
- cf = null ;
114
- }
115
- if (cfpath != null ) {
116
- try {
117
- URL url = new URL ("file://" + cfpath + "/" );
118
- URLClassLoader cl = new URLClassLoader (new URL [] { url });
119
- jarClassLoaders .put (cfname , cl );
120
- return getSTableForClass (cl .loadClass (name )).WHAT ;
121
- } catch (MalformedURLException mue ) {
122
- throw mue ;
123
- }
124
- } else {
125
- throw e ;
126
- }
127
- } catch (ClassNotFoundException |MalformedURLException ine ) {
128
- throw ExceptionHandling .dieInternal (gc .getCurrentThreadContext (), ine );
129
- }
101
+ klass = syscl .loadClass (name );
130
102
}
131
- }
132
- public SixModelObject typeForNameFromJAR (String name , String JAR ) {
133
- try {
134
- URLClassLoader cl = jarClassLoaders .get (JAR );
135
- if (cl == null ) {
136
- URL url = new URL ("jar:" + new File (JAR ).toURI ().toURL () + "!/" );
137
- cl = new URLClassLoader (new URL [] { url });
138
- jarClassLoaders .put (JAR , cl );
139
- }
140
- return getSTableForClass (Class .forName (name , true , cl )).WHAT ;
141
- } catch (ClassNotFoundException e ) {
142
- throw ExceptionHandling .dieInternal (gc .getCurrentThreadContext (), e );
143
- } catch (MalformedURLException e ) {
144
- throw ExceptionHandling .dieInternal (gc .getCurrentThreadContext (), e );
145
- } catch (Throwable e ) {
146
- e .printStackTrace ();
147
- throw e ;
103
+ catch ( ClassNotFoundException cnfe ) {
104
+ throw ExceptionHandling .dieInternal (gc .getCurrentThreadContext (), cnfe );
148
105
}
106
+ return getSTableForClass (klass ).WHAT ;
149
107
}
150
108
151
109
/** Convenience methods for NQP coding. */
0 commit comments