标签:mdt puts 数字 xxx except ctc stat use person
日志:
[INFO-2016/08/04/16/:21/:25]ProjectCommonFormController.(78) - 审批[同意]入参-[string]commonFormDtoStr ===={"commonForm":{"id":"1101115577946385"},"taskId":"322055","wfInstanceId":"1101115577859311","content":"","businessKey":"1101115577946385","projectId":"null","cityId":"null"} [ERROR-2016/08/04/16/:21/:25]XXXXFormController.(91) - 审批流程出错!For input string: "null" com.alibaba.fastjson.JSONException: For input string: "null" at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:467) at com.alibaba.fastjson.JSON.parseObject(JSON.java:206) at com.alibaba.fastjson.JSON.parseObject(JSON.java:166) at com.alibaba.fastjson.JSON.parseObject(JSON.java:287) at com.boa.weixin.controller.costmanager.expenses.ProjectCommonFormController.approvalCommonForm(ProjectCommonFormController.java:79) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606)
................... Caused by: java.lang.NumberFormatException: For input string: "null" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Long.parseLong(Long.java:441) at java.lang.Long.parseLong(Long.java:483) at com.alibaba.fastjson.util.TypeUtils.castToLong(TypeUtils.java:361) at com.alibaba.fastjson.parser.deserializer.LongFieldDeserializer.parseField(LongFieldDeserializer.java:44) at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer.parseField(ASMJavaBeanDeserializer.java:81) at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer$InnerJavaBeanDeserializer.parseField(ASMJavaBeanDeserializer.java:92) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:231) at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer.deserialze(ASMJavaBeanDeserializer.java:31) at Fastjson_ASM_CommonFormDto_67.deserialze(Unknown Source) at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:463)
package com.boa.test;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.DefaultConversionService;
/**
* Created by boa on 2016/8/4.
@desc 用于测试""串转Integer对象的转换异常问题
*/
public class ExceptionForInputStringNull {
public static void main(String[] args) {
Person p = new Person();
String str = "";
//spirng的转换器可以将""转换成Integer的null对象.
ConversionService cs = new DefaultConversionService();
Integer integer = cs.convert(str, Integer.class);
//自行去把""转换成integer对象会报异常
//Integer integer = Integer.valueOf(str);
//apache的转换类也不行
//org.apache.commons.beanutils.Converter con = new IntegerConverter();
//Integer integer = (Integer)con.convert(Integer.class, str);
p.setAge(integer);
System.out.println(p.getAge());
}
}
class Person {
Integer age;
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
}
NumberFormatException: For input string: "null"
标签:mdt puts 数字 xxx except ctc stat use person
原文地址:http://www.cnblogs.com/duenboa/p/6665349.html