From ca9262213dacca2b03b1ff39f2bfdbcf17527673 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 13 Mar 2018 20:53:11 -0400 Subject: [PATCH] add another try/catch for createWriter() call --- java/src/processing/mode/java/JavaBuild.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/java/src/processing/mode/java/JavaBuild.java b/java/src/processing/mode/java/JavaBuild.java index 4091707fc..0022fe222 100644 --- a/java/src/processing/mode/java/JavaBuild.java +++ b/java/src/processing/mode/java/JavaBuild.java @@ -248,11 +248,15 @@ public class JavaBuild { srcFolder : new File(srcFolder, packageName.replace('.', '/')); outputFolder.mkdirs(); final File java = new File(outputFolder, sketch.getName() + ".java"); - final PrintWriter writer = PApplet.createWriter(java); try { - result = preprocessor.write(writer, bigCode.toString(), codeFolderPackages); - } finally { - writer.close(); + final PrintWriter writer = PApplet.createWriter(java); + try { + result = preprocessor.write(writer, bigCode.toString(), codeFolderPackages); + } finally { + writer.close(); + } + } catch (RuntimeException re) { + throw new SketchException("Could not write " + java.getAbsolutePath()); } } catch (antlr.RecognitionException re) { // re also returns a column that we're not bothering with for now