java.lang.ArrayIndexOutOfBoundsException: 2

ZK-Tracker | RichardL | 5 years ago
  1. 0

    See these forum threads for more: http://www.zkoss.org/forum/listComment/18519-Setter-for-data-in-SimpleListModel and http://www.zkoss.org/forum/listComment/18504-Autocomplete-Combobox-with-huge-data-in-MVVM I've got an auto complete combobox with a custom model that extends SimpleListModel. To get my sublist for the auto complete I override getSubModel(Object obj, int nRows). I am setting the model with an empty list to start and then fetching from the database for each submodel (the data is huge, so this way is more efficient). I also have a renderer which sets both a label and a value to each combitem. I have an onChange event listener in the combobox where I want to get the value of the comboitem (not the label - I know I could just get that by getting the value of the combobox): this.addEventListener("onChange", new EventListener() { public void onEvent(Event e) throws Exception { Executions.sendRedirect("index.zul?bun=" + FindUsersAutoCompleteCombo.this.getSelectedItem().getValue()); } }); The trouble is, the getSubModel method doesn't update the data in SimpleListModel, so when I try to get the value of the comboitem I get this error (remember, I started out with an empty list in the model, and it hasn't been updated): SEVERE: java.lang.ArrayIndexOutOfBoundsException: 2 at org.zkoss.zul.SimpleListModel.getElementAt(SimpleListModel.java:92) at org.zkoss.zul.Combobox.syncSelectionToModel(Combobox.java:609) This could be solved simply with a setter for data in SimpleListModel, so the data can be updated in the getSubModel method. Thanks!

    ZK-Tracker | 5 years ago | RichardL
    java.lang.ArrayIndexOutOfBoundsException: 2
  2. 0

    See these forum threads for more: http://www.zkoss.org/forum/listComment/18519-Setter-for-data-in-SimpleListModel and http://www.zkoss.org/forum/listComment/18504-Autocomplete-Combobox-with-huge-data-in-MVVM I've got an auto complete combobox with a custom model that extends SimpleListModel. To get my sublist for the auto complete I override getSubModel(Object obj, int nRows). I am setting the model with an empty list to start and then fetching from the database for each submodel (the data is huge, so this way is more efficient). I also have a renderer which sets both a label and a value to each combitem. I have an onChange event listener in the combobox where I want to get the value of the comboitem (not the label - I know I could just get that by getting the value of the combobox): this.addEventListener("onChange", new EventListener() { public void onEvent(Event e) throws Exception { Executions.sendRedirect("index.zul?bun=" + FindUsersAutoCompleteCombo.this.getSelectedItem().getValue()); } }); The trouble is, the getSubModel method doesn't update the data in SimpleListModel, so when I try to get the value of the comboitem I get this error (remember, I started out with an empty list in the model, and it hasn't been updated): SEVERE: java.lang.ArrayIndexOutOfBoundsException: 2 at org.zkoss.zul.SimpleListModel.getElementAt(SimpleListModel.java:92) at org.zkoss.zul.Combobox.syncSelectionToModel(Combobox.java:609) This could be solved simply with a setter for data in SimpleListModel, so the data can be updated in the getSubModel method. Thanks!

    ZK-Tracker | 5 years ago | RichardL
    java.lang.ArrayIndexOutOfBoundsException: 2
  3. 0

    Error handling when reading from txt file

    Stack Overflow | 4 weeks ago | Buupu
    java.lang.ArrayIndexOutOfBoundsException: 2
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    migrating jsf1.1 to jsf1.1_02

    Oracle Community | 8 years ago | 843844
    java.lang.ArrayIndexOutOfBoundsException: 2

    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.ArrayIndexOutOfBoundsException

      2

      at org.zkoss.zul.SimpleListModel.getElementAt()
    2. ZK XUL Components
      Combobox.syncSelectionToModel
      1. org.zkoss.zul.SimpleListModel.getElementAt(SimpleListModel.java:92)
      2. org.zkoss.zul.Combobox.syncSelectionToModel(Combobox.java:609)
      2 frames