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

Claus Ibsen commented on CAMEL-26057:
-------------------------------------

Fixed in PR https://github.com/apache/camel/pull/28373

_Claude Code on behalf of davsclaus_

> camel-tika - a body that does not convert to a stream fails with a 
> NullPointerException, and the output encoding is lost
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26057
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26057
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-tika
>    Affects Versions: 4.18.0, 4.22.0, 4.23.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Found while adding the catalog body types of tika (CAMEL-24961), checked with 
> {{camel run}}.
> h4. 1. A body that does not convert to a stream fails with a 
> NullPointerException
> detect and parse read the body with {{getBody(InputStream.class)}} 
> ({{TikaProducer}}, main 5aac7df76b83, lines 132 and 145), so a Map, a List, a 
> POJO or no body gives null, and Tika fails with {{NullPointerException: The 
> Stream must not be null}}. Checked on 4.24.0-SNAPSHOT with {{camel run}}.
> *Proposed change*: use {{getMandatoryBody(InputStream.class)}}, so the error 
> says what the body must be.
> h4. 2. The output encoding is lost when the output converts to text
> parse writes the output in tikaParseOutputEncoding (line 80) into a 
> {{ByteArrayOutputStream}} (line 143), which carries no charset, so converting 
> the body to text decodes it in the charset of the exchange. Checked on 
> 4.24.0-SNAPSHOT with {{camel run}}: tikaParseOutputFormat=text with 
> tikaParseOutputEncoding=UTF-16 converted to garbled text.
> *Proposed change*: set the charset of the exchange to the output encoding, or 
> give the text.
> h4. Also read in the code, not run
> * The javadoc of tikaParseOutputFormat, shown in the catalog, lists textMain 
> ({{TikaConfiguration}}, line 67), which is not a value of the option (xml, 
> html, text).
> * The tikaConfigFile route of TikaParseTest is never sent to, so the tests of 
> the config file test the default.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to