Example usage for javax.el ELException ELException

List of usage examples for javax.el ELException ELException

Introduction

In this page you can find the example usage for javax.el ELException ELException.

Prototype

public ELException(String message, Throwable cause) 

Source Link

Document

Creates an ELException with the given detail message and root cause.

Usage

From source file:org.nuxeo.ecm.platform.ui.web.binding.alias.AliasVariableMapperWrapper.java

/**
 * First tries to resolve against the inner Map, then the wrapped ValueExpression, unless target is an
 * {@link AliasVariableMapper} that blocks this variable pattern.
 *///  w w  w. java2s.  co m
@Override
public ValueExpression resolveVariable(String variable) {
    ValueExpression ve = null;
    try {
        if (vars != null) {
            ve = (ValueExpression) vars.get(variable);
        }
        if (ve == null) {
            // resolve to a value expression resolving to null if variable
            // is supposed to be blocked
            if (variable != null && blockedPatterns != null) {
                for (String blockedPattern : blockedPatterns) {
                    if (blockedPattern == null) {
                        continue;
                    }
                    boolean doBlock = false;
                    if (blockedPattern.endsWith("*")) {
                        String pattern = blockedPattern.substring(0, blockedPattern.length() - 1);
                        if (variable.startsWith(pattern)) {
                            doBlock = true;
                        }
                    } else if (blockedPattern.equals(variable)) {
                        doBlock = true;
                    }
                    if (doBlock) {
                        if (log.isDebugEnabled()) {
                            log.debug("Blocked expression var='" + variable + "'");
                        }
                        return getNullValueExpression();
                    }
                }
            }
            return orig.resolveVariable(variable);
        }
        return ve;
    } catch (StackOverflowError e) {
        throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.binding.BlockingVariableMapper.java

@Override
public ValueExpression resolveVariable(String variable) {
    ValueExpression ve = null;/*from  w  w  w .j  av  a2s .  c  om*/
    try {
        if (hasVariable(variable)) {
            ve = (ValueExpression) vars.get(variable);
        } else {
            // resolve to a value expression resolving to null if variable
            // is supposed to be blocked
            if (variable != null && blockedPatterns != null) {
                for (String blockedPattern : blockedPatterns) {
                    if (StringUtils.isBlank(blockedPattern)) {
                        continue;
                    }
                    boolean doBlock = false;
                    if (blockedPattern.endsWith("*")) {
                        String pattern = blockedPattern.substring(0, blockedPattern.length() - 1);
                        if (variable.startsWith(pattern)) {
                            doBlock = true;
                        }
                    } else if (blockedPattern.equals(variable)) {
                        doBlock = true;
                    }
                    if (doBlock) {
                        if (log.isDebugEnabled()) {
                            log.debug(String.format("Blocked expression var='%s'", variable));
                        }
                        return getNullValueExpression();
                    }
                }
            }
            return orig.resolveVariable(variable);
        }
        return ve;
    } catch (StackOverflowError e) {
        throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
    }
}