[
https://issues.apache.org/jira/browse/TIKA-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15818551#comment-15818551
]
Jasper Hafkenscheid edited comment on TIKA-2237 at 1/11/17 2:57 PM:
--------------------------------------------------------------------
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}
was (Author: hafkensite):
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)