From 819ddd6c644109f3660820df77db2c2f2352e124 Mon Sep 17 00:00:00 2001 From: Tim Strazzere Date: Mon, 19 Oct 2015 16:28:31 -0700 Subject: [PATCH] Ensure streams are available before closing --- src/main/java/diff/rednaga/AXMLPrinter.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/diff/rednaga/AXMLPrinter.java b/src/main/java/diff/rednaga/AXMLPrinter.java index eeb020d..156deb4 100644 --- a/src/main/java/diff/rednaga/AXMLPrinter.java +++ b/src/main/java/diff/rednaga/AXMLPrinter.java @@ -78,8 +78,13 @@ public static void main(String[] arguments) throws IOException { } catch (Exception e) { e.printStackTrace(); } finally { - fileInputStream.close(); - fileOutputStream.close(); + if (fileInputStream != null) { + fileInputStream.close(); + } + + if (fileOutputStream != null) { + fileOutputStream.close(); + } } }