Help with vector problem
- From: Petterson Mikael <mikael.petterson@xxxxxxxxxxxxxxx>
- Date: Thu, 27 Apr 2006 13:28:32 +0200
Hi,
We get an java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1 on the following line:
Object tmp = moDataTable.get(i + 1);
The following trace:
System.out.println("MAX:moDataTable is empty");
does not show on the console so it is not empty and it should not enter the loop.
Any ideas what could be wrong?
cheers,
//mikael
My code:
private Vector moDataTable;
public synchronized void add(Object moData) {
if ((moData != null) && (moData instanceof MoData)) {
for (int i = 0; i < moDataTable.size(); i++) {
if (moDataTable.isEmpty()) {
System.out.println("MAX:moDataTable is empty");
}
Object tmp = moDataTable.get(i + 1);
if (tmp instanceof MoData) {
if (((MoData) tmp).getLocalDistinguishedName().equals(((MoData)
moData)
.getLocalDistinguishedName())) {
System.out.println("WARNING!!: there was attempt to add MoData with duplicate LDN, ignoring, "
+ ((MoData) moData)
.getLocalDistinguishedName());
return;
}
}
}
}
}
.
- Follow-Ups:
- Re: Help with vector problem
- From: Mark Thomas
- Re: Help with vector problem
- From: Philipp Leitner
- Re: Help with vector problem
- From: Bart Cremers
- Re: Help with vector problem
- Prev by Date: Java Developers in Durham
- Next by Date: Re: Help with vector problem
- Previous by thread: Java Developers in Durham
- Next by thread: Re: Help with vector problem
- Index(es):