Package org.dmd.util.exceptions

Examples of org.dmd.util.exceptions.ResultException


   
    if (existing == null){
      map.put(def.getCamelCaseName(),def);
    }
    else{
      ResultException ex = new ResultException();
      ex.addError("The definition with name: " + def.getCamelCaseName() + " clashes with an existing definition.");
      ex.result.lastResult().moreMessages("Existing definition from file: " + def.getDefinedInModule().getFile());
      ex.setLocationInfo(def.getFile(), def.getLineNumber());
      throw(ex);
    }
  }
View Full Code Here


        try{
            c = Class.forName(name);
        }
        catch(Exception e){
            ResultException ex = new ResultException();
            ex.result.addResult(Result.ERROR,"Couldn't retrieve Class for " + name);
            throw(ex);
        }
        parms[currParm++] = c;
    }
View Full Code Here

        try{
            // NOTE: we use getMethod() rather than getDeclaredMethod() so that
            // we can call member functions in base classes.
            method = cbobj.getClass().getMethod(cbfun,parms);
        } catch ( NoSuchMethodException e ) {
            ResultException ex = new ResultException();
            ex.result.addResult(Result.ERROR,"Unknown callback function: " + cbfun);
            ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
            throw(ex);
        } catch ( SecurityException e ) {
            ResultException ex = new ResultException();
            ex.result.addResult(Result.ERROR,"Security exception: " + e.getMessage());
            ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
        }
    }
View Full Code Here

        } catch ( InvocationTargetException e ) {
            StringWriter sw = new StringWriter();
            PrintWriter  pw = new PrintWriter(sw);
            e.printStackTrace(pw);

            ResultException ex = new ResultException();
            ex.result.addResult(Result.ERROR,"Invocation failed for method: " + methodName + " on " + targetObj.getClass().getName());
            ex.result.lastResult().moreMessages(sw.toString());
            throw(ex);
        } catch ( IllegalAccessException e ) {
            ResultException ex = new ResultException();
            ex.result.addResult(Result.ERROR,"Couldn't invoke method: " + methodName + " " + e.toString());
            throw(ex);
        } catch ( IllegalArgumentException e ) {
            ResultException ex = new ResultException();
            ex.result.addResult(Result.ERROR,"Couldn't invoke method: " + methodName + " " + e.toString());
            throw(ex);
        }
    }
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

          dumpAUX(cd, dmwdir);
        }
        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

    Class<?>   ruleClass   = null;
   
    try {
      ruleClass = Class.forName(this.getRuleDefinitionImport());
    } catch (ClassNotFoundException e) {
          ResultException ex = new ResultException();
          ex.result.addResult(Result.FATAL,"Couldn't load Java class: " + this.getRuleDefinitionImport());
          ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
          throw(ex);
    }

        try{
            rc = (RuleIF) ruleClass.newInstance();
        }
        catch(Exception e){
          ResultException ex = new ResultException();
          ex.result.addResult(Result.FATAL,"Couldn't instantiate Java class: " + this.getRuleDefinitionImport());
          ex.result.lastResult().moreMessages("This may be because the class doesn't have a constructor that takes no arguments.");
          ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
          throw(ex);
        }
View Full Code Here

      else if (def instanceof ComplexTypeDefinition)
        this.addComplexTypeDefList((ComplexTypeDefinition) def);
      else if (def instanceof RuleDefinition)
        this.addRuleDefinitionList((RuleDefinition)def);
        else{
          ResultException ex = new ResultException();
          ex.addError("The specified object is not a DMD object: \n" + def.toOIF());
          throw(ex);
        }
    }
View Full Code Here

   
    public void addParsedRule(DmcUncheckedObject uco) throws ResultException, DmcValueException {
      String ruleName = uco.getSV("ruleName");
     
      if (ruleName == null){
        ResultException ex = new ResultException();
        ex.addError("The specified rule instance doesn't have a ruleName: \n" + uco.toOIF());
        throw(ex);
      }
     
      if (parsedRules == null)
        parsedRules = new TreeMap<RuleName, DmcUncheckedObject>();
     
      RuleName rn = new RuleName(ruleName);
     
      DmcUncheckedObject existing = parsedRules.get(rn);
     
      if (existing != null){
        ResultException ex = new ResultException();
        ex.addError("Clashing ruleNames: \n\n" + existing.toOIF() + "\n" + uco.toOIF());
        throw(ex);
      }
     
      parsedRules.put(rn, uco);
    }
View Full Code Here

//          String ext = extList.next();
                try{
                  extclass = Class.forName(ext);
                }
                catch(Exception e){
                  ResultException ex = new ResultException();
                  ex.result.addResult(Result.FATAL,"Couldn't load schemaExtension class: " + ext);
                    ex.result.lastResult().moreMessages(e.getMessage());
                    ex.result.lastResult().moreMessages(DebugInfo.extractTheStack(e));
                    throw(ex);
                }

                int lastDot = ext.lastIndexOf(".");
                String className = ext.substring(lastDot + 1);
               
                if (extensions.get(className) == null){
                  SchemaExtensionIF extInstance = null;
                  // We don't have the extension yet, try to instantiate it
                    try{
                      extInstance = (SchemaExtensionIF) extclass.newInstance();
                    }
                    catch(Exception e){
                      ResultException ex = new ResultException();
                      ex.result.addResult(Result.FATAL,"Couldn't instantiate Java class: " + ext);
                      ex.result.lastResult().moreMessages("This may be because the class doesn't have a constructor that takes no arguments.");
                      ex.result.lastResult().moreMessages("Or it may be that the class doesn't implement the SchemaExtensionIF interface.");
                      throw(ex);
                    }
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.