LinkedList大小为-1

问题描述 投票:0回答:1

我在Java 1.7项目中遇到此异常:

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: -1
   at java.util.LinkedList.checkPositionIndex(LinkedList.java:558) ~[na:1.7.0_251]
   at java.util.LinkedList.listIterator(LinkedList.java:865) ~[na:1.7.0_251]
   at java.util.AbstractList.listIterator(AbstractList.java:299) ~[na:1.7.0_251]
   at java.util.AbstractSequentialList.iterator(AbstractSequentialList.java:239) ~[na:1.7.0_251]
   at com.project.exceptions.handlers.JsfExceptionHandler.handle(JsfExceptionHandler.java:74) ~[project-0.0.1-SNAPSHOT.jar:na]
   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) ~[jsf-impl-2.1.13-redhat-1.jar!/:2.1.13-redhat-1]
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) ~[jsf-impl-2.1.13-redhat-1.jar!/:2.1.13-redhat-1]
   at org.springframework.faces.webflow.FlowLifecycle.render(FlowLifecycle.java:80) ~[spring-faces-2.3.2.RELEASE.jar:2.3.2.RELEASE]
   at org.springframework.faces.webflow.JsfView.render(JsfView.java:89) ~[spring-faces-2.3.2.RELEASE.jar:2.3.2.RELEASE]
   at org.springframework.webflow.engine.ViewState.render(ViewState.java:296) ~[spring-webflow-2.3.2.RELEASE.jar:2.3.2.RELEASE]
   at org.springframework.webflow.engine.ViewState.resume(ViewState.java:207) ~[spring-webflow-2.3.2.RELEASE.jar:2.3.2.RELEASE]
   at org.springframework.webflow.engine.Flow.resume(Flow.java:545) [spring-webflow-2.3.2.RELEASE.jar:2.3.2.RELEASE]
   at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:258) [spring-webflow-2.3.2.RELEASE.jar:2.3.2.RELEASE]
   ... 62 common frames omitted

但是我不知道在哪种情况下LinkedList的大小可能为-1,难道不是正数吗?有什么建议吗?

java indexoutofboundsexception
1个回答
0
投票

唯一想到的是链表是否通过网络传递,并且发送方在有效负载中将其大小显式设置为-1。

然后,端点将尝试通过反射将大小设置为-1,并可能成功。

但是是在黑暗中拍摄。

© www.soinside.com 2019 - 2024. All rights reserved.