SimpleNumberInputConstraint causes NPE

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Critical
    • None
    • Affects Version/s: 10.2.1
    • Component/s: None
    • Security Level: Jimmy
    • None
    • None

      Steps to Reproduce

      1. Run attached zul in 10.2.0 or later
      2. Select any of the inputs
      3. Delete value
      4. Click out of component

      Current Result

      java.lang.NullPointerException: null
      at java.lang.Integer.compareTo(Integer.java:1455) ~[?:?]
      at java.lang.Integer.compareTo(Integer.java:59) ~[?:?]
      at org.zkoss.zul.SimpleNumberInputConstraint.validate(SimpleNumberInputConstraint.java:133) ~[zul-10.2.1.jar:10.2.1]

      Expected Result

      No error

      Debug Information

      All NumberInput components now use SimpleNumberInputConstraint.
      During org.zkoss.zul.SimpleNumberInputConstraint.validate(Component, Object), value is cast as a Number type (Integer, Double, Long, etc.), which are not capable of receiving a null value.
      All ZK number input have null as a possible value, when no text is entered.
      This use case is considered under "not empty" constraints.

      Workaround

      attached org.zkoss.zul.SimpleNumberInputConstraint.validate override class, deploy under org.zkoss.zul

      old ticket below


      Steps to Reproduce

      https://zkfiddle.org/sample/28oc7o0/1-Another-new-ZK-fiddle
      set spinner value to 1
      click out, event occurs
      delete value from spinner
      click out

      Current Result

      Unknown exception: java.lang.NullPointerException.

      Expected Result

      No error

      Debug Information

      org.zkoss.zul.SimpleSpinnerConstraint
      doesn't account for spinner value being either int or null
      If value is null, causes nullpointer exception

      Workaround

      attached SimpleSpinnerConstraint, deploy under org.zkoss.zul

            Assignee:
            Unassigned
            Reporter:
            MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: