aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/poifs
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2011-06-04 20:22:00 +0000
committerNick Burch <nick@apache.org>2011-06-04 20:22:00 +0000
commit49744421732815577c5594019f6d3151a1be018d (patch)
treea64dd59957cd69aa3394a6041e3f0061e0fe92b7 /src/java/org/apache/poi/poifs
parenteda64b038465c08225d2da370d0b9fd9399e051f (diff)
downloadpoi-49744421732815577c5594019f6d3151a1be018d.tar.gz
poi-49744421732815577c5594019f6d3151a1be018d.zip
Work on NPOIFS document read/mark/reset work for bug #51318, including enabling more of the old POIFS tests to work for both
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1131488 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/poifs')
-rw-r--r--src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java6
-rw-r--r--src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java b/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
index 738a8e1a90..d5c75ea17c 100644
--- a/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
+++ b/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
@@ -389,7 +389,11 @@ public class DirectoryNode
final InputStream stream)
throws IOException
{
- return createDocument(new POIFSDocument(name, stream));
+ if(_nfilesystem != null) {
+ return createDocument(new NPOIFSDocument(name, _nfilesystem, stream));
+ } else {
+ return createDocument(new POIFSDocument(name, stream));
+ }
}
/**
diff --git a/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java b/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java
index 602cb5ff56..392a1ea0f3 100644
--- a/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java
+++ b/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java
@@ -61,7 +61,7 @@ public final class NDocumentInputStream extends DocumentInputStream {
*/
public NDocumentInputStream(DocumentEntry document) throws IOException {
if (!(document instanceof DocumentNode)) {
- throw new IOException("Cannot open internal document storage");
+ throw new IOException("Cannot open internal document storage, " + document + " not a Document Node");
}
_current_offset = 0;
_current_block_count = 0;
@@ -111,7 +111,7 @@ public final class NDocumentInputStream extends DocumentInputStream {
@Override
public void mark(int ignoredReadlimit) {
_marked_offset = _current_offset;
- _marked_offset_count = _current_block_count;
+ _marked_offset_count = Math.max(0, _current_block_count - 1);
}
@Override