Skip to content

NullPointerException with AnnotationSerializer (ProtobufAnnotationSerializer) and CoreMapExpressionExtractor #1291

Closed
@kschroeder

Description

@kschroeder

I have a test that I run on CoreMapExpressionExtractor which relies on caching the result of an annotation run so I don't have to run the parser each time. I use the ProtobufAnnotationSerializer. However, when I unserialize the cached data all of the new line tokens have been set to NULL. The result is that when I run the extractor a NullPointerException gets thrown at

if (cm.containsKey(CoreAnnotations.TokenBeginAnnotation.class) && cm.containsKey(CoreAnnotations.TokenEndAnnotation.class)) {

Obviously, calling containsKey on a null causes the exception to be thrown.

The workaround that I used was simply to iterate over the tokens prior to using them and inserting a default new line CoreLabel element, and it seems to work. Is there a better way to handle that?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions