freme-project / e-Internationalization

Apache License 2.0
0 stars 0 forks source link

String Index out of bounds exception #35

Closed m1ci closed 8 years ago

m1ci commented 8 years ago

This issue was reported by @pheyvaer and moved from https://github.com/freme-project/freme-ner/issues/78

The same call as in issue #76, however this time we ask to output the result using text/html. However, we get the following error

<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Wed Feb 17 16:02:27 CET 2016</div><div>There was an unexpected error (type=Internal Server Error, status=500).</div><div>String index out of range: -14</div></body></html>

What exactly is the problem here?

P.S. According to the w3 validator our document is valid (beside some deprecated elements, however, that should not make a difference I think).

borriellom commented 8 years ago

Thanks for reporting this. Never seen this behavior so far. I'll have a look as soon as possible.

fsasaki commented 8 years ago

I used the file attached to https://github.com/freme-project/freme-ner/issues/76 https://github.com/freme-project/freme-ner/files/133952/SB50.zip and processed it with 1) e-entity and output turtle: works as exected 2) e-entity and output html: gives he error reported here with this error message

{"timestamp":1455733543376,"status":500,"error":"Internal Server Error","exception":"java.lang.StringIndexOutOfBoundsException","message":"String index out of range: -14","path":"/e-entity/freme-ner/documents"}

3) e-Terminology and output turtle or html: both work as expected - html as well. output-e-terminology-as-html-issue-35.txt

Not sure if this helps, but 3) shows that this works with other e-services, so maybe the issue is on how things come back from freme-ner to e-internationalisation.

jnehring commented 8 years ago

I tested it and I can reproduce the bug. I also checked the log files on FREME dev. They say

ERROR   2016-02-18 09:21:49,902 [http-nio-8084-exec-5] org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]  - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
java.lang.StringIndexOutOfBoundsException: String index out of range: -14
        at java.lang.String.substring(String.java:1967)
        at eu.freme.i18n.okapi.nif.converter.HTMLBackConverter.convertBack(HTMLBackConverter.java:127)
        at eu.freme.i18n.okapi.nif.converter.HTMLBackConverter.convertBack(HTMLBackConverter.java:105)
        at eu.freme.i18n.okapi.nif.converter.HTMLBackConverter.convertBack(HTMLBackConverter.java:75)
        at eu.freme.i18n.api.EInternationalizationAPI.convertBack(EInternationalizationAPI.java:81)
        at eu.freme.broker.tools.internationalization.ConversionHttpServletResponseWrapper.writeBackToClient(ConversionHttpServletResponseWrapper.java:61)
        at eu.freme.broker.tools.internationalization.EInternationalizationFilter.doFilter(EInternationalizationFilter.java:299)

So we can see that the bug originates from within e-Internationalization. You can also see that it happens when the turtle is converted back to HTML.

fsasaki commented 8 years ago

Thanks, Jan. It's still unclear to me why this works with other HTML documents and e-Entity roundtripping, and why it works with e-Terminology and the same HTML document.

jnehring commented 8 years ago

The same problem occurs here: http://rv2622.1blu.de:7001/e-entity/freme-ner/documents?language=en&dataset=dbpedia&input=%3Cp%3EWelcome%20to%20Berlin!%3C%2Fp%3E&informat=text/html&outformat=text/html

Katsivelisp commented 8 years ago

Hi,

I don't know if this is really related, but I get the same error when running this call.

The context being that I'm using the CKEditor Plugin to perform linking against a custom dataset.

jnehring commented 8 years ago

This problem is fixed.