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

[tika] 06/13: Fix exception handling

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

nick pushed a commit to branch multiple-parsers
in repository https://gitbox.apache.org/repos/asf/tika.git

commit c3897db807970e7eb39c87840e4e040713eb759c
Author: Nick Burch <ni...@gagravarr.org>
AuthorDate: Tue Mar 13 15:06:42 2018 +0000

    Fix exception handling
---
 .../org/apache/tika/parser/multiple/AbstractMultipleParser.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tika-core/src/main/java/org/apache/tika/parser/multiple/AbstractMultipleParser.java b/tika-core/src/main/java/org/apache/tika/parser/multiple/AbstractMultipleParser.java
index 46cd064..02d7e51 100644
--- a/tika-core/src/main/java/org/apache/tika/parser/multiple/AbstractMultipleParser.java
+++ b/tika-core/src/main/java/org/apache/tika/parser/multiple/AbstractMultipleParser.java
@@ -223,7 +223,13 @@ public abstract class AbstractMultipleParser extends AbstractParser {
                 boolean tryNext = parserCompleted(p, metadata, handler, failure);
                 // Abort if requested, with the exception if there was one
                 if (!tryNext) {
-                   if (failure != null) throw failure;
+                   if (failure != null) {
+                       if (failure instanceof IOException) throw (IOException)failure;
+                       if (failure instanceof SAXException) throw (SAXException)failure;
+                       if (failure instanceof TikaException) throw (TikaException)failure;
+                       throw new TikaException("Unexpected RuntimeException from " + p, failure);
+                   }
+                   // Abort processing, don't try any more parsers
                    break;
                 }
                 

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