Skip to content

Commit

Permalink
Catch IndexOutOfBoundsException in getXPathPath() method
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed Jul 31, 2019
1 parent 0ec67c9 commit 3e2c98c
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.util.ArrayList;
import java.util.List;

import timber.log.Timber;

public class AuditEvent {

public enum AuditEventType {
Expand Down Expand Up @@ -292,11 +294,15 @@ private static String getXPathPath(FormIndex formIndex) {
FormIndex walker = formIndex;
int i = 1;
while (walker != null) {
String currentNodeName = formIndex.getReference().getName(i);
if (walker.getInstanceIndex() != -1) {
currentNodeName = currentNodeName + "[" + (walker.getInstanceIndex() + 1) + "]";
try {
String currentNodeName = formIndex.getReference().getName(i);
if (walker.getInstanceIndex() != -1) {
currentNodeName = currentNodeName + "[" + (walker.getInstanceIndex() + 1) + "]";
}
nodeNames.add(currentNodeName);
} catch (IndexOutOfBoundsException e) {
Timber.i(e);
}
nodeNames.add(currentNodeName);

walker = walker.getNextLevel();
i++;
Expand Down

0 comments on commit 3e2c98c

Please sign in to comment.