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

Don't set values to map with integer keys

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Not A Problem
    • None
    • None
    • Core Runtime
    • None

    Description

      import com.opensymphony.xwork2.util.OgnlValueStack;

      import java.util.Map;

      import java.util.HashMap;

      /**

      • Created by IntelliJ IDEA.
      • User: vladimir
      • Date: 28.09.2007
      • Time: 12:04:57

      */

      public class OGNLDebug {

      public static void main(String[] argv)

      { Result result = new Result(); OgnlValueStack stack = new OgnlValueStack(); stack.push(result); stack.setValue("key", "1"); stack.setValue("map[key]", "test failed"); stack.setValue("key2", "2"); stack.setValue("map[key2]", "test success"); System.out.println("key: " + result.getKey() ); System.out.println("map[key]: " + result.getMap().get(result.getKey()) ); // result is null System.out.println("key2: " + result.getKey2() ); System.out.println("map[key2]: " + result.getMap().get(result.getKey2()) ); // result is "test success" }

      }

      class Result {

      private Map map = new HashMap();

      private Integer key;

      private String key2;

      public Result() {

      }

      public Map getMap()

      { return map; }

      public void setMap(Map map)

      { this.map = map; }

      public Integer getKey()

      { return key; }

      public void setKey(Integer key)

      { this.key = key; }

      public String getKey2()

      { return key2; }

      public void setKey2(String key2)

      { this.key2 = key2; }

      }

      Attachments

        Activity

          People

            jkuhnert Jesse Kuhnert
            vladimir.balandin Vladimir A. Balandin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: