On 02/23/2012 03:14 PM, Tommaso Teofili wrote:
BTW it looks like this piece of code is prone to error due to incorrect
setting of begin and end.
If I have a text 'abc' and set begin to 0 and end to 5 then I'll have an
error only when I call the getCoveredText() method so I think we should
either check if the input is correct in setters or inside getCoveredText()
to avoid IndexOutOfBoundExceptions generated from the substring method.
Am I right or did I miss something that already prevents that situation?

Well, the one who writes to the CAS needs to get this right. To make it
fail fast you have to throw an exception when an invalid range is set.

We could throw an IllegalArgumentException when an AnnotationFS is created, but
might break existing working code. Or add options to the serializer and
deserializer to throw an exceptions if ranges are incorrect (and other things).

The Cas Editor cannot really handle this currently. I guess we should get it fixed
and then clearly display to the user that something is wrong..

Jörn



Reply via email to