Permalink
Browse files

Fixing IndexOutOfBoundsException when handling BatchResults

  • Loading branch information...
1 parent a6494e3 commit 8dae896c2d3eabb691c842345a26f3c060ea891a @clamprecht clamprecht committed Jan 17, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/main/java/com/flaptor/indextank/apiclient/IndexTankClient.java
@@ -857,10 +857,11 @@ public BatchResults addDocuments(Iterable<Document> documents)
Boolean added = (Boolean) result.get("added");
addeds.add(i, added);
+ errors.add(i, null); // populate every index position to avoid IndexOutOfBoundsException below
if (!added) {
hasErrors = true;
- errors.add(i, (String) result.get("error"));
+ errors.set(i, (String) result.get("error"));
}
}

0 comments on commit 8dae896

Please sign in to comment.