Search in sources :

Example 56 with PageException

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

the class EvaluateComponent method invoke.

public static Component invoke(PageContext pc, String name, String md5, Struct sctThis, Struct sctVariables) throws PageException {
    // Load comp
    Component comp = null;
    try {
        comp = pc.loadComponent(name);
        if (!ComponentUtil.md5(comp).equals(md5)) {
            SystemOut.printDate(pc.getConfig().getErrWriter(), "component [" + name + "] in this enviroment has not the same interface as the component to load, it is possible that one off the components has Functions added dynamicly.");
        // throw new ExpressionException("component ["+name+"] in this enviroment has not the same interface as the component to load");
        }
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
    setInternalState(comp, sctThis, sctVariables);
    return comp;
}
Also used : Component(lucee.runtime.Component) PageException(lucee.runtime.exp.PageException)

Example 57 with PageException

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

the class ConfigServerImpl method createClusterScope.

/*private static long _countx(ConfigWebImpl config) {
		 long count=0;
		count+=_count(config.getMappings());
		count+=_count(config.getCustomTagMappings());
		count+=_count(config.getComponentMappings());
		count+=_count(config.getFunctionMapping());
		count+=_count(config.getServerFunctionMapping());
		count+=_count(config.getTagMapping());
		count+=_count(config.getServerTagMapping());
		//count+=_count(((ConfigWebImpl)config).getServerTagMapping());
		return count;
	}*/
/*private static long _count(Mapping[] mappings) {
		 long count=0;
		for(int i=0;i<mappings.length;i++){
			count+=_count(mappings[i]);
		}
		return count;
	}*/
/*private static long _countx(Mapping mapping) {
		PCLCollection pcl = ((MappingImpl)mapping).getPCLCollection();
		return pcl==null?0:pcl.count();
	}*/
@Override
public Cluster createClusterScope() throws PageException {
    Cluster cluster = null;
    try {
        if (Reflector.isInstaneOf(getClusterClass(), Cluster.class)) {
            cluster = (Cluster) ClassUtil.loadInstance(getClusterClass(), ArrayUtil.OBJECT_EMPTY);
            cluster.init(this);
        } else if (Reflector.isInstaneOf(getClusterClass(), ClusterRemote.class)) {
            ClusterRemote cb = (ClusterRemote) ClassUtil.loadInstance(getClusterClass(), ArrayUtil.OBJECT_EMPTY);
            cluster = new ClusterWrap(this, cb);
        // cluster.init(cs);
        }
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
    return cluster;
}
Also used : ClusterWrap(lucee.runtime.type.scope.ClusterWrap) Cluster(lucee.runtime.type.scope.Cluster) FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) TagLibException(lucee.transformer.library.tag.TagLibException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException) ClusterRemote(lucee.runtime.type.scope.ClusterRemote)

Example 58 with PageException

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

the class ConfigWebImpl method getSearchEngine.

@Override
public SearchEngine getSearchEngine(PageContext pc) throws PageException {
    if (searchEngine == null) {
        try {
            Object o = ClassUtil.loadInstance(getSearchEngineClassDefinition().getClazz());
            if (o instanceof SearchEngine)
                searchEngine = (SearchEngine) o;
            else
                throw new ApplicationException("class [" + o.getClass().getName() + "] does not implement the interface SearchEngine");
            searchEngine.init(this, ConfigWebUtil.getFile(getConfigDir(), ConfigWebUtil.translateOldPath(getSearchEngineDirectory()), "search", getConfigDir(), FileUtil.TYPE_DIR, this));
        } catch (Exception e) {
            throw Caster.toPageException(e);
        }
    }
    return searchEngine;
}
Also used : SearchEngine(lucee.runtime.search.SearchEngine) ApplicationException(lucee.runtime.exp.ApplicationException) PageException(lucee.runtime.exp.PageException) BundleException(org.osgi.framework.BundleException) SecurityException(lucee.runtime.exp.SecurityException) SAXException(org.xml.sax.SAXException) IOException(java.io.IOException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException)

Example 59 with PageException

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

the class ResourceUtil method strAttrToBooleanFlags.

private static short[] strAttrToBooleanFlags(String attributes) throws IOException {
    String[] arr;
    try {
        arr = ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(attributes.toLowerCase(), ','));
    } catch (PageException e) {
        arr = new String[0];
    }
    boolean hasNormal = false;
    boolean hasReadOnly = false;
    boolean hasHidden = false;
    boolean hasArchive = false;
    boolean hasSystem = false;
    for (int i = 0; i < arr.length; i++) {
        String str = arr[i].trim().toLowerCase();
        if (str.equals("readonly") || str.equals("read-only") || str.equals("+r"))
            hasReadOnly = true;
        else if (str.equals("normal") || str.equals("temporary"))
            hasNormal = true;
        else if (str.equals("hidden") || str.equals("+h"))
            hasHidden = true;
        else if (str.equals("system") || str.equals("+s"))
            hasSystem = true;
        else if (str.equals("archive") || str.equals("+a"))
            hasArchive = true;
        else
            throw new IOException("invalid attribute definition [" + str + "]");
    }
    short[] flags = new short[4];
    if (hasReadOnly)
        flags[READ_ONLY] = YES;
    else if (hasNormal)
        flags[READ_ONLY] = NO;
    if (hasHidden)
        flags[HIDDEN] = YES;
    else if (hasNormal)
        flags[HIDDEN] = NO;
    if (hasSystem)
        flags[SYSTEM] = YES;
    else if (hasNormal)
        flags[SYSTEM] = NO;
    if (hasArchive)
        flags[ARCHIVE] = YES;
    else if (hasNormal)
        flags[ARCHIVE] = NO;
    return flags;
}
Also used : PageException(lucee.runtime.exp.PageException) IOException(java.io.IOException)

Example 60 with PageException

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

the class FormImpl method makeComparable.

private String makeComparable(String key) {
    key = StringUtil.trim(key, "");
    // form.x
    if (StringUtil.startsWithIgnoreCase(key, "form."))
        key = key.substring(5).trim();
    // form . x
    try {
        Array array = ListUtil.listToArray(key, '.');
        if (array.size() > 1 && array.getE(1).toString().trim().equalsIgnoreCase("form")) {
            array.removeE(1);
            key = ListUtil.arrayToList(array, ".").trim();
        }
    } catch (PageException e) {
    }
    return key;
}
Also used : Array(lucee.runtime.type.Array) PageException(lucee.runtime.exp.PageException)

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