Examples of ScriptException


Examples of javax.script.ScriptException

    }

    public void testBSF29(){
        final Exception exception = new Exception("exception message");
        final String expectedMessage =exception.toString();
        final Exception scriptException = new ScriptException(exception);
        assertEquals(expectedMessage, scriptException.getMessage());
    }
View Full Code Here

Examples of net.sourceforge.marathon.api.ScriptException

            addToPath(pathSegments, getPathForPython("/libpy/marathon"));
            addToPath(pathSegments, pyHome);
            pythonPath = getPathFromSegments(pathSegments);
        } catch (Exception e) {
            e.printStackTrace();
            throw new ScriptException("unable to intialize marathon runtime."
                    + " Check to make sure that marathon modules are in the python path:\n" + pythonPath);
        }
        return pythonPath;
    }
View Full Code Here

Examples of net.xoetrope.optional.scripts.ScriptException

      result = cx.evaluateString( scope, script, "<cmd>", 1, null );           
    }
    catch(Exception e){           
      e.printStackTrace();
      throw new ScriptException( e.getMessage(), e );           
    }
    finally {
      //flushes the current context
      Context.exit();           
    }
View Full Code Here

Examples of org.crsh.command.ScriptException

  public static ScriptException unwrap(groovy.util.ScriptException cause) {
    // Special handling for groovy.util.ScriptException
    // which may be thrown by scripts because it is imported by default
    // by groovy imports
    String msg = cause.getMessage();
    ScriptException translated;
    if (msg != null) {
      translated = new ScriptException(msg);
    } else {
      translated = new ScriptException();
    }
    translated.setStackTrace(cause.getStackTrace());
    return translated;
  }
View Full Code Here

Examples of org.elasticsearch.script.ScriptException

                binding.getVariables().putAll(vars);
            }
            scriptObject.setBinding(binding);
            return new GroovyExecutableScript(scriptObject);
        } catch (Exception e) {
            throw new ScriptException("failed to build executable script", e);
        }
    }
View Full Code Here

Examples of org.huihoo.workflow.rules.ScriptException

            scriptClass = ctxt.load();
            theScript = (Script) scriptClass.newInstance();
          }
          catch (Exception ex1)
          {
            throw new ScriptException(ex1);
          }

          theScript.init(scriptContext, workflowTransition);
          firstTime = false;
          reload = false;
View Full Code Here

Examples of org.jaggeryjs.scriptengine.exceptions.ScriptException

        if ("r".equals(mode)) {
            try {
                file = new RandomAccessFile(path, "r");
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            readable = true;
        } else if ("r+".equals(mode)) {
            try {
                file = new RandomAccessFile(path, "rw");
                file.seek(0);
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            readable = true;
            writable = true;
        } else if ("w".equals(mode)) {
            try {
                file = new RandomAccessFile(path, "rw");
                file.setLength(0);
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            writable = true;
        } else if ("w+".equals(mode)) {
            try {
                file = new RandomAccessFile(path, "rw");
                file.setLength(0);
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            readable = true;
            writable = true;
        } else if ("a".equals(mode)) {
            try {
                file = new RandomAccessFile(path, "rw");
                file.seek(file.length());
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            writable = true;
        } else if ("a+".equals(mode)) {
            try {
                file = new RandomAccessFile(path, "rw");
                file.seek(file.length());
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            readable = true;
            writable = true;
        } else {
            String msg = "Invalid file mode, path : " + path + ", mode : " + mode;
            log.error(msg);
            throw new ScriptException(msg);
        }
        opened = true;
    }
View Full Code Here

Examples of org.jitterbit.integration.data.script.ScriptException

    int start0=0,start,end;
    while((start=expr.indexOf(ScriptConstants.BEGIN_TRANS,start0))>=0){
      start+=ScriptConstants.BEGIN_TRANS_LENGTH;
      end=Transform.find_END_TRANS_position(expr,start);
      if(end<0){
        throw new ScriptException("Target:" + targetDE +
            "\nMissing closing tag " +
            ScriptConstants.END_TRANS +
            "\nExpression:\n"+
            expr);
      }

      newExpr.append(expr.substring(start0,start));

      Transform trans = new Transform();
      trans.initTokenizer(expr, start, end);

      boolean isAtStart=true, hasValidLHS=false;
      Token t;
      while((t=trans.nextToken(isAtStart,hasValidLHS))!=null){
        int id=t.getId();
        if(id==Transform.t_End)break;
        if(id==Transform.t_Unknown){
          return null;
        }
        if(id==Transform.t_DE){
          //String oldDeName=t.getStr();
          // if oldDeName does not contains instance tag
          String oldDe0=t.getStr(),newDe0=mapTable.get(oldDe0);
          if(newDe0!=null){
            newExpr.append(newDe0);
          } else {
            StringTokenizer tk=new StringTokenizer(oldDe0,"#.",true);
            String str="";
            StringBuilder oldDe=new StringBuilder();
            String newDe=""; // oldDe0, newDe0 have '#', but oldDe, newDe don't
            boolean bPrompt=false;
            while(tk.hasMoreTokens()){
              String token=tk.nextToken();
              if(token.charAt(0)=='#'){
                StringBuilder tag=new StringBuilder("#"); // tag is the substring between '#' and '.' including '#' and '.'
                while(tk.hasMoreTokens()){
                  token=tk.nextToken();
                  tag.append(token);
                  if(token.charAt(0)=='.')break;
                }
                oldDe.append('.');
                int last_len=newDe.length();
                String newDe_tmp=mapTable.get("["+oldDe+"]");
                if(newDe_tmp==null){
                  bPrompt=true;
                          continue;
                } else if(newDe_tmp.charAt(0)=='['){
                  newDe=newDe_tmp.substring(1,newDe_tmp.length()-1);
                }
                int len=newDe.length();
                if(newDe.charAt(len-1)=='.'){ // this subnode terminate with '.'
                  str+=newDe.substring(last_len,len-1)+tag;
                }
                else {// subnode terminate with '$'
                  str+=newDe.substring(last_len,len);
                }
              }
              else {
                oldDe.append(token);
              }
            }
            int last_len=newDe.length();
            newDe=mapTable.get(oldDe.toString());
            if(newDe!=null){
              if(last_len<newDe.length()){
                str+=newDe.substring(last_len,newDe.length());
              }
              if(bPrompt){
                String title = "Target: "+targetDE;
                str=migration.manualConversion(title, oldDe0, str);
              }
              if(str!=null)newExpr.append(str);
            }
            if(str==null||newDe==null) {
              String title = "Target: "+targetDE;
              String err_message =
                "Failed to translate node: "+oldDe0+
                "\nin the following expression:";
              String question = "Do you want to skip the migration for this mapping?";

              if(migration.checkToContinue(title,err_message,expr,question)){
                        return null;
                      }
                      else {
                        throw new ScriptException(
                            "Error in migrating the mapping\n"+
                    "\nThe target node: "+ targetDE +
                    "\nFailed to translate the node:\n"+oldDe0+
                    "\nin the expression\n" + expr);
                      }
View Full Code Here

Examples of org.qi4j.library.scripting.ScriptException

    {
        // TODO optimize with hardcoded parser??
        StringTokenizer st = new StringTokenizer( script, " \t\n\r\f(){}", false );
        if( !st.hasMoreTokens() )
        {
            throw new ScriptException( "The word \"function\" was not found in script: " + scriptName );
        }
        String fx = st.nextToken();
        if( !"function".equals( fx ) )
        {
            throw new ScriptException( "The word \"function\" was not found in script: " + scriptName );
        }
        if( !st.hasMoreTokens() )
        {
            throw new ScriptException( "Invalid syntax in: " + scriptName + "\n No function name." );
        }
        return st.nextToken();
    }
View Full Code Here

Examples of org.webharvest.exception.ScriptException

        super(context);
        this.beanShellInterpreter.getNameSpace().importCommands("org.webharvest.runtime.scripting");
        try {
            this.beanShellInterpreter.set(CONTEXT_VARIABLE_NAME, this.context);
        } catch (EvalError e) {
            throw new ScriptException("Cannot set Web-Harvest context in scripter: " + e.getMessage(), e);
        }
    }
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.