This looks like a bug to me (opened CTAKES-241 to track this):
Within
org.apache.ctakes.assertion.medfacts.i2b2.api.CharacterOffsetToLineTokenConverterCtakesImpl.convertCharacterOffsetToLineToken(CharacterOffsetToLineTokenConverterCtakesImpl.java:171)
There appears is a null check, but it doesn't do much other than the log.
Subsequently, once it hits: int lineNumber = sentence.getSentenceNumber() + 1,
it will throw an NPE.
Is this a simple oversight - should the else{} cover the rest of the method?
I'm not too privy to this bit of logi/code- so would appreciate any insight
here...
if (sentence == null)
{
logger.info("current or previous sentence IS NULL!");
} else
{
logger.debug("current or previous sentence -- id: " +
sentence.getAddress() +
"; begin: " + sentence.getBegin() +
"; end: " + sentence.getEnd());
}
/** NullPointerException will be thrown here as the Null check lets it go
through**/
int lineNumber = sentence.getSentenceNumber() + 1;
> -----Original Message-----
> From: Pei Chen [mailto:[email protected]]
> Sent: Saturday, September 07, 2013 12:00 PM
> To: [email protected]
> Subject: NPE in ctakes-assertion with section headers?
>
> Hi Matt and co.,
> I vaguely remember this exception was fixed at sometime or another- do
> you recall the details?
> If not, i'll try and debug it...
>
> Caused by: java.lang.NullPointerException
>
> at
> org.apache.ctakes.assertion.medfacts.i2b2.api.CharacterOffsetToLineToken
> ConverterCtakesImpl.convertCharacterOffsetToLineToken(
> CharacterOffsetToLineTokenConverterCtakesImpl.java:171)
>
> at
> org.apache.ctakes.assertion.medfacts.i2b2.api.CharacterOffsetToLineToken
> ConverterCtakesImpl.convert(
> CharacterOffsetToLineTokenConverterCtakesImpl.java:103)
>
> at org.mitre.medfacts.zoner.ZonerCli.findHeadings(ZonerCli.java:543)
>
> at org.mitre.medfacts.i2b2.cli.MedFactsRunner.findZones(
> MedFactsRunner.java:212)
>
> at org.mitre.medfacts.i2b2.api.SingleDocumentProcessor.processZones(
> SingleDocumentProcessor.java:449)
>
> at
> org.mitre.medfacts.i2b2.api.SingleDocumentProcessor.generateAnnotations
> (
> SingleDocumentProcessor.java:173)
>
> at
> org.mitre.medfacts.i2b2.api.SingleDocumentProcessor.processSingleDocum
> ent(
> SingleDocumentProcessor.java:97)
>
> at org.apache.ctakes.assertion.medfacts.AssertionAnalysisEngine.process(
> AssertionAnalysisEngine.java:210)
>
> at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(
> JCasAnnotator_ImplBase.java:48)
>
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnal
> ysisComponentProcess(
> PrimitiveAnalysisEngine_impl.java:375)
>
> ... 17 more