Exemple #1
0
        public object getValue(OgnlContext context, object source)
        {
            if (context.getTraceEvaluations())
            {
                EvaluationPool pool          = OgnlRuntime.getEvaluationPool();
                object         result        = null;
                Exception      evalException = null;
                Evaluation     evaluation    = pool.create(this, source);

                context.pushEvaluation(evaluation);
                try {
                    result = evaluateGetValueBody(context, source);
                } catch (OgnlException ex) {
                    evalException = ex;
                    throw ex;
                } catch (Exception ex) {
                    evalException = ex;
                    throw ex;
                } finally {
                    Evaluation eval = context.popEvaluation();

                    eval.setResult(result);
                    if (evalException != null)
                    {
                        eval.setException(evalException);
                    }
                    if ((evalException == null) && (context.getRootEvaluation() == null) && !context.getKeepLastEvaluation())
                    {
                        pool.recycleAll(eval);
                    }
                }
                return(result);
            }
            else
            {
                return(evaluateGetValueBody(context, source));
            }
        }
Exemple #2
0
        public void setValue(OgnlContext context, object target, object value)
        {
            if (context.getTraceEvaluations())
            {
                EvaluationPool pool          = OgnlRuntime.getEvaluationPool();
                Exception      evalException = null;
                Evaluation     evaluation    = pool.create(this, target, true);

                context.pushEvaluation(evaluation);
                try {
                    evaluateSetValueBody(context, target, value);
                } catch (OgnlException ex) {
                    evalException = ex;
                    ex.setEvaluation(evaluation);
                    throw ex;
                } catch (Exception ex) {
                    evalException = ex;
                    throw ex;
                } finally {
                    Evaluation eval = context.popEvaluation();

                    if (evalException != null)
                    {
                        eval.setException(evalException);
                    }
                    if ((evalException == null) && (context.getRootEvaluation() == null) && !context.getKeepLastEvaluation())
                    {
                        pool.recycleAll(eval);
                    }
                }
            }
            else
            {
                evaluateSetValueBody(context, target, value);
            }
        }