* @param fd the file to write to\r
*/\r
public Writer createWriter(File fd) throws IOException {\r
- final OutputStream decorated = decorateOutputStream(new FileOutputStream(fd));\r
- return new BufferedWriter(new OutputStreamWriter(decorated, "UTF-8"));\r
+ FileOutputStream fos = new FileOutputStream(fd);\r
+ OutputStream decorated;\r
+ try {\r
+ decorated = decorateOutputStream(fos);\r
+ } catch (final IOException e) {\r
+ fos.close();\r
+ throw e;\r
+ }\r
+ return new BufferedWriter(\r
+ new OutputStreamWriter(decorated, "UTF-8"));\r
}\r
\r
/**\r
*/\r
public InputStream getWorksheetXMLInputStream() throws IOException {\r
File fd = getTempFile();\r
- return decorateInputStream(new FileInputStream(fd));\r
+ FileInputStream fis = new FileInputStream(fd);\r
+ try {\r
+ return decorateInputStream(fis);\r
+ } catch (IOException e) {\r
+ fis.close();\r
+ throw e;\r
+ }\r
}\r
\r
/**\r