/** * * Logs an error **/ public void logError (String pMessage, Throwable pRootCause) throws XelException { if (isLoggingError ()) { if (pMessage == null) { throw new XelException (pRootCause); } else if (pRootCause == null) { throw new XelException (pMessage); } else { throw new XelException (pMessage, pRootCause); } } }
public Object resolveVariable(String arg0) throws XelException { try { return vr.resolveVariable(arg0); } catch (ELException e) { throw new XelException(e); } } };//end of class...
/** Loads function and class definitions from taglib. */ public void load(String prefix, String uri, Locator locator) throws XelException { if (prefix == null || uri == null) throw new IllegalArgumentException("null"); if (_mtds != null && _mtds.containsKey(prefix)) throw new XelException("The prefix, "+prefix+", is already used"); URL url = uri.indexOf("://") > 0 ? null: locator.getResource(uri); if (url == null) { url = Taglibs.getDefaultURL(uri); if (url == null) throw new XelException("Resource not found: "+uri); } load(prefix, url); } /** Loads function and class definitions from DOM.
/** Loads function and class definitions from DOM. */ public void load(String prefix, Element root) throws XelException { if (prefix == null || root == null) throw new IllegalArgumentException("null"); if (_mtds != null && _mtds.containsKey(prefix)) throw new XelException("The prefix, "+prefix+", is already used"); try { load0(prefix, Taglibs.load(root)); } catch (Exception ex) { throw XelException.Aide.wrap(ex); } } private void load0(String prefix, TaglibDefinition loaded) {
sCachedExpressionStrings.put(pExpressionString, ret); } catch (ParseException exc) { throw new XelException(formatParseException(pExpressionString, exc)); } catch (TokenMgrError exc) { throw new XelException(exc.getMessage());
public Expression parseExpression(XelContext ctx, String expression, Class expectedType) throws XelException { try { final List frags = ExpressionFragment.parse(expression); final Object[] fs = new Object[frags.size()]; int j = 0; for (Iterator it = frags.iterator(); it.hasNext(); ++j) { final Object o = it.next(); if (o instanceof ExpressionFragment) { fs[j] = Ognl.parseExpression(((ExpressionFragment)o).getExpression()); } else { fs[j] = o; } } return new OGNLXelExpression(fs, expectedType); } catch (OgnlException ex) { throw new XelException(ex); } } public Object evaluate(XelContext ctx, String expression,
continue; //(Ian Tsai) alternative is the bean with explicit declaration in bean.xml. they are reserved for Bean if (bean != null) { throw new XelException( "more than one non-alternative bean have same name " + bean + " and " + b + ", name " + name);
public Object evaluate(XelContext ctx) throws XelException { final Map ognlctx = OGNLFactory.getContext(ctx); final Object root = OGNLFactory.getRoot(ctx); try { if (_frags.length == 1) { //optimize this most common case return Classes.coerce(_expected, _frags[0] instanceof String ? _frags[0]: Ognl.getValue(_frags[0], ognlctx, root, null)); } final StringBuffer sb = new StringBuffer(256); for (int j = 0; j < _frags.length; ++j) { if (_frags[j] instanceof String) { sb.append(_frags[j]); } else { Object val = Ognl.getValue(_frags[j], ognlctx, root, null); if (val != null) sb.append(val); } } return Classes.coerce(_expected, sb.toString()); } catch (OgnlException ex) { throw new XelException(ex); } } }
throw new XelException(ex);
public Object evaluate(XelContext xelc, String expression, Class expectedType) throws XelException { try { return _eval.evaluate(expression, expectedType, xelc != null ? new XelELResolver(xelc.getVariableResolver()): null, xelc != null ? new XelELMapper(xelc.getFunctionMapper()): null); } catch (ELException ex) { throw new XelException("Failed to evaluate "+expression, ex); } }
public Expression parseExpression(XelContext xelc, String expression, Class expectedType) throws XelException { FunctionMapper mapper = xelc != null ? xelc.getFunctionMapper(): null; try { return new ELXelExpression( _eval.parseExpression(expression, expectedType, mapper != null ? new XelELMapper(mapper): null), expression, mapper, expectedType); } catch (ELException ex) { throw new XelException("Failed to parse "+expression, ex); } } public Object evaluate(XelContext xelc, String expression,
public Object evaluate(XelContext ctx) { //Test case: B30-1957661.zul where a function mapper is created //by zscript so it is different from one page to page //In this case, we cannot reuse parsed expression. // //Note: if nfm is null, we consider it as not-change since DSP //doesn't save function mapper when evaluating try { final FunctionMapper nfm = ctx.getFunctionMapper(); if (nfm != null && _mapper != nfm) return new ApacheELFactory().evaluate(ctx, _rawexpr, _expected); final VariableResolver resolver = ctx.getVariableResolver(); return _expr.evaluate( resolver != null ? new XelELResolver(resolver): null); } catch (ELException ex) { throw new XelException(ex); } }
throw new XelException(Constants.NULL_EXPRESSION_STRING);