java中我传递的对象不为空,可是调用对象的方法时报空指针,怎么回事?
Exceptioninthread"main"java.lang.NullPointerExceptionatjava.lang.Class.searchFields(U...
Exception in thread "main" java.lang.NullPointerException
at java.lang.Class.searchFields(Unknown Source)
at java.lang.Class.getDeclaredField(Unknown Source)
at com.thoughtworks.xstream.core.util.Fields.find(Fields.java:25)
at com.thoughtworks.xstream.mapper.AttributeMapper.getField(AttributeMapper.java:171)
at com.thoughtworks.xstream.mapper.AttributeMapper.addAttributeFor(AttributeMapper.java:167)
at com.thoughtworks.xstream.XStream.useAttributeFor(XStream.java:1085)
at com.flex.convert.TestConvert.useAttribute(TestConvert.java:84)
at com.flex.convert.TestConvert.formatSingleCon(TestConvert.java:136)
at com.flex.convert.TestConvert.convertXML(TestConvert.java:50)
at com.flex.convert.TestConvert.main(TestConvert.java:187)
这是怎么回事啊,搞了2个小时了都! 展开
at java.lang.Class.searchFields(Unknown Source)
at java.lang.Class.getDeclaredField(Unknown Source)
at com.thoughtworks.xstream.core.util.Fields.find(Fields.java:25)
at com.thoughtworks.xstream.mapper.AttributeMapper.getField(AttributeMapper.java:171)
at com.thoughtworks.xstream.mapper.AttributeMapper.addAttributeFor(AttributeMapper.java:167)
at com.thoughtworks.xstream.XStream.useAttributeFor(XStream.java:1085)
at com.flex.convert.TestConvert.useAttribute(TestConvert.java:84)
at com.flex.convert.TestConvert.formatSingleCon(TestConvert.java:136)
at com.flex.convert.TestConvert.convertXML(TestConvert.java:50)
at com.flex.convert.TestConvert.main(TestConvert.java:187)
这是怎么回事啊,搞了2个小时了都! 展开
若以下回答无法解决问题,邀请你更新回答
3个回答
展开全部
是不是LIST中压根就没数据啊
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你不把源码贴出来,你把错误信息贴出来有什么用啊!…
追问
刚把问题贴出来就找到原因了,list中添加的值有个是null的。我日了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你传进来的时候应该是空的!!!DEBUG一下看看。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询