I can't fix this: java.lang.ArrayIndexOutOfBoundsException
<p>When I try to run the following code I get a '<code>java.lang.ArrayIndexOutOfBoundsException</code>'</p>

<pre><code>ResultSet res = null;
    String[] waarden = new String[20];
    int length = 0;
    String query = "SELECT rd_datum, rd_locatie FROM racedag;";
    res = Database.executeSelectQuery(query);
    try{
        while (res.next()){
            int i = 1;
            waarden[i] = res.getString(1);
            i++;
            waarden[i] = res.getString(2);
            i++;
        }

        }
    catch (Exception e){
            }
    finally{
        length = waarden.length;
    }
    String eindWaarden[] = new String[length];
    for (int i = 0; i&lt;= length; i++){
        eindWaarden[i] = waarden[i];
    }
    return eindWaarden;
}
</code></pre>

<p>and I have no clue why.</p>
