Skip to content

Commit 6f54d48

Browse files
committed
CID-1116298 path can be null, make sure that is properly handled
1 parent 6687727 commit 6f54d48

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

utils/src/com/cloud/utils/script/Script.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public static class Task implements Runnable {
308308
public Task(OutputInterpreter interpreter, BufferedReader reader) {
309309
this.interpreter = interpreter;
310310
this.reader = reader;
311-
this.result = null;
311+
result = null;
312312
}
313313

314314
@Override
@@ -340,8 +340,6 @@ public synchronized String getResult() throws InterruptedException {
340340
public static String findScript(String path, String script) {
341341
s_logger.debug("Looking for " + script + " in the classpath");
342342

343-
path = path.replace("/", File.separator);
344-
345343
URL url = ClassLoader.getSystemResource(script);
346344
s_logger.debug("System resource: " + url);
347345
File file = null;
@@ -351,6 +349,12 @@ public static String findScript(String path, String script) {
351349
return file.getAbsolutePath();
352350
}
353351

352+
if (path == null) {
353+
s_logger.warn("No search path specified, unable to look for " + script);
354+
return null;
355+
}
356+
path = path.replace("/", File.separator);
357+
354358
/**
355359
* Look in WEB-INF/classes of the webapp
356360
* URI workaround the URL encoding of url.getFile

0 commit comments

Comments
 (0)