You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2014/07/02 17:05:05 UTC
svn commit: r1607390 - in /poi/trunk/src:
java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
Author: centic
Date: Wed Jul 2 15:05:05 2014
New Revision: 1607390
URL: http://svn.apache.org/r1607390
Log:
Bug 56537: Update javadoc to reflect the addition of Closeable to Workbook
Modified:
poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java?rev=1607390&r1=1607389&r2=1607390&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java Wed Jul 2 15:05:05 2014
@@ -157,7 +157,6 @@ public class NPOIFSFileSystem extends Bl
*
* @exception IOException on errors reading, or on invalid data
*/
- @SuppressWarnings("resource")
public NPOIFSFileSystem(File file, boolean readOnly)
throws IOException
{
Modified: poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java?rev=1607390&r1=1607389&r2=1607390&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java Wed Jul 2 15:05:05 2014
@@ -39,6 +39,8 @@ import org.apache.poi.xssf.usermodel.XSS
public class WorkbookFactory {
/**
* Creates a HSSFWorkbook from the given POIFSFileSystem
+ * <p>Note that in order to properly release resources the
+ * Workbook should be closed after use.
*/
public static Workbook create(POIFSFileSystem fs) throws IOException {
return new HSSFWorkbook(fs);
@@ -46,6 +48,8 @@ public class WorkbookFactory {
/**
* Creates a HSSFWorkbook from the given NPOIFSFileSystem
+ * <p>Note that in order to properly release resources the
+ * Workbook should be closed after use.
*/
public static Workbook create(NPOIFSFileSystem fs) throws IOException {
return new HSSFWorkbook(fs.getRoot(), true);
@@ -53,6 +57,8 @@ public class WorkbookFactory {
/**
* Creates a XSSFWorkbook from the given OOXML Package
+ * <p>Note that in order to properly release resources the
+ * Workbook should be closed after use.
*/
public static Workbook create(OPCPackage pkg) throws IOException {
return new XSSFWorkbook(pkg);
@@ -65,6 +71,8 @@ public class WorkbookFactory {
* be wrapped as a {@link PushbackInputStream}! Note that
* using an {@link InputStream} has a higher memory footprint
* than using a {@link File}.</p>
+ * <p>Note that in order to properly release resources the
+ * Workbook should be closed after use.
*/
public static Workbook create(InputStream inp) throws IOException, InvalidFormatException {
// If clearly doesn't do mark/reset, wrap up
@@ -84,8 +92,8 @@ public class WorkbookFactory {
/**
* Creates the appropriate HSSFWorkbook / XSSFWorkbook from
* the given File, which must exist and be readable.
- * <p>Note that for Workbooks opened this way, it is not possible
- * to explicitly close the underlying File resource.
+ * <p>Note that in order to properly release resources the
+ * Workbook should be closed after use.
*/
public static Workbook create(File file) throws IOException, InvalidFormatException {
if (! file.exists()) {
@@ -93,6 +101,7 @@ public class WorkbookFactory {
}
try {
+ @SuppressWarnings("resource")
NPOIFSFileSystem fs = new NPOIFSFileSystem(file);
return new HSSFWorkbook(fs.getRoot(), true);
} catch(OfficeXmlFileException e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org