In an effort to capture script bugs prior to execution I added script pre-compilation to my test tool last week. Works nice, but any String that is missing a quote will cause the bsh.Parser to die with an Exception, but "not" pass it to my script! It just dumps to the console, and exits.

You can reproduce it with:

System.out.println("This String missing quote);

 Am I doing something wrong? Can I catch this exception thrown by this Parser compilation  error?

Here is my Parser code:



package harness.parsers.beanShell;

import bsh.Parser;
import harness.common.CommonConstants;

 * @author  Michael_Pitoniak
public class BeanShellScriptCompiler implements CommonConstants{
    private FileReader m_FileReader = null;
    private Parser m_BshParser = null;
    private StringBuffer m_ResponseBuffer = null;
    private StringBuffer m_ErrorBuffer = null;
    /** Creates a new instance of BeanShellScriptCompiler */
    public BeanShellScriptCompiler() {
    public boolean compileScript(String script){
        m_ResponseBuffer = new StringBuffer();
        m_ErrorBuffer = new StringBuffer();
        boolean bSuccess = false;
            m_FileReader = new FileReader(script);
            m_BshParser = new Parser(m_FileReader);
            while(!m_BshParser.Line()/*eof*/ ){
                m_ResponseBuffer.append(m_BshParser.popNode() + NEWLINE_CHAR);
            bSuccess = true;
        }catch(Exception e){
            m_ErrorBuffer.append(e + NEWLINE_CHAR);
            }catch(Exception e){}
        return bSuccess;
    public String getResponseBuffer(){
        return m_ResponseBuffer.toString();
    public String getErrorBuffer(){
        return m_ErrorBuffer.toString();