Search in sources :

Example 6 with PageRuntimeException

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

the class XMLDocumentStruct method setStrictErrorChecking.

// used only with java 7, do not set @Override
public void setStrictErrorChecking(boolean arg0) {
    // dynamic load to support jre 1.4 and 1.5
    try {
        Method m = doc.getClass().getMethod("setStrictErrorChecking", new Class[] { boolean.class });
        m.invoke(doc, new Object[] { Caster.toBoolean(arg0) });
    } catch (Exception e) {
        throw new PageRuntimeException(Caster.toPageException(e));
    }
}
Also used : Method(java.lang.reflect.Method) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) DOMException(org.w3c.dom.DOMException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 7 with PageRuntimeException

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

the class XMLElementStruct method setIdAttribute.

// used only with java 7, do not set @Override
public void setIdAttribute(String name, boolean isId) throws DOMException {
    // dynamic load to support jre 1.4 and 1.5
    try {
        Method m = element.getClass().getMethod("setIdAttribute", new Class[] { name.getClass(), boolean.class });
        m.invoke(element, new Object[] { name, Caster.toBoolean(isId) });
    } catch (Exception e) {
        throw new PageRuntimeException(Caster.toPageException(e));
    }
}
Also used : Method(java.lang.reflect.Method) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) DOMException(org.w3c.dom.DOMException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 8 with PageRuntimeException

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

the class XMLElementStruct method setIdAttributeNS.

// used only with java 7, do not set @Override
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
    // dynamic load to support jre 1.4 and 1.5
    try {
        Method m = element.getClass().getMethod("setIdAttributeNS", new Class[] { namespaceURI.getClass(), localName.getClass(), boolean.class });
        m.invoke(element, new Object[] { namespaceURI, localName, Caster.toBoolean(isId) });
    } catch (Exception e) {
        throw new PageRuntimeException(Caster.toPageException(e));
    }
}
Also used : Method(java.lang.reflect.Method) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) DOMException(org.w3c.dom.DOMException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 9 with PageRuntimeException

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

the class RHExtension method toBundleDefinitions.

public static BundleDefinition[] toBundleDefinitions(String strBundles) {
    if (StringUtil.isEmpty(strBundles, true))
        return EMPTY_BD;
    String[] arrStrs = toArray(strBundles);
    BundleDefinition[] arrBDs;
    if (!ArrayUtil.isEmpty(arrStrs)) {
        arrBDs = new BundleDefinition[arrStrs.length];
        int index;
        for (int i = 0; i < arrStrs.length; i++) {
            index = arrStrs[i].indexOf(':');
            if (index == -1)
                arrBDs[i] = new BundleDefinition(arrStrs[i].trim());
            else {
                try {
                    arrBDs[i] = new BundleDefinition(arrStrs[i].substring(0, index).trim(), arrStrs[i].substring(index + 1).trim());
                } catch (BundleException e) {
                    // should not happen
                    throw new PageRuntimeException(e);
                }
            }
        }
    } else
        arrBDs = EMPTY_BD;
    return arrBDs;
}
Also used : BundleDefinition(lucee.runtime.osgi.OSGiUtil.BundleDefinition) BundleException(org.osgi.framework.BundleException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 10 with PageRuntimeException

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

the class DatasourceManagerImpl method rollback.

@Override
public void rollback() throws DatabaseException {
    if (autoCommit || transConns.size() == 0)
        return;
    Iterator<DatasourceConnection> it = this.transConns.values().iterator();
    DatasourceConnection dc = null;
    Pair<DatasourceConnection, Exception> pair = null;
    while (it.hasNext()) {
        dc = it.next();
        try {
            dc.getConnection().rollback();
        } catch (Exception e) {
            // we only keep the first exception
            if (pair == null) {
                pair = new Pair<DatasourceConnection, Exception>(dc, e);
            }
        }
    }
    if (pair != null) {
        if (pair.getValue() instanceof SQLException) {
            throw new DatabaseException((SQLException) pair.getValue(), pair.getName());
        }
        throw new PageRuntimeException(pair.getValue());
    }
}
Also used : ORMDatasourceConnection(lucee.runtime.orm.ORMDatasourceConnection) SQLException(java.sql.SQLException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) DatabaseException(lucee.runtime.exp.DatabaseException) DatabaseException(lucee.runtime.exp.DatabaseException) DeprecatedException(lucee.runtime.exp.DeprecatedException) SQLException(java.sql.SQLException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) PageException(lucee.runtime.exp.PageException) Pair(lucee.commons.lang.Pair)

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