Package org.apache.uima.cas

Examples of org.apache.uima.cas.CASRuntimeException


    return isNew( ((FeatureStructureImpl) fs).getAddress());
  }

  public boolean isModified(FeatureStructure fs) {
  if (!isValid || ((FeatureStructureImpl) fs).getCASImpl() != this.cas) {
    CASRuntimeException e = new CASRuntimeException(
              CASRuntimeException.CAS_MISMATCH,
              new String[] { "FS and Marker are not from the same CAS." });
          throw e;
  }
  int addr = ((FeatureStructureImpl) fs).getAddress();
View Full Code Here


      Assert.assertTrue(ind3.compare(fs5, fs6) < 0);
      Assert.assertTrue(ind3.compare(fs6, fs7) > 0);

      // only way to check if allowed values is correct is to try to set an
      // invalid value?
      CASRuntimeException ex = null;
      try {
        fs4.setStringValue(f2, "Three");
      } catch (CASRuntimeException e) {
        ex = e;
      }
View Full Code Here

    super(jcas);
  }

  public int getNthElement(int i) {
    if (this instanceof EmptyIntegerList) {
      CASRuntimeException casEx = new CASRuntimeException(
          CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST, new String[] { "EmptyIntegerList" });
      throw casEx;
    }
    if (i < 0) {
      CASRuntimeException casEx = new CASRuntimeException(
          CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX, new String[] { Integer.toString(i) });
      throw casEx;
    }
    int originali = i;
    IntegerList cg = this;
    for (;; i--) {
      if (cg instanceof EmptyIntegerList) {
        CASRuntimeException casEx = new CASRuntimeException(
            CASRuntimeException.JCAS_GET_NTH_PAST_END, new String[] { Integer.toString(originali) });
        throw casEx;
      }
      NonEmptyIntegerList c = (NonEmptyIntegerList) cg;
      if (i == 0)
View Full Code Here

    super(jcas);
  }

  public float getNthElement(int i) {
    if (this instanceof EmptyFloatList) {
      CASRuntimeException casEx = new CASRuntimeException(
          CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST, new String[] { "EmptyFloatList" });
      throw casEx;
    }
    if (i < 0) {
      CASRuntimeException casEx = new CASRuntimeException(
          CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX, new String[] {Integer.toString(i)});
      throw casEx;
    }
    int originali = i;

    FloatList cg = this;
    for (;; i--) {
      if (cg instanceof EmptyFloatList) {
        CASRuntimeException casEx = new CASRuntimeException(
            CASRuntimeException.JCAS_GET_NTH_PAST_END, new String[] {Integer.toString(originali)});
        throw casEx;
      }
      NonEmptyFloatList c = (NonEmptyFloatList) cg;
      if (i == 0)
View Full Code Here

    if (!casImpl.getTypeSystemImpl().subsumes(casTypeCode, casImpl.getHeapValue(inst)))
      invalidTypeArg(inst);
  }

  protected void invalidTypeArg(int inst) {
    CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE,
        new String[] { casType.getName(),
            this.casImpl.getTypeSystemImpl().ll_getTypeForCode(casImpl.getHeapValue(inst)).getName() });
    throw e;
  }
View Full Code Here

          String typeName = cls.getName();
          // is type in type system
          if (this.casImpl.getTypeSystem().getType(typeName) == null) {
            // no - report error that JCAS type was not defined in XML
            // descriptor
            CASRuntimeException casEx = new CASRuntimeException(
                CASRuntimeException.JCAS_TYPE_NOT_IN_CAS, new String[] { typeName });
            throw casEx;
          } else {
            // yes - there was some problem loading the _Type object
            CASRuntimeException casEx = new CASRuntimeException(
                CASRuntimeException.JCAS_MISSING_COVERCLASS, new String[] { typeName + "_Type" });
            throw casEx;
          }

        } else {
          throw new CASRuntimeException(CASRuntimeException.JCAS_UNKNOWN_TYPE_NOT_IN_CAS);
        }
      }
    }
    return typeArray[i];
  }
View Full Code Here

    return getType(instance.getTypeIndexID());
  }

  /** throws (an unchecked) CASRuntimeException */
  private void logAndThrow(Exception e) {
    CASRuntimeException casEx = new CASRuntimeException(CASRuntimeException.JCAS_CAS_MISMATCH);
    casEx.initCause(e);
    throw casEx;
  }
View Full Code Here

   *
   * @param feat
   * @param type
   */
  public void throwFeatMissing(String feat, String type) {
    CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_FEAT,
        new String[] { feat, type });
    throw e;
  }
View Full Code Here

        isSubtypeOfAnnotationBase = tempisSubtypeOfAnnotationBase;
      }
    }

    private void logAndThrow(Exception e) {
      CASRuntimeException casEx = new CASRuntimeException(CASRuntimeException.JCAS_CAS_MISMATCH);
      casEx.initCause(e);
      throw casEx;
    }
View Full Code Here

      }
      return fs;
    }

    private void logAndThrow(Exception e, JCasImpl jcasView) {
      CASRuntimeException casEx = new CASRuntimeException(
          CASRuntimeException.JCAS_CAS_MISMATCH,
          new String[] { (null == jcasView) ? "-- ignore outer msg, error is can''t get value of jcas from cas"
              : (jcasView.getType(type).casType.getName() + "; exception= "
                  + e.getClass().getName() + "; msg= " + e.getLocalizedMessage()) });
      casEx.initCause(e);
      throw casEx;
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.CASRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.