@@ -93,27 +93,34 @@ public String initLoader(String className) throws Exception {
93
93
File [] toolArchives = Util .listJarFiles (toolDir );
94
94
File [] libArchives = Util .listJarFiles (libDir );
95
95
96
- if (toolArchives != null && toolArchives .length > 0 &&
97
- libArchives != null && libArchives .length > 0 ) {
98
- URL [] urlList = new URL [toolArchives .length + libArchives .length + 1 ];
96
+ if (toolArchives != null && toolArchives .length > 0 ) {
97
+
98
+ int nArchives = toolArchives .length + 1 ;
99
+ if (libArchives != null && libArchives .length > 0 ) {
100
+ nArchives += libArchives .length ;
101
+ }
102
+ URL [] urlList = new URL [nArchives ];
99
103
100
104
int j ;
101
105
for (j = 0 ; j < toolArchives .length ; j ++) {
102
106
Messages .log ("Found archive " + toolArchives [j ] + " for " + getName ());
103
107
urlList [j ] = toolArchives [j ].toURI ().toURL ();
104
108
}
105
- for (int k = 0 ; k < libArchives .length ; k ++, j ++) {
106
- Messages .log ("Found archive " + libArchives [k ] + " for " + getName ());
107
- urlList [j ] = libArchives [k ].toURI ().toURL ();
109
+ if (libArchives != null ) {
110
+ for (int k = 0 ; k < libArchives .length ; k ++, j ++) {
111
+ Messages .log ("Found archive " + libArchives [k ] + " for " + getName ());
112
+ urlList [j ] = libArchives [k ].toURI ().toURL ();
113
+ }
108
114
}
109
115
urlList [urlList .length - 1 ] = new File (mode .getModeJar ()).toURI ().toURL ();
110
116
111
-
112
117
// String modePath = new File(dmode.getFolder(), "mode").getAbsolutePath();
113
118
// urlList[urlList.length - 1] = new File(modePath + File.separator + "JavaMode.jar").toURI().toURL();
114
119
115
120
loader = new URLClassLoader (urlList );
116
121
Messages .log ("loading above JARs with loader " + loader );
122
+ } else {
123
+ throw new IgnorableException ("Could not find any files inside " + toolDir .getAbsolutePath ());
117
124
}
118
125
}
119
126
0 commit comments