Search in sources :

Example 51 with PageException

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;
}
Also used : PageException(lucee.runtime.exp.PageException) StructImpl(lucee.runtime.type.StructImpl) Struct(lucee.runtime.type.Struct) HashSet(java.util.HashSet)

Example 52 with PageException

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;
}
Also used : PageException(lucee.runtime.exp.PageException)

Example 53 with PageException

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);
        }
    }
}
Also used : DebugEntryTemplate(lucee.runtime.debug.DebugEntryTemplate) PageException(lucee.runtime.exp.PageException) ErrorPage(lucee.runtime.err.ErrorPage)

Example 54 with PageException

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;
    }
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) PageException(lucee.runtime.exp.PageException) Result(lucee.runtime.compiler.CFMLCompilerImpl.Result)

Example 55 with PageException

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();
}
Also used : PageException(lucee.runtime.exp.PageException) Entry(java.util.Map.Entry) Query(lucee.runtime.type.Query) Key(lucee.runtime.type.Collection.Key)

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