"positive-number" field validator accepts non valid java numbers

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

XMLWordPrintable

    • Jenkins 2.274 - released 5 Jan 2021 and 2.277.1

      if you have a field that is using `<f:number clazz="positive-number" min="1" step="1" />` you can submit a garbage number as far as java is concerned without any formvalidation warning.

      this is because javascript validation treats `e` as the matmatical constant e (2.7182......)

      so you can enter `e` `3e` or lots of this.

      however Jenkins will then parse this usign standard java terms and well - `e` is not valid here, so you get a number format exception.

      For example create a job and select "Discard old builds" and enter "e" as the "days to keep builds.
      observe there are no formvalidation errors and save the form
      reconfigure the job and not that the value is missing.

            Assignee:
            Benny Cheng
            Reporter:
            James Nord
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: