error when saving in a vector the values of a Select

0

I am trying to save the values of a Select in a vector, but the error appears java.lang.ArrayIndexOutOfBoundsException: 0> = 0

    
asked by Eze Cufre 16.06.2018 в 09:40
source

1 answer

1

The problem is that you have an empty vector (users). Instances on line 131 but have nothing inside. When you try to access any position it will give you null because the size of the vector is 0. Better do something like this in the while:

Usuario u = new Usuario();
u.setCodigo(...);
...

usuarios.add(i, u);

i++;

In this way you first create the user and then add it to the vector.

    
answered by 16.06.2018 в 11:28