Commit 0cc7a50e authored by Adam Knapp's avatar Adam Knapp

Fixing InvokeBuild input argument check

Signed-off-by: Adam Knapp's avatarAdam Knapp <adam.knapp@ericsson.com>
parent 2c60ae86
...@@ -257,12 +257,13 @@ public final class PathUtil { ...@@ -257,12 +257,13 @@ public final class PathUtil {
* @see java.io.File#getCanonicalPath * @see java.io.File#getCanonicalPath
*/ */
public static boolean isValidFilePath(String path) { public static boolean isValidFilePath(String path) {
File f = new File(path);
try { try {
File f = new File(path);
f.getCanonicalPath(); f.getCanonicalPath();
return true; return true;
} } catch (IOException e) {
catch (IOException e) { return false;
} catch (NullPointerException e) {
return false; return false;
} }
} }
......
...@@ -94,7 +94,7 @@ public final class InvokeBuild implements IApplication { ...@@ -94,7 +94,7 @@ public final class InvokeBuild implements IApplication {
} }
projectName = args[i]; projectName = args[i];
} }
if (!PathUtil.isValidFilePath(pathToJar)) { if (!StringUtils.isNullOrEmpty(pathToJar) && !PathUtil.isValidFilePath(pathToJar)) {
System.out.println("The path `" + pathToJar + "' is not valid."); System.out.println("The path `" + pathToJar + "' is not valid.");
return closeWorkspace(); return closeWorkspace();
} }
...@@ -103,7 +103,7 @@ public final class InvokeBuild implements IApplication { ...@@ -103,7 +103,7 @@ public final class InvokeBuild implements IApplication {
if (project != null && project.getName().equals(projectName)) { if (project != null && project.getName().equals(projectName)) {
try { try {
project.refreshLocal(IResource.DEPTH_INFINITE, null); project.refreshLocal(IResource.DEPTH_INFINITE, null);
if (!StringUtils.isNullOrEmpty(pathToJar) && TITANJavaBuilder.isBuilderEnabled(project)) { if (TITANJavaBuilder.isBuilderEnabled(project)) {
addJarBuilder(project, pathToJar); addJarBuilder(project, pathToJar);
} }
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor()); project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment