Search in sources :

Example 76 with PageException

use of lucee.runtime.exp.PageException in project Lucee by lucee.

the class CFCGateway method doStart.

@Override
public void doStart() throws GatewayException {
    engine.log(this, GatewayEngine.LOGLEVEL_INFO, "start");
    Struct args = new StructImpl();
    state = STARTING;
    try {
        callOneWay("start", args);
        engine.log(this, GatewayEngine.LOGLEVEL_INFO, "running");
        state = RUNNING;
    } catch (PageException pe) {
        state = FAILED;
        throw new PageGatewayException(pe);
    }
}
Also used : PageException(lucee.runtime.exp.PageException) StructImpl(lucee.runtime.type.StructImpl) Struct(lucee.runtime.type.Struct)

Example 77 with PageException

use of lucee.runtime.exp.PageException in project Lucee by lucee.

the class XMLEventParser method error.

/**
 * call back error function if a error occour
 * @param pe
 */
private void error(PageException pe) {
    if (error == null)
        throw new PageRuntimeException(pe);
    try {
        pc = ThreadLocalPageContext.get(pc);
        error.call(pc, new Object[] { pe.getCatchBlock(pc.getConfig()) }, false);
    } catch (PageException e) {
    }
}
Also used : PageException(lucee.runtime.exp.PageException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 78 with PageException

use of lucee.runtime.exp.PageException in project Lucee by lucee.

the class XMLEventParser method start.

/**
 * start execution of the parser
 * @param xmlFile
 * @param saxParserCass
 * @throws PageException
 */
public void start(Resource xmlFile) throws PageException {
    InputStream is = null;
    try {
        XMLReader xmlReader = XMLUtil.createXMLReader();
        xmlReader.setContentHandler(this);
        xmlReader.setErrorHandler(this);
        xmlReader.parse(new InputSource(is = IOUtil.toBufferedInputStream(xmlFile.getInputStream())));
    } catch (Exception e) {
        throw Caster.toPageException(e);
    } finally {
        IOUtil.closeEL(is);
    }
}
Also used : InputSource(org.xml.sax.InputSource) InputStream(java.io.InputStream) XMLReader(org.xml.sax.XMLReader) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) PageException(lucee.runtime.exp.PageException)

Example 79 with PageException

use of lucee.runtime.exp.PageException in project Lucee by lucee.

the class VariableInterpreter method parse.

/*
	public static boolean isDefined(PageContext pc,String var) {
        StringList list = parse(pc,new ParserString(var));
        if(list==null) return false;
        
		int scope=scopeString2Int(list.next());
		Object coll =NULL; 
		if(scope==Scope.SCOPE_UNDEFINED) {
		    coll=pc.undefinedScope().get(list.current(),NULL);
		    if(coll==NULL) return false;
		}
		else {
		    try {
                coll=pc.scope(scope);
            } catch (PageException e) {
                return false;
            }
		}
		
		while(list.hasNext()) {
			coll=pc.getVariableUtil().get(pc,coll,list.next(),NULL);
			//print.out(coll);
			if(coll==NULL) return false;
		}
       
		return true;
    }
	 */
/**
 * parse a Literal variable String and return result as String List
 * @param pc Page Context
 * @param ps ParserString to read
 * @return Variable Definition in a String List
 */
private static StringList parse(PageContext pc, ParserString ps, boolean doLowerCase) {
    String id = readIdentifier(ps, doLowerCase);
    if (id == null)
        return null;
    StringList list = new StringList(id);
    CFMLExpressionInterpreter interpreter = null;
    while (true) {
        if (ps.forwardIfCurrent('.')) {
            id = readIdentifier(ps, doLowerCase);
            if (id == null)
                return null;
            list.add(id);
        } else if (ps.forwardIfCurrent('[')) {
            if (interpreter == null)
                interpreter = new CFMLExpressionInterpreter(false);
            try {
                list.add(Caster.toString(interpreter.interpretPart(pc, ps)));
            } catch (PageException e) {
                return null;
            }
            if (!ps.forwardIfCurrent(']'))
                return null;
            ps.removeSpace();
        } else
            break;
    }
    if (ps.isValidIndex())
        return null;
    list.reset();
    return list;
}
Also used : PageException(lucee.runtime.exp.PageException) StringList(lucee.commons.lang.StringList) ParserString(lucee.commons.lang.ParserString)

Example 80 with PageException

use of lucee.runtime.exp.PageException in project Lucee by lucee.

the class VariableInterpreter method getVariableELAsCollection.

public static Object getVariableELAsCollection(PageContext pc, String var, Object defaultValue) {
    StringList list = parse(pc, new ParserString(var), false);
    if (list == null)
        return defaultValue;
    int scope = scopeString2Int(pc.ignoreScopes(), list.next());
    Object coll = null;
    if (scope == Scope.SCOPE_UNDEFINED) {
        try {
            coll = pc.undefinedScope().getCollection(list.current());
        } catch (PageException e) {
            coll = null;
        }
        if (coll == null)
            return defaultValue;
    } else {
        try {
            coll = VariableInterpreter.scope(pc, scope, list.hasNext());
        // coll=pc.scope(scope);
        } catch (PageException e) {
            return defaultValue;
        }
    }
    while (list.hasNext()) {
        coll = pc.getVariableUtil().getCollection(pc, coll, list.next(), null);
        if (coll == null)
            return defaultValue;
    }
    return coll;
}
Also used : PageException(lucee.runtime.exp.PageException) StringList(lucee.commons.lang.StringList) ParserString(lucee.commons.lang.ParserString)

Aggregations

PageException (lucee.runtime.exp.PageException)200 ApplicationException (lucee.runtime.exp.ApplicationException)56 IOException (java.io.IOException)54 Struct (lucee.runtime.type.Struct)49 StructImpl (lucee.runtime.type.StructImpl)37 ExpressionException (lucee.runtime.exp.ExpressionException)32 Resource (lucee.commons.io.res.Resource)30 SecurityException (lucee.runtime.exp.SecurityException)26 BundleException (org.osgi.framework.BundleException)26 MalformedURLException (java.net.MalformedURLException)25 Array (lucee.runtime.type.Array)21 Key (lucee.runtime.type.Collection.Key)17 PageRuntimeException (lucee.runtime.exp.PageRuntimeException)15 SAXException (org.xml.sax.SAXException)15 Entry (java.util.Map.Entry)14 ClassException (lucee.commons.lang.ClassException)14 DeprecatedException (lucee.runtime.exp.DeprecatedException)14 SMTPException (lucee.runtime.net.mail.SMTPException)13 ArrayImpl (lucee.runtime.type.ArrayImpl)13 Query (lucee.runtime.type.Query)13