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

Calling jcas.getType for a type that is not defined in the descriptor leaves the JCAS in an inconsitent state

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.1
    • 2.2.2
    • Core Java Framework
    • None

    Description

      The following code illustrates the problem:

      public void testUndefinedType() throws Exception {
      //create jcas with no type system
      JCas jcas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null).getJCas();
      jcas.setDocumentText("This is a test.");
      try

      { //this should throw an exception jcas.getType(Sentence.type); fail(); }

      catch(CASRuntimeException e) {
      }
      //check that this does not leave JCAS in an inconsistent state
      Iterator iter = jcas.getAnnotationIndex().iterator();
      assertTrue(iter.hasNext());
      Annotation annot = (Annotation)iter.next();
      }

      Running this gives a ClassCastException trying to cast the result of iter.next() to an Annotation

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: