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);
}
}
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) {
}
}
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);
}
}
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;
}
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;
}
Aggregations