1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Lots of unclosed input and output streams now properly closed. They were preventing Boards Manager from working on Windows

This commit is contained in:
Federico Fissore
2015-05-04 15:44:34 +02:00
parent 71106edbf8
commit cd49d29e52
15 changed files with 252 additions and 201 deletions

View File

@ -1210,12 +1210,12 @@ public class Compiler implements MessageConsumer {
// 2. run preproc on that code using the sugg class name
// to create a single .java file and write to buildpath
FileOutputStream outputStream = null;
try {
// Output file
File streamFile = new File(buildPath, sketch.getName() + ".cpp");
FileOutputStream outputStream = new FileOutputStream(streamFile);
outputStream = new FileOutputStream(streamFile);
preprocessor.write(outputStream);
outputStream.close();
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
String msg = _("Build folder disappeared or could not be written");
@ -1230,6 +1230,14 @@ public class Compiler implements MessageConsumer {
System.err.println(I18n.format(_("Uncaught exception type: {0}"), ex.getClass()));
ex.printStackTrace();
throw new RunnerException(ex.toString());
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
//noop
}
}
}
// grab the imports from the code just preproc'd