java.lang.IndexOutOfBoundsException: Index: 9, Size: 9

ZK-Tracker | hawk | 4 years ago
  1. 0

    h2. Reproducing Steps: There are two different exceptions thrown in the same zul and ViewModel (in the attachment). h3. prepare to reproduce: # download the attachment # correct package name and import statement to no compilation error # check zul's ViewModel name and run it h3. 1. Add Issue # enter some value in the textbox # click "Add" button # Null pointer exception is thrown as follows: {code} 嚴重的: >>java.lang.NullPointerException >> at org.zkoss.zul.Listbox.setSelectedIndex(Listbox.java:929) >> at org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2531) >> at org.zkoss.zul.Listbox.access$800(Listbox.java:261) >> at org.zkoss.zul.Listbox$4.onChange(Listbox.java:461) >> at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:61) >> at org.zkoss.zul.ListModelList.fireSelectionEvent(ListModelList.java:438) >> at org.zkoss.zul.AbstractListModel.addToSelection(AbstractListModel.java:130) >> at org.zkoss.bind.converter.sys.ListboxSelectedItemConverter.coerceToUi(ListboxSelectedItemConverter.java:48) >> at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:74) >> at org.zkoss.bind.impl.BinderImpl.loadOnPropertyChange(BinderImpl.java:360) >> at org.zkoss.bind.impl.BinderImpl.access$100(BinderImpl.java:98) >> at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:278) >> at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145) >> at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2739) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2710) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2651) >> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) >> at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710) >> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495) >> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) >> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) >> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) >> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) >> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) >> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) >> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >> at org.mortbay.jetty.Server.handle(Server.java:326) >> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) >> at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) >> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) >> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) >> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) >> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) >> at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) {code} h4.Initial Observation # This issue only happens under "paging" mold instead of "default" mold # add a statenent {{pickedItem = new Item();}} after adding to list will eliminate the exception. # move "itemList" in front of "pickedItem" in {{@NotifyChange}} can eliminate NullPointerException h4.Incomplete Reproducing Case This a incomplete page that I tried to reproduce the issue under MVC but no succeeded. {code:xml} <zk> <div width="400px" > <listbox id="listbox" mold="paging" pageSize="10"> <listhead> <listheader label="name" /> </listhead> <template name="model" > <listitem> <listcell label="${each}" /> </listitem> </template> </listbox> <button label="Phase1" onClick="phase1()"/> <button label="Phose2" onClick="phase2()"/> </div> <zscript><![CDATA[ List itemList = new LinkedList(); for (int i= 0 ; i < 10 ; i ++){ itemList.add("item "+i); } ListModelList listModelList = new ListModelList(itemList); listbox.setModel(listModelList); String t = "item 10"; public void phase1(){ listModelList.addSelection(t); } public void phase2(){ itemList.add(t); listModelList.addSelection(t); listModelList = new ListModelList(itemList); listModelList.addSelection(t); listbox.setModel(listModelList); } ]]> </zscript> </zk> {code} h3.2. Delete Issue # select last item, click "Delete" # an exception thrown as follows: {code} 嚴重的: >>java.lang.IndexOutOfBoundsException: Index: 9, Size: 9 >> at java.util.LinkedList.entry(LinkedList.java:368) >> at java.util.LinkedList.get(LinkedList.java:313) >> at org.zkoss.zul.ListModelList.getElementAt(ListModelList.java:150) >> at org.zkoss.zul.Listbox.doSelectionChanged(Listbox.java:2580) >> at org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2534) >> at org.zkoss.zul.Listbox.access$800(Listbox.java:261) >> at org.zkoss.zul.Listbox$4.onChange(Listbox.java:461) >> at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:61) >> at org.zkoss.zul.ListModelList.fireSelectionEvent(ListModelList.java:438) >> at org.zkoss.zul.AbstractListModel.addToSelection(AbstractListModel.java:130) >> at org.zkoss.bind.converter.sys.ListboxSelectedItemConverter.coerceToUi(ListboxSelectedItemConverter.java:48) >> at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:74) >> at org.zkoss.bind.impl.BinderImpl.loadOnPropertyChange(BinderImpl.java:360) >> at org.zkoss.bind.impl.BinderImpl.access$100(BinderImpl.java:98) >> at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:278) >> at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145) >> at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2739) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2710) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2651) >> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) >> at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710) >> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495) >> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) >> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) >> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) >> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) >> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) >> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) >> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >> at org.mortbay.jetty.Server.handle(Server.java:326) >> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) >> at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) >> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) >> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) >> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) >> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) >> at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) {code} h4. Initial Observation: # This issue only happens under both "paging" and "default" mold # add a statement {{pickedItem = null;}} after deletion will eliminate the exception. But use a statement {{pickedItem = new Item()}} still cause the exception. # move "itemList" in front of "pickedItem" in @NotifyChange can eliminate the exception, like {{@NotifyChange({"itemList","pickedItem"})}}

    ZK-Tracker | 4 years ago | hawk
    java.lang.IndexOutOfBoundsException: Index: 9, Size: 9
  2. 0

    h2. Reproducing Steps: There are two different exceptions thrown in the same zul and ViewModel (in the attachment). h3. prepare to reproduce: # download the attachment # correct package name and import statement to no compilation error # check zul's ViewModel name and run it h3. 1. Add Issue # enter some value in the textbox # click "Add" button # Null pointer exception is thrown as follows: {code} 嚴重的: >>java.lang.NullPointerException >> at org.zkoss.zul.Listbox.setSelectedIndex(Listbox.java:929) >> at org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2531) >> at org.zkoss.zul.Listbox.access$800(Listbox.java:261) >> at org.zkoss.zul.Listbox$4.onChange(Listbox.java:461) >> at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:61) >> at org.zkoss.zul.ListModelList.fireSelectionEvent(ListModelList.java:438) >> at org.zkoss.zul.AbstractListModel.addToSelection(AbstractListModel.java:130) >> at org.zkoss.bind.converter.sys.ListboxSelectedItemConverter.coerceToUi(ListboxSelectedItemConverter.java:48) >> at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:74) >> at org.zkoss.bind.impl.BinderImpl.loadOnPropertyChange(BinderImpl.java:360) >> at org.zkoss.bind.impl.BinderImpl.access$100(BinderImpl.java:98) >> at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:278) >> at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145) >> at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2739) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2710) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2651) >> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) >> at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710) >> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495) >> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) >> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) >> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) >> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) >> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) >> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) >> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >> at org.mortbay.jetty.Server.handle(Server.java:326) >> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) >> at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) >> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) >> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) >> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) >> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) >> at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) {code} h4.Initial Observation # This issue only happens under "paging" mold instead of "default" mold # add a statenent {{pickedItem = new Item();}} after adding to list will eliminate the exception. # move "itemList" in front of "pickedItem" in {{@NotifyChange}} can eliminate NullPointerException h4.Incomplete Reproducing Case This a incomplete page that I tried to reproduce the issue under MVC but no succeeded. {code:xml} <zk> <div width="400px" > <listbox id="listbox" mold="paging" pageSize="10"> <listhead> <listheader label="name" /> </listhead> <template name="model" > <listitem> <listcell label="${each}" /> </listitem> </template> </listbox> <button label="Phase1" onClick="phase1()"/> <button label="Phose2" onClick="phase2()"/> </div> <zscript><![CDATA[ List itemList = new LinkedList(); for (int i= 0 ; i < 10 ; i ++){ itemList.add("item "+i); } ListModelList listModelList = new ListModelList(itemList); listbox.setModel(listModelList); String t = "item 10"; public void phase1(){ listModelList.addSelection(t); } public void phase2(){ itemList.add(t); listModelList.addSelection(t); listModelList = new ListModelList(itemList); listModelList.addSelection(t); listbox.setModel(listModelList); } ]]> </zscript> </zk> {code} h3.2. Delete Issue # select last item, click "Delete" # an exception thrown as follows: {code} 嚴重的: >>java.lang.IndexOutOfBoundsException: Index: 9, Size: 9 >> at java.util.LinkedList.entry(LinkedList.java:368) >> at java.util.LinkedList.get(LinkedList.java:313) >> at org.zkoss.zul.ListModelList.getElementAt(ListModelList.java:150) >> at org.zkoss.zul.Listbox.doSelectionChanged(Listbox.java:2580) >> at org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2534) >> at org.zkoss.zul.Listbox.access$800(Listbox.java:261) >> at org.zkoss.zul.Listbox$4.onChange(Listbox.java:461) >> at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:61) >> at org.zkoss.zul.ListModelList.fireSelectionEvent(ListModelList.java:438) >> at org.zkoss.zul.AbstractListModel.addToSelection(AbstractListModel.java:130) >> at org.zkoss.bind.converter.sys.ListboxSelectedItemConverter.coerceToUi(ListboxSelectedItemConverter.java:48) >> at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:74) >> at org.zkoss.bind.impl.BinderImpl.loadOnPropertyChange(BinderImpl.java:360) >> at org.zkoss.bind.impl.BinderImpl.access$100(BinderImpl.java:98) >> at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:278) >> at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145) >> at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2739) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2710) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2651) >> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) >> at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710) >> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495) >> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) >> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) >> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) >> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) >> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) >> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) >> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >> at org.mortbay.jetty.Server.handle(Server.java:326) >> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) >> at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) >> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) >> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) >> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) >> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) >> at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) {code} h4. Initial Observation: # This issue only happens under both "paging" and "default" mold # add a statement {{pickedItem = null;}} after deletion will eliminate the exception. But use a statement {{pickedItem = new Item()}} still cause the exception. # move "itemList" in front of "pickedItem" in @NotifyChange can eliminate the exception, like {{@NotifyChange({"itemList","pickedItem"})}}

    ZK-Tracker | 4 years ago | hawk
    java.lang.IndexOutOfBoundsException: Index: 9, Size: 9
  3. 0

    Not sure it is out of spec or ZK should tolerate this. {code} <zk> <label multiline="true"> Issue : get IndexOutOfBoundsException 1.click select, it will select last one 2.click delete, it will remove last one (get exception here if bug doesn't fixed) </label> <div width="400px" > <listbox id="listbox" mold="paging" pageSize="10"> <listhead> <listheader label="name" /> </listhead> <template name="model" > <listitem> <listcell label="${each.name}" /> </listitem> </template> </listbox> <button label="select" onClick="select()"/> <button label="delete" onClick="delete()"/> </div> <zscript><![CDATA[ //set to false will avoid it, //however MVVM use liveModel.. boolean useLive = true; class Item { String name; public Item() { } public Item(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } } List itemList = new LinkedList(); for (int i = 0; i < 10; i++) { itemList.add(new Item("item " + i)); } ListModelList listModelList = new ListModelList(itemList,true);//if use live list listbox.setModel(listModelList); Item selected; public void select(){ listModelList.addToSelection(selected = itemList.get(itemList.size()-1)); } public void delete(){ //remove selected for original list itemList.remove(selected); //make a non existed object into selection selected = new Item("A"); listModelList.addToSelection(selected); //update the model listbox.setModel(listModelList = new ListModelList(itemList,true)); } ]]> </zscript> </zk> {code} >>java.lang.IndexOutOfBoundsException: Index: 9, Size: 9 >> at java.util.LinkedList.entry(LinkedList.java:365) >> at java.util.LinkedList.get(LinkedList.java:315) >> at org.zkoss.zul.ListModelList.getElementAt(ListModelList.java:150) >> at org.zkoss.zul.Listbox.doSelectionChanged(Listbox.java:2580) >> at org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2534) >> at org.zkoss.zul.Listbox.access$17(Listbox.java:2521) >> at org.zkoss.zul.Listbox$4.onChange(Listbox.java:461) >> at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:61) >> at org.zkoss.zul.ListModelList.fireSelectionEvent(ListModelList.java:438) >> at org.zkoss.zul.AbstractListModel.addToSelection(AbstractListModel.java:130) >> 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) >> at bsh.Reflect.invokeMethod(Unknown Source) >> at bsh.Reflect.invokeObjectMethod(Unknown Source) >> at bsh.Name.invokeMethod(Unknown Source) >> at bsh.BSHMethodInvocation.eval(Unknown Source) >> at bsh.BSHPrimaryExpression.eval(Unknown Source) >> at bsh.BSHPrimaryExpression.eval(Unknown Source) >> at bsh.BSHBlock.evalBlock(Unknown Source) >> at bsh.BSHBlock.eval(Unknown Source) >> at bsh.BshMethod.invokeImpl(Unknown Source) >> at bsh.BshMethod.invoke(Unknown Source) >> at bsh.BshMethod.invoke(Unknown Source) >> at bsh.Name.invokeLocalMethod(Unknown Source) >> at bsh.Name.invokeMethod(Unknown Source) >> at bsh.BSHMethodInvocation.eval(Unknown Source) >> at bsh.BSHPrimaryExpression.eval(Unknown Source) >> at bsh.BSHPrimaryExpression.eval(Unknown Source) >> at bsh.Interpreter.eval(Unknown Source) >> at bsh.Interpreter.eval(Unknown Source) >> at org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:131) >> at org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:328) >> at org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:875) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2701) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654) >> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) >> at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710) >> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495) >> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) >> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) >> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) >> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) >> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) >> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) >> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >> at org.mortbay.jetty.Server.handle(Server.java:326) >> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) >> at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) >> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) >> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) >> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) >> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) >> at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

    ZK-Tracker | 4 years ago | dennis
    java.lang.IndexOutOfBoundsException: Index: 9, Size: 9
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Not sure it is out of spec or ZK should tolerate this. {code} <zk> <label multiline="true"> Issue : get IndexOutOfBoundsException 1.click select, it will select last one 2.click delete, it will remove last one (get exception here if bug doesn't fixed) </label> <div width="400px" > <listbox id="listbox" mold="paging" pageSize="10"> <listhead> <listheader label="name" /> </listhead> <template name="model" > <listitem> <listcell label="${each.name}" /> </listitem> </template> </listbox> <button label="select" onClick="select()"/> <button label="delete" onClick="delete()"/> </div> <zscript><![CDATA[ //set to false will avoid it, //however MVVM use liveModel.. boolean useLive = true; class Item { String name; public Item() { } public Item(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } } List itemList = new LinkedList(); for (int i = 0; i < 10; i++) { itemList.add(new Item("item " + i)); } ListModelList listModelList = new ListModelList(itemList,true);//if use live list listbox.setModel(listModelList); Item selected; public void select(){ listModelList.addToSelection(selected = itemList.get(itemList.size()-1)); } public void delete(){ //remove selected for original list itemList.remove(selected); //make a non existed object into selection selected = new Item("A"); listModelList.addToSelection(selected); //update the model listbox.setModel(listModelList = new ListModelList(itemList,true)); } ]]> </zscript> </zk> {code} >>java.lang.IndexOutOfBoundsException: Index: 9, Size: 9 >> at java.util.LinkedList.entry(LinkedList.java:365) >> at java.util.LinkedList.get(LinkedList.java:315) >> at org.zkoss.zul.ListModelList.getElementAt(ListModelList.java:150) >> at org.zkoss.zul.Listbox.doSelectionChanged(Listbox.java:2580) >> at org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2534) >> at org.zkoss.zul.Listbox.access$17(Listbox.java:2521) >> at org.zkoss.zul.Listbox$4.onChange(Listbox.java:461) >> at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:61) >> at org.zkoss.zul.ListModelList.fireSelectionEvent(ListModelList.java:438) >> at org.zkoss.zul.AbstractListModel.addToSelection(AbstractListModel.java:130) >> 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) >> at bsh.Reflect.invokeMethod(Unknown Source) >> at bsh.Reflect.invokeObjectMethod(Unknown Source) >> at bsh.Name.invokeMethod(Unknown Source) >> at bsh.BSHMethodInvocation.eval(Unknown Source) >> at bsh.BSHPrimaryExpression.eval(Unknown Source) >> at bsh.BSHPrimaryExpression.eval(Unknown Source) >> at bsh.BSHBlock.evalBlock(Unknown Source) >> at bsh.BSHBlock.eval(Unknown Source) >> at bsh.BshMethod.invokeImpl(Unknown Source) >> at bsh.BshMethod.invoke(Unknown Source) >> at bsh.BshMethod.invoke(Unknown Source) >> at bsh.Name.invokeLocalMethod(Unknown Source) >> at bsh.Name.invokeMethod(Unknown Source) >> at bsh.BSHMethodInvocation.eval(Unknown Source) >> at bsh.BSHPrimaryExpression.eval(Unknown Source) >> at bsh.BSHPrimaryExpression.eval(Unknown Source) >> at bsh.Interpreter.eval(Unknown Source) >> at bsh.Interpreter.eval(Unknown Source) >> at org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:131) >> at org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:328) >> at org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:875) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2701) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654) >> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) >> at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710) >> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495) >> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) >> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) >> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) >> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) >> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) >> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) >> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >> at org.mortbay.jetty.Server.handle(Server.java:326) >> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) >> at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) >> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) >> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) >> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) >> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) >> at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

    ZK-Tracker | 4 years ago | dennis
    java.lang.IndexOutOfBoundsException: Index: 9, Size: 9
  6. 0

    powermock generated JUnit 3 suites

    Google Groups | 7 years ago | Joe Kearney
    java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

  1. tyson925 4 times, last 6 months ago
6 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IndexOutOfBoundsException

    Index: 9, Size: 9

    at java.util.LinkedList.entry()
  2. Java RT
    LinkedList.get
    1. java.util.LinkedList.entry(LinkedList.java:368)
    2. java.util.LinkedList.get(LinkedList.java:313)
    2 frames
  3. ZK XUL Components
    AbstractListModel.addToSelection
    1. org.zkoss.zul.ListModelList.getElementAt(ListModelList.java:150)
    2. org.zkoss.zul.Listbox.doSelectionChanged(Listbox.java:2580)
    3. org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2534)
    4. org.zkoss.zul.Listbox.access$800(Listbox.java:261)
    5. org.zkoss.zul.Listbox$4.onChange(Listbox.java:461)
    6. org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:61)
    7. org.zkoss.zul.ListModelList.fireSelectionEvent(ListModelList.java:438)
    8. org.zkoss.zul.AbstractListModel.addToSelection(AbstractListModel.java:130)
    8 frames
  4. ZK Bind
    BinderImpl$QueueListener.onEvent
    1. org.zkoss.bind.converter.sys.ListboxSelectedItemConverter.coerceToUi(ListboxSelectedItemConverter.java:48)
    2. org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:74)
    3. org.zkoss.bind.impl.BinderImpl.loadOnPropertyChange(BinderImpl.java:360)
    4. org.zkoss.bind.impl.BinderImpl.access$100(BinderImpl.java:98)
    5. org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:278)
    5 frames
  5. ZK Kernel
    DHtmlUpdateServlet.doPost
    1. org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145)
    2. org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2739)
    3. org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2710)
    4. org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2651)
    5. org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
    6. org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710)
    7. org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495)
    8. org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205)
    9. org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583)
    10. org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481)
    11. org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489)
    11 frames
  6. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    2. javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    2 frames
  7. Jetty Server
    SelectChannelEndPoint.run
    1. org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    2. org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
    3. org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    4. org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    5. org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
    6. org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
    7. org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    8. org.mortbay.jetty.Server.handle(Server.java:326)
    9. org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    10. org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
    11. org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
    12. org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    13. org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    14. org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
    14 frames
  8. Jetty Util
    QueuedThreadPool$PoolThread.run
    1. org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
    1 frame