Search in sources :

Example 36 with PageRuntimeException

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

the class DatasourceResourceProvider method create.

public void create(ConnectionData data, int fullPathHash, int pathHash, String path, String name, int type) throws IOException {
    if (StringUtil.isEmpty(data.getDatasourceName()))
        throw new IOException("missing datasource definition");
    removeFromCache(data, path, name);
    DatasourceConnection dc = null;
    try {
        dc = getDatasourceConnection(data);
        getCore(data).create(dc, data.getPrefix(), fullPathHash, pathHash, path, name, type);
    } catch (SQLException e) {
        throw new IOException(e.getMessage());
    } catch (PageException e) {
        throw new PageRuntimeException(e);
    } finally {
        release(dc);
    }
}
Also used : PageException(lucee.runtime.exp.PageException) DatasourceConnection(lucee.runtime.db.DatasourceConnection) SQLException(java.sql.SQLException) IOException(java.io.IOException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 37 with PageRuntimeException

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

the class DatasourceResourceProvider method getInputStream.

public InputStream getInputStream(ConnectionData data, int fullPathHash, String path, String name) throws IOException {
    Attr attr = getAttr(data, fullPathHash, path, name);
    if (attr == null)
        throw new IOException("file [" + path + name + "] does not exist");
    DatasourceConnection dc = null;
    try {
        dc = getDatasourceConnection(data);
        return getCore(data).getInputStream(dc, data.getPrefix(), attr);
    } catch (SQLException e) {
        throw new IOException(e.getMessage());
    } catch (PageException e) {
        throw new PageRuntimeException(e);
    } finally {
        release(dc);
    // manager.releaseConnection(CONNECTION_ID,dc);
    }
}
Also used : PageException(lucee.runtime.exp.PageException) DatasourceConnection(lucee.runtime.db.DatasourceConnection) SQLException(java.sql.SQLException) IOException(java.io.IOException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Aggregations

PageRuntimeException (lucee.runtime.exp.PageRuntimeException)37 PageException (lucee.runtime.exp.PageException)17 Method (java.lang.reflect.Method)7 SQLException (java.sql.SQLException)7 DOMException (org.w3c.dom.DOMException)7 IOException (java.io.IOException)4 Entry (java.util.Map.Entry)4 Pair (lucee.commons.lang.Pair)4 DatasourceConnection (lucee.runtime.db.DatasourceConnection)4 DatabaseException (lucee.runtime.exp.DatabaseException)4 DeprecatedException (lucee.runtime.exp.DeprecatedException)4 ORMDatasourceConnection (lucee.runtime.orm.ORMDatasourceConnection)4 HashMap (java.util.HashMap)3 ApplicationException (lucee.runtime.exp.ApplicationException)3 TemplateException (lucee.runtime.exp.TemplateException)3 Array (lucee.runtime.type.Array)3 Struct (lucee.runtime.type.Struct)3 BIF (lucee.transformer.bytecode.expression.var.BIF)3 Iterator (java.util.Iterator)2 Resource (lucee.commons.io.res.Resource)2