java.lang.IndexOutOfBoundsException error

Help
Jeff Ross
2012-05-21
2016-12-26
  • Jeff Ross

    Jeff Ross - 2012-05-21

    I've been running schema spy for over a year and mid-April it suddenly began hanging.  When I run it from the console I get this on the screen:

    Gathering schema details………………………Exception in thread "Thread-171" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
            at java.util.ArrayList.rangeCheck(ArrayList.java:604)
            at java.util.ArrayList.get(ArrayList.java:382)
            at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1689)
            at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
            at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
            at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
            at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
            at org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData.fetchFieldMetaData(AbstractJdbc2ResultSetMetaData.java:240)
            at org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData.isAutoIncrement(AbstractJdbc2ResultSetMetaData.java:61)
            at net.sourceforge.schemaspy.model.Table.initColumnAutoUpdate(Table.java:338)
            at net.sourceforge.schemaspy.model.Table.initColumns(Table.java:303)
            at net.sourceforge.schemaspy.model.Table.<init>(Table.java:88)
            at net.sourceforge.schemaspy.model.Database$TableCreator.createImpl(Database.java:1003)
            at net.sourceforge.schemaspy.model.Database$ThreadedTableCreator$1.run(Database.java:1044)

    A ktrace also shows this immediately prior to the exception:

    3358 java     GIO   fd 7 read 131 bytes
           "E\0\0\0\M^BSERROR\0C08P01\0Mbind message supplies 1 parameters, but prepared statement "" requires 0\0Fpostgres.c\0L1493\0Rexec_bind_message\0\0"

    If I run the last query logged from psql it runs just fine.

    SchemaSpy 5.0.0, OpenBSD -current.

    I'm calling schemaspy with this:

    /usr/local/jdk-1.7.0/bin/java \
      -Djava.net.preferIPv4Stack=true \
      -jar /home/jross/schemaSpy_5.0.0.jar \
      -t pgsql \
      -db wykids  \
      -s public \
      -dp /usr/local/share/postgresql/java/postgresql.jar \
      -u _postgresql \
      -host dukkha.internal \
      -o /var/www/stars/system_documentation/schemaspy/ \
      -gv /usr/local/

    and as I said earlier, this has been working for at least a year.

    Any help would be greatly appreciated!

    Jeff Ross

     
  • Gurunathan

    Gurunathan - 2016-12-26

    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<String> 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
    + "]
    ";
    ResultSet rs = statement.executeQuery(query);
    ArrayList<String> records = new ArrayList<String>();
    System.out.println("HIHIHI" + query);
    while(rs.next())
    {
    System.out.println(rs.getString(field) + records.size());
    records.add(rs.getString(field));
    System.out.println(records.get(records.size()-1));
    }
    return records;

        } catch (Exception exception) {
            exception.printStackTrace();
        } 
        return null;
    }
    

    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

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks