Package org.dmd.util.exceptions

Examples of org.dmd.util.exceptions.ResultException


       
        for(String cname: categories){
          DmcUncheckedObject category = ruleCategoryDefs.get(cname);
         
          if (category == null){
            ResultException ex = new ResultException("Unknown rule category: " + cname);
            throw(ex);
          }
         
          String categoryID = category.getSV("ruleCategoryID");
          categoryInit.append("            categories.add(" + categoryID + ");\n");
View Full Code Here


    dumpAutoTester(sm, sd, gendir, context);
  }

  void dumpAutoTester(SchemaManager sm, SchemaDefinition sd, String gendir, OperationalContextEnum context) throws ResultException {
    String genpackage = sd.getSchemaPackage() + ".generated.rulesdmo";
    ResultException  ex = null;
   
    for(RuleDefinition rd : sd.getRuleDefinitionList()){
      if (context == OperationalContextEnum.DMO){
        // Skip full java rules if we're generating for the DMO context
        if (!rd.isDMOCompliant())
          continue;
      }
      else{
        if (rd.isDMOCompliant())
          continue;
      }
     
      try {
        @SuppressWarnings("unused")
        Class<?>  ruleClass = Class.forName(rd.getRuleDefinitionImport());
      } catch (ClassNotFoundException e) {
        if (ex == null)
          ex = new ResultException();
        ex.addError("You must create a rule implementation class: " + rd.getRuleDefinitionImport());
        ex.result.lastResult().moreMessages("It must extend " + genpackage + "." + rd.getName() + "BaseImpl");
      }
    }
   
    if (ex != null)
View Full Code Here

          dumpAUX(cd, auxwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
View Full Code Here

      while(cdefs.hasNext()){
        ClassDefinition cd = cdefs.next();
        cd.adjustJavaClass();
       
        if (cd.getDMWPackage() == null){
          ResultException ex = new ResultException();
          ex.addError("The " + cd.getDefinedIn().getName() + " schema must define the dmwPackage attribute to facilitate wrapper creation.");
          ex.result.lastResult().fileName(cd.getDefinedIn().getFile());
          throw(ex);
        }
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
          dumpAUX(cd, auxwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
View Full Code Here

                                // Trim the attribute name and leading spaces
                                attrVal.delete(0,attrName.length());
                                if (attrVal.length() == 0){
                                // We have a missing token value
                                ResultException ex = new ResultException();
                                ex.addError("No value for attribute: " + attrName);
                                ex.setLocationInfo(fileName, in.getLineNumber());
                                throw(ex);
                                }
                                while(attrVal.charAt(0) == ' '){
                                    attrVal.delete(0,1);
                                }
                            }
                        }
                    }
                    else{
                        if (uco != null){
                            // We have a blank line which means we've reached the end of an object - pass off
                            // the current object for processing
                            inObject = false;

                            // Tack on the last attribute
                            if (attrName != null){
                                val = attrVal.toString().trim();
                               
                              if (preserveNL.get(attrName) != null)
                                val = val.replaceAll("\n", "\\\\n");
                             
                                uco.addValue(attrName,new String(val));
                            }

                            try{
                              handler.handleObject(uco,fn, in.getLineNumber());
                            }
                            catch(ResultException ex){
//                              DebugInfo.debug(ex.toString());
                             
                              // If this is the first exception, just hang on to it - we may
                              // wind up adding to it later. Otherwise, just append the results
                              // to our existing exception.
                              if (exG == null)
                                exG = ex;
                              else
                                exG.result.addResults(ex.result);
                             
                              if (exG.result.worst() == Result.FATAL){
                                uco = null;
                                break;
                              }
                             
                                if (allowedErrorsV == -1){
                                    // Couldn't care less about errors! Just go merrily on our way.
                                }
                                else if ((allowedErrorsV == 0) && (exG.result.errors() > 0)){
                                    // Couldn't allow errors - let's bail
                                    uco = null;
                                    break;
                                }
                                else if (exG.result.errors() >= allowedErrorsV){
                                    // We've reached the limits of our patience
                                    uco = null;
                                    break;
                                }

                            }

                            // Reset our object and go on for the next one
                            uco = null;
                        }
                    }
                }

                lastLine = in.getLineNumber();
            }
            in.close();
        }
        catch (IOException e) {
          if (exG == null)
            exG = new ResultException();
         
            exG.result.addResult(Result.FATAL,e.toString());
            exG.result.lastResult().moreMessages("Occurred while reading file: " + fileName);
            uco = null;
        }
View Full Code Here

          parseObject(input, index, basic);
          wantEndCurly = true;
        }
        else{
          // ERROR Expecting {
          ResultException ex = new ResultException();
          ex.addError("Expecting opening bracket for object.");
          throw(ex);
        }
      }
      else if (wantEndCurly){
        eatWhiteSpace(input, index, "end bracket for object");
       
        if (input.charAt(index.intValue()) == '}'){
          // This should be the last character, if not, we have extraneous stuff - and, because
          // we trimmed the string at the beginning of the process, we know that there's not
          // just whitespace there.
          if ( (input.length()-1) != index.intValue()){
            // ERROR extraneous stuff
            ResultException ex = new ResultException();
            ex.addError("Extraneous characters after object.");
            throw(ex);
          }
         
          // Set this so that we know we were terminated properly
          wantEndCurly = false;
        }
        else{
          // ERROR Expecting }
          ResultException ex = new ResultException();
          ex.addError("Expecting closing bracket for object.");
          throw(ex);
        }
      }
    }
   
   
   
//    // If there were no objects, that's an error too
//    if (objects.size() == 0){
//      // ERROR no objects
//    }
   
    if (wantEndCurly){
      // ERROR: We're missing the end curly brace
      ResultException ex = new ResultException();
      ex.addError("Closing bracket missing.");
      throw(ex);
    }
   
    return(basic);
   
View Full Code Here

          index.set(index.intValue()-1);
          break;
        }
        else{
          // ERROR Expecting }
          ResultException ex = new ResultException();
          ex.addError("Expecting closing bracket for object.");
          throw(ex);
        }
      }
     
    }
View Full Code Here

        else if (input.charAt(index.intValue()) == ','){
          // Go around for another attribute
        }
        else{
          // Don't know what the heck this is
          ResultException ex = new ResultException();
          ex.addError("Malformed array - value followed by unrecognized character: " + input.charAt(index.intValue()));
          throw(ex);
        }
      }
    }
  }
View Full Code Here

        break;
      }
    }
   
    if (index.intValue() == input.length()){
      ResultException ex = new ResultException();
      ex.addError("Ran out of characters while expecting to find: " + message);
      throw(ex);
    }
  }
View Full Code Here

    // Grab the string between the quotes
    rc = input.substring(quote1+1,quote2);
   
    // If it's empty, pitch a fit
    if (rc.length() == 0){
      ResultException ex = new ResultException();
      ex.addError("Empty string while trying to parse " + message + " at index: " + index.intValue() + " in input string: " + input);
      throw(ex);
    }
   
    index.set(colon + 1);
   
View Full Code Here

TOP

Related Classes of org.dmd.util.exceptions.ResultException

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.