Uploaded image for project: 'Commons OGNL (Dormant)'
  1. Commons OGNL (Dormant)
  2. OGNL-121

Race condition in SimpleNode#evaluateGetValueBody(OgnlContext, Object)

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.6.9
    • 2.7.2
    • None
    • None
    • Patch

    Description

      SimpleNode#evaluateGetValueBody(OgnlContext, Object) might return null.

      I have a patch that resolves the issue for version 2.6.9. Same issue might be in the above vesions.

       
      
      Index: C:/User/Work/workspace/ognl/src/java/ognl/SimpleNode.java
      
      ===================================================================
      
      --- C:/User/Work/workspace/ognl/src/java/ognl/SimpleNode.java	(revision 139)
      
      +++ C:/User/Work/workspace/ognl/src/java/ognl/SimpleNode.java	(working copy)
      
      @@ -44,7 +44,7 @@
      
           protected OgnlParser    parser;
      
       
      
           private boolean         constantValueCalculated;
      
      -    private boolean         hasConstantValue;
      
      +    private volatile boolean hasConstantValue;
      
           private Object          constantValue;
      
       
      
           public SimpleNode(int i) {
      
      @@ -162,10 +162,11 @@
      
               context.setCurrentNode(this);
      
               if (!constantValueCalculated) {
      
                   constantValueCalculated = true;
      
      -            hasConstantValue = isConstant(context);
      
      -            if (hasConstantValue) {
      
      +            boolean constant = isConstant(context);
      
      +            if (constant) {
      
                       constantValue = getValueBody(context, source);
      
                   }
      
      +            hasConstantValue = constant;
      
               }
      
               return hasConstantValue ? constantValue : getValueBody(context, source);
      
           }
      
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jkuhnert Jesse Kuhnert
            toshihiro.nakamura Toshihiro Nakamura
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment