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 62cf6f6cb3539ffbdb2886ff5485a997b0fe6773
Author: Nick Burch <n...@gagravarr.org>
AuthorDate: Tue Mar 13 07:17:41 2018 +0000

    Add TODOs for code to be shared/copied with other areas
---
 .../apache/tika/parser/multiple/AbstractMultipleParser.java   | 11 ++++++++++-
 1 file changed, 10 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 08a90fd..c47e762 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
@@ -83,6 +83,8 @@ public abstract class AbstractMultipleParser extends 
AbstractParser {
     
     // TODO Figure out some sort of Content Policy and how
     //  it might possibly work
+    // TODO Is an overridden method that takes a 
+    //  ContentHandlerFactory the best way?
 
     /**
      * Media type registry.
@@ -184,12 +186,14 @@ public abstract class AbstractMultipleParser extends 
AbstractParser {
             //  re-wind it safely if required
             // TODO Support an InputStreamFactory as an alternative to
             //  Files, see TIKA-2585
+            // TODO Rewind support copy from ParserDecorator.withFallbacks
             TikaInputStream taggedStream = TikaInputStream.get(stream, tmp);
             Path path = taggedStream.getPath();
             
             // TODO Somehow shield/wrap the Handler, so that we can
             //  avoid failures if multiple parsers want to do content
             // TODO Solve the multiple-content problem!
+            // TODO Provide a way to supply a ContentHandlerFactory?
 
             for (Parser p : parsers) {
                 // TODO What's the best way to reset each time?
@@ -201,6 +205,7 @@ public abstract class AbstractMultipleParser extends 
AbstractParser {
                 // TODO Handle metadata clashes based on the Policy
                 
                 // Process if possible
+                // TODO Share error recording logic with RecursiveParserWrapper
                 Exception failure = null;
                 try {
                     p.parse(parserStream, handler, metadata, context);
@@ -210,7 +215,11 @@ public abstract class AbstractMultipleParser extends 
AbstractParser {
                 
                 // Notify the implementation how it went
                 boolean tryNext = parserCompleted(p, metadata, handler, 
failure);
-                if (!tryNext) break;
+                // Abort if requested, with the exception if there was one
+                if (!tryNext) {
+                   if (failure != null) throw failure;
+                   break;
+                }
                 
                 // TODO Handle metadata clashes based on the Policy
             }

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

Reply via email to