Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-5217

new OgnlContext() is removed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • Expression Language
    • None

    Description

      We used the OGNL in our classes as below

       

      OgnlExpression ognlExpression = new OgnlExpression(expressionString);
      ognlExpression.getValue(new OgnlContext(), rootObject);

       

      The OgnlExpression is a simple wrapper.

       

       

      public class OgnlExpression{
          private Object expression;
          private static final Logger LOG = LoggerFactory.getLogger(OgnlExpression.class);
          public OgnlExpression( String expressionString )
              throws OgnlException
          {
              super();
              expression = Ognl.parseExpression( expressionString );
          }
          public Object getExpression()
          {
              return expression;
          }
          public Object getValue( OgnlContext context, Object rootObject )
              throws OgnlException
          {
              LOG.debug("parse the expression with OGNL");
              return Ognl.getValue( getExpression(), context, rootObject );
          }
          public void setValue( OgnlContext context, Object rootObject, Object value )
              throws OgnlException
          {
              Ognl.setValue(getExpression(), context, rootObject, value);
          }
      

       

      After upgrade to version 6, the `new OgnlContext()` constructor seems to be removed. I test the `new OgnlContext(null,null,null)` but got illegal argument exception.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            afattahi Alireza Fattahi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: