You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2018/03/28 16:28:29 UTC

[tika] branch master updated: TIKA-2617 -- handle new IOOBE on streams now parsed as npoifs in ppt embedded streams as any other IOException on an embedded stream

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/master by this push:
     new acb4958  TIKA-2617 -- handle new IOOBE on streams now parsed as npoifs in ppt embedded streams as any other IOException on an embedded stream
acb4958 is described below

commit acb49581c9be20f0c880400403caa0ea1b30b508
Author: tballison <ta...@mitre.org>
AuthorDate: Wed Mar 28 12:28:17 2018 -0400

    TIKA-2617 -- handle new IOOBE on streams now parsed as npoifs in ppt
    embedded streams as any other IOException on an embedded stream
---
 .../org/apache/tika/parser/microsoft/HSLFExtractor.java   | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/HSLFExtractor.java b/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/HSLFExtractor.java
index 02665e5..7057cbe 100644
--- a/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/HSLFExtractor.java
+++ b/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/HSLFExtractor.java
@@ -36,7 +36,6 @@ import org.apache.poi.hslf.usermodel.HSLFMasterSheet;
 import org.apache.poi.hslf.usermodel.HSLFNotes;
 import org.apache.poi.hslf.usermodel.HSLFObjectData;
 import org.apache.poi.hslf.usermodel.HSLFPictureData;
-import org.apache.poi.hslf.usermodel.HSLFPictureShape;
 import org.apache.poi.hslf.usermodel.HSLFShape;
 import org.apache.poi.hslf.usermodel.HSLFSlide;
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
@@ -52,6 +51,7 @@ import org.apache.tika.exception.TikaException;
 import org.apache.tika.exception.EncryptedDocumentException;
 import org.apache.tika.extractor.EmbeddedDocumentUtil;
 import org.apache.tika.io.CloseShieldInputStream;
+import org.apache.tika.io.IOExceptionWithCause;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.metadata.Metadata;
 import org.apache.tika.mime.MediaType;
@@ -489,8 +489,19 @@ public class HSLFExtractor extends AbstractPOIFSExtractor {
                         }
                         if (mediaType.equals("application/x-tika-msoffice-embedded; format=comp_obj")
                                 || mediaType.equals("application/x-tika-msoffice")) {
-                            try(NPOIFSFileSystem npoifs = new NPOIFSFileSystem(new CloseShieldInputStream(stream))) {
+                            NPOIFSFileSystem npoifs = null;
+
+                            try {
+                                npoifs = new NPOIFSFileSystem(new CloseShieldInputStream(stream));
+                            } catch (RuntimeException e) {
+                                throw new IOExceptionWithCause(e);
+                            }
+                            try {
                                 handleEmbeddedOfficeDoc(npoifs.getRoot(), objID, xhtml);
+                            } finally {
+                                if (npoifs != null) {
+                                    npoifs.close();
+                                }
                             }
                         } else {
                             handleEmbeddedResource(

-- 
To stop receiving notification emails like this one, please contact
tallison@apache.org.