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 2023/06/07 13:46:01 UTC

[tika] branch TIKA-4062 created (now 1eb8959c7)

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

tallison pushed a change to branch TIKA-4062
in repository https://gitbox.apache.org/repos/asf/tika.git


      at 1eb8959c7 TIKA-4062 -- ContentHandlerDecorator should delegate handleException if the wrapped handler is itself a ContentHandlerDecorator -- needs a unit test

This branch includes the following new commits:

     new 1eb8959c7 TIKA-4062 -- ContentHandlerDecorator should delegate handleException if the wrapped handler is itself a ContentHandlerDecorator -- needs a unit test

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[tika] 01/01: TIKA-4062 -- ContentHandlerDecorator should delegate handleException if the wrapped handler is itself a ContentHandlerDecorator -- needs a unit test

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1eb8959c7bee7887bf22e2180a36e8ddc3660ebb
Author: tallison <ta...@apache.org>
AuthorDate: Wed Jun 7 09:45:46 2023 -0400

    TIKA-4062 -- ContentHandlerDecorator should delegate handleException if the wrapped handler is itself a ContentHandlerDecorator -- needs a unit test
---
 .../main/java/org/apache/tika/sax/ContentHandlerDecorator.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tika-core/src/main/java/org/apache/tika/sax/ContentHandlerDecorator.java b/tika-core/src/main/java/org/apache/tika/sax/ContentHandlerDecorator.java
index 258e67bf0..5d54a8305 100644
--- a/tika-core/src/main/java/org/apache/tika/sax/ContentHandlerDecorator.java
+++ b/tika-core/src/main/java/org/apache/tika/sax/ContentHandlerDecorator.java
@@ -172,12 +172,19 @@ public class ContentHandlerDecorator extends DefaultHandler {
      * provides a single place to implement custom exception handling. The
      * default behaviour is simply to re-throw the given exception, but
      * subclasses can also provide alternative ways of handling the situation.
+     * 
+     * If the wrapped handler is itself a ContentHandlerDecorator, the call
+     * is delegated to the wrapped handler's {@link ContentHandlerDecorator#handleException(SAXException)}
      *
      * @param exception the exception that was thrown
      * @throws SAXException the exception (if any) thrown to the client
      */
     protected void handleException(SAXException exception) throws SAXException {
-        throw exception;
+        if (handler instanceof ContentHandlerDecorator) {
+            ((ContentHandlerDecorator)handler).handleException(exception);
+        } else {
+            throw exception;
+        }
     }
 
 }