You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Dominic Jehle (Jira)" <de...@uima.apache.org> on 2020/02/26 14:20:00 UTC

[jira] [Created] (UIMA-6195) RutaLiteralMatcher throws NPE

Dominic Jehle created UIMA-6195:
-----------------------------------

             Summary: RutaLiteralMatcher throws NPE 
                 Key: UIMA-6195
                 URL: https://issues.apache.org/jira/browse/UIMA-6195
             Project: UIMA
          Issue Type: Bug
          Components: Ruta
    Affects Versions: 3.0.0ruta
            Reporter: Dominic Jehle
         Attachments: 1_Debug_View.JPG, 2_Debug_View_Types.JPG

*Problem*
During update to ruta 3.0.0. from 2.6.1, one of my rules started to throw an NPE at execution in RutaLiteralMatcher.

*Example*
It's a very simple rule with a literal upper case "I" followed by a previous match (in this case underscores):
{code:java}
"____+" -> SIMPLEFORMATTING;
"I" SIMPLEFORMATTING "I"? { -> MARKONCE(FORMATTING,1,2)};
{code}
When run on input like
{code:java}
"PI_____I How to test it?"{code}
it crashes with NPE. Input like
{code:java}
"P I_____I How to test it?"{code}
is fine.

Here's the stack:
{code:java}
org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator processing failed.    org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator processing failed.     at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:614) at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48) at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.lambda$callProcessMethod$3(AnalysisEngineImplBase.java:626) at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.withContexts(AnalysisEngineImplBase.java:653) at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.callProcessMethod(AnalysisEngineImplBase.java:623) at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:381) at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:299) at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:272) at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:287) at com.myorg.uima.ruta.recognizer.RecognizerFormattingFactoryTest.run(RecognizerFormattingFactoryTest.java:208) at com.myorg.uima.ruta.recognizer.RecognizerFormattingFactoryTest.testFormattingRutaUpdateBug2020(RecognizerFormattingFactoryTest.java:191) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)Caused by: java.lang.NullPointerException at org.apache.uima.ruta.rule.RutaLiteralMatcher.getAnnotation(RutaLiteralMatcher.java:72) at org.apache.uima.ruta.rule.RutaLiteralMatcher.getMatchingAnnotations(RutaLiteralMatcher.java:62) at org.apache.uima.ruta.rule.RutaLiteralMatcher.getMatchingAnnotations(RutaLiteralMatcher.java:37) at org.apache.uima.ruta.rule.RutaRuleElement.getAnchors(RutaRuleElement.java:52) at org.apache.uima.ruta.rule.RutaRuleElement.startMatch(RutaRuleElement.java:60) at org.apache.uima.ruta.rule.ComposedRuleElement.startMatch(ComposedRuleElement.java:77) at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:65) at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:56) at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:38) at org.apache.uima.ruta.block.RutaScriptBlock.apply(RutaScriptBlock.java:72) at org.apache.uima.ruta.RutaModule.apply(RutaModule.java:56) at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:612) ... 33 more
{code}

I looked just a little at debugging RutaLiteralMatcher.java and it crashes in L71 at retrieving the beginAnchor.
{code:java}
RutaBasic beginAnchor = stream.getBeginAnchor(begin);{code}
The begin that it is looking for is 1, but it's covered by "CAP:3"/"RutaBasic:21" from 0 to 2 (cf. screen captures).

This did not occur with ruta 2.6.1.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)