Commit f319caa5 authored by unknown's avatar unknown
Browse files

Trying 'waitFor' to resolve the exception.

parent 358a43eb
Pipeline #171508 passed with stages
in 48 seconds
......@@ -53,7 +53,7 @@ public enum DownloadFileResponseData {
}
@Override
public synchronized File getTargetFile(String query, String answer,
public File getTargetFile(String query, String answer,
String targetFileName) {
// Uses "sourceFile" to create another "targetFile" at the given "targetFilePath"
File mdFile = DownloadFileResponseData.MD.getTargetFile(query, answer, targetFileName);
......@@ -70,22 +70,12 @@ public enum DownloadFileResponseData {
pd.command(command);
try {
pd.inheritIO().start();
Process p = pd.inheritIO().start();
p.waitFor();
} catch (Exception e) {
mdFile.delete();
return null;
}
try {
pd.wait();
}
catch (IllegalMonitorStateException e){
return DownloadFileResponseData.MD.getTargetFile(query, answer, "IllegalMonitorStateException");
}
catch (InterruptedException e) {
return DownloadFileResponseData.MD.getTargetFile(query,answer, "InterruptedException");
}
mdFile.delete();
return new File(fileNameWithExtension);
}
......
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