@@ -246,7 +246,12 @@ public ClassLoader getUserCodeClassLoader() {
246
246
247
247
/** Returns all provided libraries needed to run the program. */
248
248
public List <URL > getJobJarAndDependencies () {
249
- List <URL > libs = new ArrayList <URL >(extractedTempLibraries .size () + 1 );
249
+ return getJobJarAndDependencies (jarFile , extractedTempLibraries , isPython );
250
+ }
251
+
252
+ private static List <URL > getJobJarAndDependencies (
253
+ URL jarFile , List <File > extractedTempLibraries , boolean isPython ) {
254
+ List <URL > libs = new ArrayList <>(extractedTempLibraries .size () + 2 );
250
255
251
256
if (jarFile != null ) {
252
257
libs .add (jarFile );
@@ -258,11 +263,9 @@ public List<URL> getJobJarAndDependencies() {
258
263
throw new RuntimeException ("URL is invalid. This should not happen." , e );
259
264
}
260
265
}
261
-
262
266
if (isPython ) {
263
267
libs .add (PackagedProgramUtils .getPythonJar ());
264
268
}
265
-
266
269
return libs ;
267
270
}
268
271
@@ -276,24 +279,8 @@ public static List<URL> getJobJarAndDependencies(
276
279
? Collections .emptyList ()
277
280
: extractContainedLibraries (jarFileUrl );
278
281
279
- List <URL > libs = new ArrayList <URL >(extractedTempLibraries .size () + 1 );
280
-
281
- if (jarFileUrl != null ) {
282
- libs .add (jarFileUrl );
283
- }
284
- for (File tmpLib : extractedTempLibraries ) {
285
- try {
286
- libs .add (tmpLib .getAbsoluteFile ().toURI ().toURL ());
287
- } catch (MalformedURLException e ) {
288
- throw new RuntimeException ("URL is invalid. This should not happen." , e );
289
- }
290
- }
291
-
292
- if (isPython (entryPointClassName )) {
293
- libs .add (PackagedProgramUtils .getPythonJar ());
294
- }
295
-
296
- return libs ;
282
+ return getJobJarAndDependencies (
283
+ jarFileUrl , extractedTempLibraries , isPython (entryPointClassName ));
297
284
}
298
285
299
286
/** Deletes all temporary files created for contained packaged libraries. */
0 commit comments