Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-1839

String-subtype features can't be set to null?

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3
    • 2.3.1SDK
    • Core Java Framework
    • None

    Description

      If you try to set a string-subtype feature to null, you get a NullPointerException:
      java.lang.NullPointerException
      at java.lang.String.compareTo(String.java:1167)
      at java.lang.String.compareTo(String.java:92)
      at java.util.Arrays.binarySearch0(Arrays.java:2001)
      at java.util.Arrays.binarySearch(Arrays.java:1943)
      at org.apache.uima.cas.impl.CASImpl.ll_setStringValue(CASImpl.java:3203)
      at org.apache.uima.cas.impl.FeatureStructureImpl.setStringValue(FeatureStructureImpl.java:130)

      The documentation doesn't specifically address whether this is allowed, but my intuition was that it should be. For one thing, a string-subtype feature can have the value null when it is uninitialized, so why shouldn't I be able to explicitly set it to null?

      A simple way to replicate is to add the line
      fs.setStringValue(stringSetFeat, null);
      to the test case method StringSubtypeTest.testCas()

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            schor Marshall Schor
            alally Adam P. Lally
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment