这个问题有很多答案,我已经看到了。我有一直在工作的代码,但今天突然它开始java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
排队
return null == input.get(keyName) ? 0L : (long) input.get(keyName);
错误来自(long) input.get(keyName)
. 我想知道为什么它突然开始坏了。(long) input.get(keyName)
这对我来说看起来不错。我想这样做((Integer) input.get(keyName)).longValue()
,但java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
因为地图有时包含long
值。有什么建议么
堆栈跟踪:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long at accountservice.adapter.batch.testJob.SyncDriverPartitioner.getLongValueFromMap(SyncDriverPartitioner.java:78) ~[classes/:?] at accountservice.adapter.batch.testJob.SyncDriverPartitioner.partition(SyncDriverPartitioner.java:47) ~[classes/:?] at accountservice.adapter.batch.testJob.SyncDriverPartitioner$$FastClassBySpringCGLIB$$6f3315e4.invoke(<generated>) ~[classes/:?] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.18.RELEASE.jar:4.3.18.RELEASE]
偶然的你
汪汪一只猫
相关分类