InQBarna / TableFixHeaders

Android library that implements a table with fixed headers.
Apache License 2.0
818 stars 300 forks source link

IndexOutOfBoundException is thrown while adding values to ArrayList in Java #110

Open Gurunathan5029 opened 7 years ago

Gurunathan5029 commented 7 years ago

Here I am trying to get the row values from database and adding it to the ArrayList. The values are getting added without any error but the exception is thrown at the end of the loop.

Code: public ArrayList retrievelist(String database, String field, String table) { Statement statement; try {
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); String exten = ".dbo."; String query = "select " + "" + field + "" + " from " + "[" + database + "]" + "" + exten + "" + "[" + table

Output: lotto
Jasonhhhhhhhhhhhhhhhhhhhhhhhhh336 Jasonhhhhhhhhhhhhhhhhhhhhhhhhh Pamela 337 Pamela
[main] INFO net.serenitybdd.core.Serenity - STEP ERROR: java.lang.IndexOutOfBoundsException: Index: 338, Size: 338 [main] INFO net.serenitybdd.core.Serenity - STEP ERROR: java.lang.IndexOutOfBoundsException: Index: 338, Size: 338 [main] INFO net.serenitybdd.core.Serenity - FINISHING STEP [main] ERROR net.serenitybdd.core.Serenity -


/ / | _| __/ __| | | / \ | | | | _| \ ()____| | | | | | \ \ | | | | / \ | || | | | | | | | |__| | | | | | ) || | | / __ \ | || || || || | () | | || ||/ || ||// __|||___/ \\

TEST FAILED WITH ERROR: DB check

[main] ERROR net.serenitybdd.core.Serenity - TEST FAILED AT STEP DB retrievelist: FIRSTNAME, Guru, EMPLOYEE [main] ERROR net.serenitybdd.core.Serenity - Index: 338, Size: 338

Failed scenarios: debug.feature:46 # Scenario Outline: DBCheck

4 Scenarios (1 failed, 3 passed) 26 Steps (1 failed, 25 passed) 2m10.323s

java.lang.IndexOutOfBoundsException: Index: 338, Size: 338 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at net.thucydides.showcase.cucumber.webdriverclasses.SQLSupportClass.retrievelist(SQLSupportClass.java:42)

Working around this for quite some time but never got the solution. Help me out with suggestions and answers

BraisGabin commented 7 years ago

How is this related with TableFixHeaders? Use StackOverflow.