Package javax.el

Examples of javax.el.ELException


  }

  private final static Node createNodeInternal(String expr)
      throws ELException {
    if (expr == null) {
      throw new ELException(MessageFactory.get("error.null"));
    }

    Node n = (Node) cache.get(expr);
    if (n == null) {
      try {
        n = (new ELParser(new StringReader(expr)))
            .CompositeExpression();

        // validate composite expression
        if (n instanceof AstCompositeExpression) {
          int numChildren = n.jjtGetNumChildren();
          if (numChildren == 1) {
            n = n.jjtGetChild(0);
          } else {
            Class type = null;
            Node child = null;
            for (int i = 0; i < numChildren; i++) {
              child = n.jjtGetChild(i);
              if (child instanceof AstLiteralExpression)
                continue;
              if (type == null)
                type = child.getClass();
              else {
                if (!type.equals(child.getClass())) {
                  throw new ELException(MessageFactory.get(
                      "error.mixed", expr));
                }
              }
            }
          }
        }
        if (n instanceof AstDeferredExpression
            || n instanceof AstDynamicExpression) {
          n = n.jjtGetChild(0);
        }
        cache.put(expr, n);
      } catch (ParseException pe) {
        throw new ELException("Error Parsing: " + expr, pe);
      }
    }
    return n;
  }
View Full Code Here


    if (node instanceof AstFunction) {

      AstFunction funcNode = (AstFunction) node;

      if (this.fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
      }
     
      Method m = null;
     
      if (fnMapper instanceof ExtendedFunctionMapper)
      {
         m = ((ExtendedFunctionMapper) fnMapper).resolveFunction(funcNode.getPrefix(),
               funcNode.getLocalName(), node.jjtGetNumChildren());   
      }
      else
      {
         m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode.getLocalName());
      }
     
      if (m == null) {
        throw new ELException(MessageFactory.get(
            "error.fnMapper.method", funcNode.getOutputName()));
      }
      int pcnt = m.getParameterTypes().length;
      if (!m.isVarArgs() && node.jjtGetNumChildren() != pcnt) {
        throw new ELException(MessageFactory.get(
            "error.fnMapper.paramcount", funcNode.getOutputName(),
            "" + pcnt, "" + node.jjtGetNumChildren()));
      }
    } else if (node instanceof AstIdentifier && this.varMapper != null) {
      String variable = ((AstIdentifier) node).getImage();
View Full Code Here

          this.varMapper, expectedReturnType, expectedParamTypes);
    } else if (n instanceof AstLiteralExpression) {
      return new MethodExpressionLiteral(expression, expectedReturnType,
          expectedParamTypes);
    } else {
      throw new ELException("Not a Valid Method Expression: "
          + expression);
    }
  }
View Full Code Here

                if (!isPropertyValid(expressionBody)) {
                    String message =
                          MessageUtils
                                .getExceptionMessageString(MessageUtils.INVALID_RESOURCE_FORMAT_COLON_ERROR,
                                                           expressionBody);
                    throw new ELException(message);
                }
                Map<String, Object> appMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();

                String[] parts = Util.split(appMap, expressionBody, ":");
                if (null == parts[0] || null == parts[1]) {
                    String message =
                          MessageUtils
                                .getExceptionMessageString(MessageUtils.INVALID_RESOURCE_FORMAT_NO_LIBRARY_NAME_ERROR,
                                                           expressionBody);
                    throw new ELException(message);

                }
                try {
                    int mark = parts[0].indexOf("[") + 2;
                    char quoteMark = parts[0].charAt(mark - 1);
                    parts[0] = parts[0].substring(mark, colon);
                    if (parts[0].equals("this")) {
                        LibraryInfo libInfo = info.getLibraryInfo();
                        if (null != libInfo) {
                            parts[0] = libInfo.getName();
                        } else if (null != info.getContract()) {
                            parts[0] = info.getContract();
                        } else {
                            throw new NullPointerException("Resource expression is not a library or resource library contract");
                        }
                       
                        mark = parts[1].indexOf("]") - 1;
                        parts[1] = parts[1].substring(0, mark);
                        expressionBody = "resource[" + quoteMark + parts[0] +
                                         ":" + parts[1] + quoteMark + "]";
                    }
                }
                catch (Exception e) {
                    String message =
                          MessageUtils
                                .getExceptionMessageString(MessageUtils.INVALID_RESOURCE_FORMAT_ERROR,
                                                           expressionBody);
                    throw new ELException(message);

                }
            }
            ELContext elContext = ctx.getELContext();
            expressionEvaluated = true;
View Full Code Here

        if (obj1 instanceof Comparable<?>) {
            @SuppressWarnings("unchecked") // checked above
            final Comparable<Object> comparable = (Comparable<Object>) obj1;
            return (obj0 != null) ? -comparable.compareTo(obj0) : -1;
        }
        throw new ELException(MessageFactory.get("error.compare", obj0, obj1));
    }
View Full Code Here

        if (type.isAssignableFrom(obj.getClass())) {
            return (Enum<?>) obj;
        }
       
        if (!(obj instanceof String)) {
            throw new ELException(MessageFactory.get("error.convert",
                    obj, obj.getClass(), type));
        }

        Enum<?> result;
        try {
             result = Enum.valueOf(type, (String) obj);
        } catch (IllegalArgumentException iae) {
            throw new ELException(MessageFactory.get("error.convert",
                    obj, obj.getClass(), type));
        }
        return result;
    }
View Full Code Here

        }
        if (obj instanceof String) {
            return Boolean.valueOf((String) obj);
        }

        throw new ELException(MessageFactory.get("error.convert",
                obj, obj.getClass(), Boolean.class));
    }
View Full Code Here

        Class<?> objType = obj.getClass();
        if (obj instanceof Character) {
            return (Character) obj;
        }

        throw new ELException(MessageFactory.get("error.convert",
                obj, objType, Character.class));
    }
View Full Code Here

        }
        if (Number.class.equals(type)) {
            return number;
        }

        throw new ELException(MessageFactory.get("error.convert",
                number, number.getClass(), type));
    }
View Full Code Here

        if (obj instanceof Character) {
            return coerceToNumber(new Short((short) ((Character) obj)
                    .charValue()), type);
        }

        throw new ELException(MessageFactory.get("error.convert",
                obj, obj.getClass(), type));
    }
View Full Code Here

TOP

Related Classes of javax.el.ELException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.