poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 59634] XSSFWorkbook#close() violates contract from Workbook#close()
Date Sun, 29 May 2016 10:25:57 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=59634

--- Comment #2 from Dominik Stadler <dominik.stadler@gmx.at> ---
For dicussion, the current javadoc for Workbook.close() is

     * Close the underlying input resource (File or Stream),
     *  from which the Workbook was read. After closing, the
     *  Workbook should no longer be used.
     * <p>This will have no effect newly created Workbooks.

HSSFWorkbook.close()

     * Closes the underlying {@link NPOIFSFileSystem} from which
     *  the Workbook was read, if any. Has no effect on Workbooks
     *  opened from an InputStream, or newly created ones.

XSSFWorkbook.close()

     * Closes the underlying {@link OPCPackage} from which this
     *  document was read, if there is one

We should probably rephrase those to state more in the order of "do not use at
all after closing" and "it will close resources that have been passed in the
constructor". This makes it as simple as possible and does not lead to very
hard to find bugs if passed in resources are closed at some point.

This way would also be consistent with what many other Java-Closeable-instances
will do when they receive some resource themselves, e.g. see
FileInputStreamReader, FileOutputStreamWriter, ...

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message