Package org.apache.uima.cas

Examples of org.apache.uima.cas.CASRuntimeException


        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

  public TypeSystem getTypeSystem() {
    final TypeSystemImpl ts = this.svd.casMetadata.ts;
    if (ts.isCommitted()) {
      return ts;
    }
    throw new CASRuntimeException(CASRuntimeException.TYPESYSTEM_NOT_LOCKED);
  }
View Full Code Here

  }

  public FeatureStructure createFS(Type type) {
    final int typeCode = ((TypeImpl) type).getCode();
    if (!isCreatableType(typeCode)) {
      CASRuntimeException e = new CASRuntimeException(CASRuntimeException.NON_CREATABLE_TYPE,
          new String[] { type.getName(), "CAS.createFS()" });
      throw e;
    }
    final int addr = ll_createFS(typeCode);
    final TypeSystemImpl ts = this.svd.casMetadata.ts;
    final boolean isAnnot = ts.subsumes(ts.annotBaseTypeCode, typeCode);
    if (isAnnot && (this == this.getBaseCAS())) {
      CASRuntimeException e = new CASRuntimeException(CASRuntimeException.DISALLOW_CREATE_ANNOTATION_IN_BASE_CAS,
          new String[] { type.getName() });
      throw e;
    }
    if (isAnnot) {
      getLowLevelCAS().ll_setIntValue(addr, ts.annotSofaFeatCode, this.getSofaRef());
View Full Code Here

  }

  public final void checkArrayPreconditions(int len) throws CASRuntimeException {
    // Check array size.
    if (len < 0) {
      throw new CASRuntimeException(CASRuntimeException.ILLEGAL_ARRAY_SIZE);
    }
  }
View Full Code Here

  }

  // Internal use only
  public void addSofa(FeatureStructure sofa, String sofaName, String mimeType) {
    if (this.svd.sofaNameSet.contains(sofaName)) {
      CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFANAME_ALREADY_EXISTS,
          new String[] { sofaName });
      throw e;
    }
    final TypeSystemImpl ts = this.svd.casMetadata.ts;
    final int llsofa = getLowLevelCAS().ll_getFSRef(sofa);
View Full Code Here

      if (sofaName.equals(getStringValue(((FeatureStructureImpl)sofa).getAddress(), this.svd.casMetadata.ts.sofaIdFeatCode))) {
        return sofa;
      }
      iterator.moveToNext();
    }
    CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFANAME_NOT_FOUND,
        new String[] { sofaName });
    throw e;
  }
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.