我正在尝试将字符串转换为Double,如:
Double no_of_leaves_form=Double.parseDouble(leaveapplyform.getNo_of_leaves());
和数据库中NO_of_leaves的数据类型是varchar。
但我收到以下错误:
java.lang.NullPointerException
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:991)
at java.lang.Double.parseDouble(Double.java:510)
at com.dz.hrportal.worker.EmpLeaveApplyWorker.validateUser(EmpLeaveApplyWorker.java:42)
at com.dz.hrportal.controller.EmpLeaveApplyController.processForm(EmpLeaveApplyController.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
是否有人知道如何解决它。