You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2015/05/26 20:04:01 UTC
svn commit: r1681804 - in /poi/trunk/src:
java/org/apache/poi/poifs/filesystem/DirectoryNode.java
java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
testcases/org/apache/poi/poifs/filesystem/TestDocumentInputStream.java
Author: nick
Date: Tue May 26 18:04:00 2015
New Revision: 1681804
URL: http://svn.apache.org/r1681804
Log:
#56791 Make NPOIFS the default when POIFSFileSystem is requested
Modified:
poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocumentInputStream.java
Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java?rev=1681804&r1=1681803&r2=1681804&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java Tue May 26 18:04:00 2015
@@ -145,14 +145,15 @@ public class DirectoryNode
/**
* @return the filesystem that this belongs to
- * TODO Temporary workaround during #56791
*/
- public POIFSFileSystem getFileSystem()
+ public NPOIFSFileSystem getFileSystem()
{
- return (POIFSFileSystem)_ofilesystem;
+ return _nfilesystem;
}
/**
+ * If this is OPOIFS based, return the NPOIFSFileSystem
+ * that this belong to, otherwise Null if NPOIFS based
* @return the filesystem that this belongs to
*/
public OPOIFSFileSystem getOFileSystem()
@@ -161,6 +162,8 @@ public class DirectoryNode
}
/**
+ * If this is NPOIFS based, return the NPOIFSFileSystem
+ * that this belong to, otherwise Null if OPOIFS based
* @return the filesystem that this belongs to
*/
public NPOIFSFileSystem getNFileSystem()
Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java?rev=1681804&r1=1681803&r2=1681804&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java Tue May 26 18:04:00 2015
@@ -32,7 +32,7 @@ import org.apache.poi.util.CloseIgnoring
*/
public class POIFSFileSystem
- extends OPOIFSFileSystem // TODO Temporary workaround during #56791
+ extends NPOIFSFileSystem // TODO Temporary workaround during #56791
implements POIFSViewable
{
/**
@@ -95,14 +95,14 @@ public class POIFSFileSystem
* @param inp An InputStream which supports either mark/reset, or is a PushbackInputStream
*/
public static boolean hasPOIFSHeader(InputStream inp) throws IOException {
- return OPOIFSFileSystem.hasPOIFSHeader(inp);
+ return NPOIFSFileSystem.hasPOIFSHeader(inp);
}
/**
* Checks if the supplied first 8 bytes of a stream / file
* has a POIFS (OLE2) header.
*/
public static boolean hasPOIFSHeader(byte[] header8Bytes) {
- return OPOIFSFileSystem.hasPOIFSHeader(header8Bytes);
+ return NPOIFSFileSystem.hasPOIFSHeader(header8Bytes);
}
/**
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocumentInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocumentInputStream.java?rev=1681804&r1=1681803&r2=1681804&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocumentInputStream.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocumentInputStream.java Tue May 26 18:04:00 2015
@@ -31,10 +31,7 @@ import org.apache.poi.poifs.storage.RawD
/**
* Class to test DocumentInputStream functionality
- *
- * @author Marc Johnson
*/
-
public final class TestDocumentInputStream extends TestCase {
private DocumentNode _workbook_n;
private DocumentNode _workbook_o;
@@ -95,7 +92,7 @@ public final class TestDocumentInputStre
* test constructor
*/
public void testConstructor() throws IOException {
- DocumentInputStream ostream = new DocumentInputStream(_workbook_o);
+ DocumentInputStream ostream = new ODocumentInputStream(_workbook_o);
DocumentInputStream nstream = new NDocumentInputStream(_workbook_n);
assertEquals(_workbook_size, _workbook_o.getSize());
@@ -103,6 +100,9 @@ public final class TestDocumentInputStre
assertEquals(_workbook_size, ostream.available());
assertEquals(_workbook_size, nstream.available());
+
+ ostream.close();
+ nstream.close();
}
/**
@@ -514,12 +514,14 @@ public final class TestDocumentInputStre
NPOIFSFileSystem npoifs = new NPOIFSFileSystem(sample);
try {
- POIFSFileSystem opoifs = new POIFSFileSystem(new FileInputStream(sample));
+ OPOIFSFileSystem opoifs = new OPOIFSFileSystem(new FileInputStream(sample));
// Ensure we have what we expect on the root
assertEquals(npoifs, npoifs.getRoot().getNFileSystem());
- assertEquals(null, npoifs.getRoot().getFileSystem());
- assertEquals(opoifs, opoifs.getRoot().getFileSystem());
+ assertEquals(npoifs, npoifs.getRoot().getFileSystem());
+ assertEquals(null, npoifs.getRoot().getOFileSystem());
+ assertEquals(null, opoifs.getRoot().getFileSystem());
+ assertEquals(opoifs, opoifs.getRoot().getOFileSystem());
assertEquals(null, opoifs.getRoot().getNFileSystem());
// Check inside
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org