You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Jasper Hafkenscheid (JIRA)" <ji...@apache.org> on 2017/01/11 14:57:58 UTC
[jira] [Commented] (TIKA-2237) UnsupportedOperationException due to
SingletonList.set in ProbabilisticMimeDetectionSelector
[ https://issues.apache.org/jira/browse/TIKA-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15818551#comment-15818551 ]
Jasper Hafkenscheid commented on TIKA-2237:
-------------------------------------------
Unit test that causes the exception to occur.
{code:java}
@Test
public void tikaTest() throws IOException {
Metadata metadata = new Metadata();
metadata.add(Metadata.CONTENT_TYPE, MediaType.text("javascript").toString());
InputStream input = new ByteArrayInputStream(("function() {};\n" +
"try {\n" +
" window.location = \"index.html\";\n" +
"} catch (e) {\n" +
" console.log(e);\n" +
"}").getBytes(StandardCharsets.UTF_8));
MediaType detect = new ProbabilisticMimeDetectionSelector().detect(input, metadata);
assertEquals(MediaType.text("javascript"), detect);
}
{code}
> UnsupportedOperationException due to SingletonList.set in ProbabilisticMimeDetectionSelector
> --------------------------------------------------------------------------------------------
>
> Key: TIKA-2237
> URL: https://issues.apache.org/jira/browse/TIKA-2237
> Project: Tika
> Issue Type: Bug
> Components: detector
> Affects Versions: 1.14
> Reporter: Jasper Hafkenscheid
> Fix For: 1.15
>
>
> java.lang.UnsupportedOperationException
> at java.util.AbstractList.set(AbstractList.java:132)
> at org.apache.tika.mime.ProbabilisticMimeDetectionSelector.applyProbilities(ProbabilisticMimeDetectionSelector.java:241)
> at org.apache.tika.mime.ProbabilisticMimeDetectionSelector.detect(ProbabilisticMimeDetectionSelector.java:190)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)