Optional block in jelly has inconsistent behaviour when translated to JSON

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      // code placeholder
      

      When using an optional block in jelly configuration files, if the checkbox is not checked in the UI, when sent in the Stapler request, sometimes translates to an empty JSON object some other times in a String.

      Example: given the following optional block

      <f:optionalBlock name="enable" title="${%Enable}" checked="${instance != null and instance.count != null}">

      belonging to the java com.example.Property.java class, if it's not checked in the UI, the stapler request can either receive a JSON containing

       

      "com.example.Property":{}}" 
      

      or

      com-example-Property":{"enable":false}

       

       

      When you submit the form, you will get an error like

      JSONObject["someField"] is not a JSONObject

       

            Assignee:
            Unassigned
            Reporter:
            valentina armenise
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: