Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3698

NPE in Decimalbox.setValue(String)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 8.5.0
    • Fix Version/s: 8.5.2
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
    • gh.sprint.customfield.default.name:
      ZK 8.5.2 S1

      Description

      I've managed to pass a null String to org.zkoss.lang.reflect.Fields.set() which causes this.setValue(new BigDecimal(str)); in Decimalbox.setValue(String) to throw an NPE.

      I think the correct code is:

      	public void setValue(String str){
      		this.setValue(str == null ? ((BigDecimal)null) : new BigDecimal(str));
      	}
      

        Activity

        Hide
        digulla digulla added a comment -

        Stack trace:

        java.lang.NullPointerException
           at java.math.BigDecimal.<init>(BigDecimal.java:806)
           at org.zkoss.zul.Decimalbox.setValue(Decimalbox.java:87)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:497)
           at org.zkoss.lang.reflect.Fields.set(Fields.java:153)
           at org.zkoss.bind.impl.PropertyExpression.setValue(PropertyExpression.java:77)
           at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:88)
           at org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:133)
        
        Show
        digulla digulla added a comment - Stack trace: java.lang.NullPointerException at java.math.BigDecimal.<init>(BigDecimal.java:806) at org.zkoss.zul.Decimalbox.setValue(Decimalbox.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.zkoss.lang.reflect.Fields.set(Fields.java:153) at org.zkoss.bind.impl.PropertyExpression.setValue(PropertyExpression.java:77) at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:88) at org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:133)
        Hide
        JamesChu JamesChu added a comment -

        Fixed since 2018/05/22

        Show
        JamesChu JamesChu added a comment - Fixed since 2018/05/22

          People

          • Assignee:
            rudyhuang rudyhuang
            Reporter:
            digulla digulla
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 4 hours Original Estimate - 4 hours
              4h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 5 hours
              5h

                Agile