Examples of CASException


Examples of org.apache.uima.cas.CASException

   * @see org.apache.uima.jcas.JCas#getRequiredFeature(org.apache.uima.cas.Type, java.lang.String)
   */
  public Feature getRequiredFeature(Type t, String s) throws CASException {
    Feature f = t.getFeatureByBaseName(s);
    if (null == f) {
      CASException casEx = new CASException(CASException.JCAS_FEATURENOTFOUND_ERROR, new String[] {
          t.getName(), s });
      throw casEx;
    }
    return f;
  }
View Full Code Here

Examples of org.apache.uima.cas.CASException

  public Feature getRequiredFeatureDE(Type t, String s, String rangeName, boolean featOkTst) {
    Feature f = t.getFeatureByBaseName(s);
    Type rangeType = this.getTypeSystem().getType(rangeName);
    if (null == f && !featOkTst) {
      CASException casEx = new CASException(CASException.JCAS_FEATURENOTFOUND_ERROR, new String[] {
          t.getName(), s });
      sharedView.errorSet.add(casEx);
    }
    if (null != f)
      try {
        casImpl.checkTypingConditions(t, rangeType, f);
      } catch (LowLevelException e) {
        CASException casEx = new CASException(CASException.JCAS_FEATURE_WRONG_TYPE, new String[] {
            t.getName(), s, rangeName, f.getRange().toString() });
        sharedView.errorSet.add(casEx);
      }
    return f;
  }
View Full Code Here

Examples of org.apache.uima.cas.CASException

    final int max = types.length - 1;
    boolean rc;
    for (int i = 0; i < max; i++) {
      rc = add(types[i], types[i + 1]);
      if (!rc) {
  CASException e = new CASException(CASException.CYCLE_IN_TYPE_ORDER, new String[] {
      types[i], types[i + 1] });
  throw e;
      }
    }
  }
View Full Code Here

Examples of org.apache.uima.cas.CASException

      int[] a = new int[typeList.length];
      LowLevelTypeSystem llts = (LowLevelTypeSystem) ts;
      for (int i = 0; i < a.length; i++) {
        int t = llts.ll_getCodeForTypeName(typeList[i]);
        if (t == LowLevelTypeSystem.UNKNOWN_TYPE_CODE) {
          CASException e = new CASException(CASException.TYPEORDER_UNKNOWN_TYPE,
              new String[] { typeList[i] });
          throw e;
        }
        a[i] = t;
      }
View Full Code Here

Examples of org.apache.uima.cas.CASException

    final int max = types.length - 1;
    boolean rc;
    for (int i = 0; i < max; i++) {
      rc = add(types[i], types[i + 1]);
      if (!rc) {
  CASException e = new CASException(CASException.CYCLE_IN_TYPE_ORDER, new String[] {
      types[i], types[i + 1] });
  throw e;
      }
    }
  }
View Full Code Here

Examples of org.apache.uima.cas.CASException

      int[] a = new int[typeList.length];
      LowLevelTypeSystem llts = (LowLevelTypeSystem) ts;
      for (int i = 0; i < a.length; i++) {
  int t = llts.ll_getCodeForTypeName(typeList[i]);
  if (t == LowLevelTypeSystem.UNKNOWN_TYPE_CODE) {
    CASException e = new CASException(CASException.TYPEORDER_UNKNOWN_TYPE,
        new String[] { typeList[i] });
    throw e;
  }
  a[i] = t;
      }
View Full Code Here

Examples of org.apache.uima.cas.CASException

      this.featurePathString = featurePath;
      this.builtInFunction = NO_BUILT_IN_FUNCTION;

      // throw exception if featurePath is null
      if (featurePath == null) {
         throw new CASException(MESSAGE_DIGEST, "INVALID_FEATURE_PATH_SYNTAX",
               new Object[] { featurePath, null });
      }

      // check featurePath for invalid character sequences
      if (this.featurePathString.indexOf("//") > -1) {
         // invalid featurePath syntax
         throw new CASException(MESSAGE_DIGEST, "INVALID_FEATURE_PATH_SYNTAX",
               new Object[] { this.featurePathString, "//" });
      }

      // parse feature path into path elements
      StringTokenizer tokenizer = new StringTokenizer(this.featurePathString,
            FEATURE_PATH_SEPARATOR);
      while (tokenizer.hasMoreTokens()) {
         String token = tokenizer.nextToken();
         // check if there are more tokens available, if we are at the last
         // token we have to check for built-in functions
         if (tokenizer.hasMoreTokens()) {
            this.featurePathElementNames.add(token);
         } else {
            // we have the last token, check for built-in functions
            int index = -1;
            if ((index = token.indexOf(BUILT_IN_FUNCTION_SEPARATOR)) != -1) {
               if (index > 0) {
                  // we have a built-in function that is separated with a ":"
                  this.featurePathElementNames.add(token.substring(0, index));
               }
               // get built-in function
               String builtInFunctionName = token.substring(index + 1)
                     .toLowerCase();
               if (builtInFunctionName.equals(FUNCTION_NAME_COVERED_TEXT)) {
                  this.builtInFunction = FUNCTION_COVERED_TEXT;
               } else if (builtInFunctionName.equals(FUNCTION_NAME_ID)) {
                  this.builtInFunction = FUNCTION_ID;
               } else if (builtInFunctionName.equals(FUNCTION_NAME_TYPE_NAME)) {
                  this.builtInFunction = FUNCTION_TYPE_NAME;
               } else {
                  throw new CASException(MESSAGE_DIGEST,
                        "INVALID_FEATURE_PATH_SYNTAX", new Object[] {
                              this.featurePathString, builtInFunctionName });
               }
            } else {
               this.featurePathElementNames.add(token);
View Full Code Here

Examples of org.apache.uima.cas.CASException

         // validate featurePath for given type
         PathValid pathValid = TypeSystemUtils.isPathValid(featurePathType,
               this.featurePathElementNames);
         if (PathValid.NEVER == pathValid) {
            // invalid featurePath - throw an configuration exception
            throw new CASException(MESSAGE_DIGEST,
                  "ERROR_VALIDATE_FEATURE_PATH", new Object[] {
                        this.featurePathString, featurePathType.getName() });
         } else if (PathValid.ALWAYS == pathValid) {
            // the featurePath is always valid, so we can resolve and cache the
            // path elements
View Full Code Here

Examples of org.apache.uima.cas.CASException

   * @see org.apache.uima.cas.admin.CASMgr#initCASIndexes()
   */
  public void initCASIndexes() throws CASException {
    final TypeSystemImpl ts = this.svd.casMetadata.ts;
    if (!ts.isCommitted()) {
      throw new CASException(CASException.MUST_COMMIT_TYPE_SYSTEM, null);
    }

    FSIndexComparator comp = this.indexRepository.createComparator();
    comp.setType(ts.sofaType);
    comp.addKey(ts.sofaNum, FSIndexComparator.STANDARD_COMPARE);
View Full Code Here

Examples of org.apache.uima.cas.CASException

   * @see org.apache.uima.cas.admin.CASMgr#initCASIndexes()
   */
  public void initCASIndexes() throws CASException {
    final TypeSystemImpl ts = this.svd.casMetadata.ts;
    if (!ts.isCommitted()) {
      throw new CASException(CASException.MUST_COMMIT_TYPE_SYSTEM, null);
    }

    FSIndexComparator comp = this.indexRepository.createComparator();
    comp.setType(ts.sofaType);
    comp.addKey(ts.sofaNum, FSIndexComparator.STANDARD_COMPARE);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.