Package org.huihoo.workflow.rules

Examples of org.huihoo.workflow.rules.ScriptException


    {
      throw fnfe;
    }
    catch (Throwable ex)
    {
      throw new ScriptException(sm.getString("script.error.file.cannot.read", new Object[] { file }));
    }
    finally
    {
      if (reader != null)
      {
View Full Code Here


          osw = new OutputStreamWriter(new FileOutputStream(javaFileName), javaEncoding);
        }
        catch (java.io.UnsupportedEncodingException ex2)
        {
          // no luck :-(
          throw new ScriptException(sm.getString("script.error.invalid.javaEncoding", new Object[] { "UTF8", javaEncoding, }));
        }
      }
      else
      {
        throw new ScriptException(sm.getString("script.error.needAlternateJavaEncoding", new Object[] { "UTF8" }));
      }
    }
    ScriptWriter writer = new ScriptWriter(new PrintWriter(osw));
    ctxt.setReader(reader);
    ctxt.setWriter(writer);
    ParseEventListener listener = new ScriptParseEventListener(ctxt);
    Parser p = new Parser(reader, listener);
    listener.beginScriptProcessing();
    p.parse();
    listener.endScriptProcessing();
    writer.close();
    ByteArrayOutputStream out = new ByteArrayOutputStream(256);
    String classpath = ctxt.getClassPath();
    javac.setClassDebugInfo(options.getClassDebugInfo());
    javac.setClassPath(classpath);
    javac.setJavaFilePath(javaFileName);
    javac.setJavaEncoding(options.getJavaEncoding());
    javac.setOutputDir(options.getScratchDir().getAbsolutePath());
    javac.setMsgOutput(out);
    /**
     * Execute the compiler
     */
    boolean status = javac.compile();
    if (!ctxt.keepGenerated())
    {
      File javaFile = new File(javaFileName);
      javaFile.delete();
    }
    if (status == false)
    {
      String msg = out.toString();
      throw new ScriptException(sm.getString("script.error.unable.compile") + msg);
    }
    return true;
  }
View Full Code Here

          osw = new OutputStreamWriter(new FileOutputStream(javaFileName), javaEncoding);
        }
        catch (java.io.UnsupportedEncodingException ex2)
        {
          // no luck :-(
          throw new ScriptException(sm.getString("script.error.invalid.javaEncoding", new Object[] { "UTF8", javaEncoding, }));
        }
      }
      else
      {
        throw new ScriptException(sm.getString("script.error.needAlternateJavaEncoding", new Object[] { "UTF8" }));
      }
    }
    ScriptWriter writer = new ScriptWriter(new PrintWriter(osw));
    ctxt.setReader(reader);
    ctxt.setWriter(writer);
    ParseEventListener listener = new ScriptParseEventListener(ctxt);
    Parser p = new Parser(reader, listener);
    listener.beginScriptProcessing();
    p.parse();
    listener.endScriptProcessing();
    writer.close();
    ByteArrayOutputStream out = new ByteArrayOutputStream(256);
    String classpath = ctxt.getClassPath();
    javac.setClassDebugInfo(options.getClassDebugInfo());
    javac.setClassPath(classpath);
    javac.setJavaFilePath(javaFileName);
    javac.setJavaEncoding(options.getJavaEncoding());
    javac.setOutputDir(options.getScratchDir().getAbsolutePath());
    javac.setMsgOutput(out);
    /**
     * Execute the compiler
     */
    boolean status = javac.compile();
    if (!ctxt.keepGenerated())
    {
      File javaFile = new File(javaFileName);
      javaFile.delete();
    }
    if (status == false)
    {
      String msg = out.toString();
      throw new ScriptException(sm.getString("script.error.unable.compile") + msg);
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of org.huihoo.workflow.rules.ScriptException

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.