ArrayIndexOutOfBoundsException: 1 >= 1 during a "while" statement...
hi,i'm getting an ArrayIndexOutOfBoundsException: 1 >= 1 in this method.
what this method does is receive an IP address from a multicast datagram packet,checks if the address is in the Vector elem,if not he puts it in,and if it's already there he substitutes the old infos with the new ones and wraps everything in a "Remote" object
something must be wrong in the while segment,but i can't find out....
boolean found = false
int c= 0;
synchronized(elem){
if(elem.size()>0){
while(c < elem.size() || found != true){
if(elem.elementAt(c).get_ind().equals(ip)){
elem.insertElementAt(new Remote(ip,data,num_svolti,media),c);
elem.removeElementAt(c+1);
found = true;
}
else c++;
}//END WHILE
if (found == false){
elem.add(new Remote(ip,data,num_svolti,media));
System.out.println("aggiunto nuovo remoto");
}
}
else {elem.add(new Remote(ip,data,num_svolti,media));System.out.println("new remote added");}
}
}

