use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class DebuggerUtil method pointOutClosuresInPersistentScopes.
public Struct pointOutClosuresInPersistentScopes(PageContext pc) {
Struct sct = new StructImpl();
Set<Object> done = new HashSet<Object>();
// Application Scope
try {
sct.set(KeyConstants._application, _pointOutClosuresInPersistentScopes(pc, pc.applicationScope(), done));
} catch (PageException e) {
}
// Session Scope
try {
sct.set(KeyConstants._application, _pointOutClosuresInPersistentScopes(pc, pc.sessionScope(), done));
} catch (PageException e) {
}
// Server Scope
try {
sct.set(KeyConstants._application, _pointOutClosuresInPersistentScopes(pc, pc.serverScope(), done));
} catch (PageException e) {
}
return null;
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class PageContextImpl method setCatch.
@Override
public PageException setCatch(Throwable t) {
PageException pe = t == null ? null : Caster.toPageException(t);
_setCatch(pe, false, true, false);
return pe;
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class PageContextImpl method _doInclude.
private void _doInclude(PageSource[] sources, boolean runOnce) throws PageException {
// debug
if (!gatewayContext && config.debug()) {
long currTime = executionTime;
long exeTime = 0;
long time = System.nanoTime();
Page currentPage = PageSourceImpl.loadPage(this, sources);
notSupported(config, currentPage.getPageSource());
if (runOnce && includeOnce.contains(currentPage.getPageSource()))
return;
DebugEntryTemplate debugEntry = debugger.getEntry(this, currentPage.getPageSource());
try {
addPageSource(currentPage.getPageSource(), true);
debugEntry.updateFileLoadTime((System.nanoTime() - time));
exeTime = System.nanoTime();
currentPage.call(this);
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
PageException pe = Caster.toPageException(t);
if (Abort.isAbort(pe)) {
if (Abort.isAbort(pe, Abort.SCOPE_REQUEST))
throw pe;
} else {
if (fdEnabled) {
FDSignal.signal(pe, false);
}
// TODO was soll das 187
pe.addContext(currentPage.getPageSource(), -187, -187, null);
throw pe;
}
} finally {
includeOnce.add(currentPage.getPageSource());
long diff = ((System.nanoTime() - exeTime) - (executionTime - currTime));
executionTime += (System.nanoTime() - time);
debugEntry.updateExeTime(diff);
removeLastPageSource(true);
}
} else // no debug
{
Page currentPage = PageSourceImpl.loadPage(this, sources);
notSupported(config, currentPage.getPageSource());
if (runOnce && includeOnce.contains(currentPage.getPageSource()))
return;
try {
addPageSource(currentPage.getPageSource(), true);
currentPage.call(this);
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
PageException pe = Caster.toPageException(t);
if (Abort.isAbort(pe)) {
if (Abort.isAbort(pe, Abort.SCOPE_REQUEST))
throw pe;
} else {
pe.addContext(currentPage.getPageSource(), -187, -187, null);
throw pe;
}
} finally {
includeOnce.add(currentPage.getPageSource());
removeLastPageSource(true);
}
}
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class PageSourceImpl method _compile.
private Page _compile(ConfigWeb config, Resource classRootDir, Page existing, boolean returnValue, boolean ignoreScopes) throws IOException, SecurityException, IllegalArgumentException, PageException {
ConfigWebImpl cwi = (ConfigWebImpl) config;
int dialect = getDialect();
long now;
if ((getPhyscalFile().lastModified() + 10000) > (now = System.currentTimeMillis()))
// SystemUtil.get
cwi.getCompiler().watch(this, now);
Result result;
result = cwi.getCompiler().compile(cwi, this, cwi.getTLDs(dialect), cwi.getFLDs(dialect), classRootDir, returnValue, ignoreScopes);
try {
Class<?> clazz = mapping.getPhysicalClass(getClassName(), result.barr);
return newInstance(clazz);
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
PageException pe = Caster.toPageException(t);
pe.setExtendedInfo("failed to load template " + getDisplayPath());
throw pe;
}
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class UDFArgConverter method serializeCollection.
private static String serializeCollection(Collection coll, Set<Object> done) {
if (coll instanceof Query) {
Query qry = (Query) coll;
StringBuilder sb = new StringBuilder(8192);
Iterator<Key> it = qry.keyIterator();
Key k;
sb.append("{");
int len = qry.getRecordcount();
while (it.hasNext()) {
k = it.next();
sb.append(',');
sb.append(k.getLowerString());
sb.append('[');
boolean doIt = false;
for (int y = 1; y <= len; y++) {
if (doIt)
sb.append(',');
doIt = true;
try {
sb.append(serialize(qry.getAt(k, y), done));
} catch (PageException e) {
sb.append(serialize(e.getMessage(), done));
}
}
sb.append(']');
}
sb.append('}');
return sb.toString();
}
StringBuilder sb = new StringBuilder("{");
Iterator<Entry<Key, Object>> it = coll.entryIterator();
Entry<Key, Object> e;
boolean notFirst = false;
while (it.hasNext()) {
if (notFirst)
sb.append(",");
e = it.next();
sb.append(e.getKey().getLowerString());
sb.append(":");
sb.append(serialize(e.getValue(), done));
notFirst = true;
}
return sb.append("}").toString();
}
Aggregations