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

NPE in Decimalbox.setValue(String)

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      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)

          People

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

            Dates

            • Created:
              Updated: