Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-210

velocity 1.7 vs velocity 2.3 : the evaluation of if condition in script is different

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1
    • None
    • VelocityView
    • None

    Description

      script used : 

       
      Map<String, Object> variables = new HashMap<>();
      variables.put("key1", "value");
       
      Context context = velocityEngine.getToolsContext(variables);
       
      String inString = "#set($value = \"key value false\")" +
      "#if(${key1} == 1 ||\"yes\" )" +
      " #set($value = \"{}key value true{}\")" +
      "#end\n${value}";
       
      inString = velocityEngine.evaluate(context, "tag", inString);
      System.out.println(inString);
       
       
      Output:
       
      older version output : key value true
       
      newer version output : key value false 
       
       
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            ambika ambika
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: