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

ClassCastException thrown when using subiterator and moveTo()

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: Core Java Framework
    • Labels:
      None
    • Environment:

      N/A

      Description

      I am having difficulty with using the FSIterator returned by the AnnotationIndex.subiterator(AnnotationFS) method.
      The following is a code fragment:

      AnnotationIndex annotationIndex = jCas.getAnnotationIndex(tokenType);
      FSIterator tokenIterator = annotationIndex.subiterator(sentenceAnnotation);
      tokenIterator.moveTo(tokenAnnotation);

      Here is the relevant portion of the stack trace:

      java.lang.ClassCastException: edu.colorado.cslr.dessert.types.Token
      at java.util.Collections.indexedBinarySearch(Unknown Source)
      at java.util.Collections.binarySearch(Unknown Source)
      at org.apache.uima.cas.impl.Subiterator.moveTo(Subiterator.java:224)

      If I change the second line to the following, then I do not have any problems with an exception being thrown.

      FSIterator tokenIterator = annotationIndex.iterator();

        Attachments

        1. UIMA-464.zip
          21 kB
          Philip Ogren

          Activity

            People

            • Assignee:
              twgoetz Thilo Goetz
              Reporter:
              ogren Philip Ogren
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: