Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGExpressionException


                }
               
                // Some syntax error
                catch (EcmaError exc) {
                    String exceptionMessage = exc.getName() + " executing tmlscript: " + exc.getMessage() + "\n" + buildExceptionDetails(exc);
                    WGExpressionException expressionException;
                    String scriptStackTrace = filterScriptStackTrace(exc.getScriptStackTrace(TMLSCRIPT_NAME_FILTER));
                    Throwable cause = (WGUtils.isEmpty(scriptStackTrace) ? exc : null);
                    expressionException = new de.innovationgate.webgate.api.WGExpressionException(exceptionMessage, exc.lineSource(), cause, scriptStackTrace);
                    return new ExpressionResult(null, false, true, expressionException);
                }
View Full Code Here


   
                RhinoContextAction contextAction = new RhinoContextAction(_context, _function, _overrideFunctionScope, _params);
                ExpressionResult result = (ExpressionResult) ContextFactory.getGlobal().call(contextAction);
               
                if (result.isError()) {
                    WGExpressionException exc = result.getException();
                    _context.getlog().error(
                            "Error executing anonymous TMLScript Master Function",
                            result.getException());
                            
                }
View Full Code Here

            // Call action
            Object result = context.callCustomAction(action, params, parentScopeObjects);
            if (context.isdefined("actionresult")) {
                ExpressionResult expressionResult = (ExpressionResult) context.item("actionresult");
                if (expressionResult.isError()) {
                    WGExpressionException ex = expressionResult.getException();
                   
                    // User defined TMLScript exception should be passed on unmodified
                    if (ex.getCause() instanceof TMLScriptException) {
                        throw ex.getCause();
                    }
                    else {
                        throw ex;   
                    }
                   
View Full Code Here

        if (objects == null) {
            objects = new HashMap();
        }
       
        if (context == null) {
            return new ExpressionResult(null, false, false, new WGExpressionException("Tried to execute TMLScript with an tml object context of null", expression));
        }

        if (objects.containsKey("$tmlscriptDebug")) {
            debug();
        }
View Full Code Here




    protected void addExpressionWarning(String expression, ExpressionResult result) {
        WGExpressionException exc = result.getException();
       
        // Put out as WebTML Warning
        String warningMessage = exc.getMessage() + (exc.getExpression() != null ? "\nExpression line: " + exc.getExpression() : "\nExpression:\n" + expression);
        if (!WGUtils.isEmpty(exc.getNativeStackTrace())) {
            warningMessage += "\n" + exc.getNativeStackTrace();
        }
        this.addWarning(warningMessage);
       
        // Put out on log
        if (exc.getCause() != null) {
           getTMLContext().getlog().error("Exception executing tmlscript", exc.getCause());
        }
        else if (!WGUtils.isEmpty(exc.getNativeStackTrace())) {
            getTMLContext().getlog().error("Exception executing tmlscript: " + exc.getMessage() + "\n" + exc.getNativeStackTrace());
        }
    }
View Full Code Here

    public void dispose() {
    }

    public Object evaluateExpression(String expression) throws WGExpressionException, WGBackendException {
        throw new WGExpressionException("Not supported", expression);
    }
View Full Code Here

            // evaluate
            ExpressionEngine engine = ExpressionEngineFactory.getEngine(ExpressionEngineFactory.ENGINE_TMLSCRIPT);
        ExpressionResult result = engine.evaluateExpression(tmlAction.getCode(), actionContext, ExpressionEngine.TYPE_SCRIPT, additionalObjects);
        if (result.isError()) {
            WGExpressionException exc = result.getException();
               
                if (iswebenvironment()) {
                    addwarning(WGUtils.encodeHTML(exc.getMessage() + (exc.getExpression() != null ? "\nExpression line: " + exc.getExpression() : "\nExpression:\n" + tmlAction.getCode())), false);
                }
               
                getwgacore().getLog().error(
                        "Error executing " + tmlAction.getDescription() + " : " + result.getException().getMessage(),
                        result.getException());
View Full Code Here

public class NativeExpressionEngine implements ExpressionEngine {
  public ExpressionResult evaluateExpression(String expression, TMLContext context, int type, Map objects) {
   
    WGDocument doc = context.getapiobject();
    if (!doc.getDatabase().hasFeature(WGDatabase.FEATURE_NATIVEEXPRESSIONS)) {
      return new ExpressionResult(null, false, false, new WGExpressionException("This database does not support native expressions", expression));
    }
   
    Object result = null;
   
    try {
      result = doc.evaluateExpression(expression);
    }        
        catch (WGExpressionException e) {
            return new ExpressionResult(null, false, true, e);
        }
        catch (WGAPIException e) {
            return new ExpressionResult(null, false, true, new WGExpressionException(e.getMessage(), expression, e));
        }
    return new ExpressionResult(result, doc.resultIsTrue(result), doc.resultIsFalse(result), null);
   
  }
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGExpressionException

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.