uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thilo Goetz <twgo...@gmx.de>
Subject Re: AnnotationFS.getCoveredText returns null?
Date Thu, 23 Feb 2012 15:57:46 GMT
On 23/02/12 16:07, Jörn Kottmann wrote:
> On 02/23/2012 03:38 PM, Thilo Goetz wrote:
>> Indeed.  I sometimes use negative values for offsets when I want
>> to create an annotation but don't know what the final offsets will
>> be.  Of course it is my responsibility to later set proper values.
> 
> What do you think about returning just null when the annotation
> span is invalid?
> 
> Jörn

I assume you are talking about getCoveredText() now?  The current
code, as Tommaso observes, will throw an exception when the offsets
are invalid.  To my taste, that is the correct behavior, although
it could be argued that we should throw our own exception there.
I also agree that the cases where it returns null should be
documented.

I was arguing against checking for validity of offsets when
annotations are created.  That might break existing code, as you
observed.

So if you ask me, the current behavior of getCoveredText() is
fine, it just needs to be documented.

--Thilo

Mime
View raw message