You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Tim Allison (JIRA)" <ji...@apache.org> on 2015/03/02 16:25:04 UTC

[jira] [Commented] (TIKA-1559) SecureContentHandler.SecureSAXException is not serializable

    [ https://issues.apache.org/jira/browse/TIKA-1559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14343261#comment-14343261 ] 

Tim Allison commented on TIKA-1559:
-----------------------------------

[~sashkap], thank you for raising this issue and offering a solution.

Fellow Tika'ers, what is the benefit of keeping this as an inner class?  It looks like {{throwIfCauseOf}} relies on a pointer to {{this}} to determine whether or not to wrap the SecureSAXException in a TikaException if the particular SecureSAXException is "caused by this instance".  What is the benefit of this behavior vs. just throwing a SecureSAXException that would be wrapped in a TikaException by {{CompositeParser}}?

> SecureContentHandler.SecureSAXException is not serializable
> -----------------------------------------------------------
>
>                 Key: TIKA-1559
>                 URL: https://issues.apache.org/jira/browse/TIKA-1559
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 1.7
>            Reporter: Alexander Pogrenbyak
>
> I am using [elasticsearch-mapper-attachments plugin|https://github.com/elasticsearch/elasticsearch-mapper-attachments]
> It is, in turn, uses Tika library to convert attachments to plain text.
> If things do not go according to plan, it wraps the TikaException in its own, and tries to send it down the wire to client (me).
> Unfortunately, if exception is not serializable, it gets converted to somewhat cryptic *NotSerializableTransportException*, which makes it harder to parse on the client side.
> The reason {{SecureContentHandler.SecureSAXException}} is not serializable, because it is an inner class of {{SecureContentHandler}} and it is, in turn, not serializable, and is present as the parent object on the Exception object.
> One fix would be to convert {{SecureSAXException}} to inner *static* class, and add {{SecureContentHandler}} as a transient field, and explicitly initialize it in constructor.  With this minimal modifications, this {{SecureSAXException}} will become fully serializable.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)