Skip to content
Snippets Groups Projects
Commit 4c51eca6 authored by Gerald Hübsch's avatar Gerald Hübsch
Browse files

free resources of the buffered reader stream in all situations

parent f285daee
No related branches found
No related tags found
No related merge requests found
Pipeline #9007 failed
......@@ -108,10 +108,11 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
private void callMediaconch(String filePath, String profilePath) {
String execstring = this.mediaconch_binary_path + " " + filePath + " -p " + profilePath;
log.info("executing: " + execstring);
final AtomicBoolean fuse = new AtomicBoolean(true);
final AtomicBoolean fuse = new AtomicBoolean(true);
final BufferedReader procOutputReader = null;
try {
Process p = Runtime.getRuntime().exec(execstring);
BufferedReader procOutputReader = new BufferedReader(new InputStreamReader(p.getInputStream()));
procOutputReader = new BufferedReader(new InputStreamReader(p.getInputStream()));
final ArrayList<String> procOutputLineList = new ArrayList<String>();
......@@ -170,8 +171,7 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
System.out.println("MEDIACONCH line: " + line);
validationLog.add(line);
log.info( line );
}
procOutputReader.close();
}
} catch (IOException e) {
log.error("(actual) mediaconch not available, path=" + this.mediaconch_binary_path + ", " , e.getMessage());
System.out.println("ERROR: (actual) mediaconch not available, path=" + this.mediaconch_binary_path + ", " + e.getMessage());
......@@ -181,6 +181,11 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
} finally {
// ensure the while loop of procOutputReaderThread terminates under all circumstances
fuse.set(false);
// cleanup all resources
if (procOutputReader != null) {
procOutputReader.close();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment