Skip to content

Commit 9d24e09

Browse files
committed
integer detection for array access
1 parent 449c2f7 commit 9d24e09

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/edu/harvard/iq/dataverse/DatasetFieldServiceBean.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,13 @@ Object processPathSegment(int index, String[] pathParts, JsonValue curPath, Stri
764764
}
765765

766766
} else {
767-
curPath = ((JsonObject) curPath).get(pathParts[index]);
767+
try {
768+
int indexNumber = Integer.parseInt(pathParts[index]);
769+
curPath = ((JsonObject) curPath).get(indexNumber);
770+
} catch (NumberFormatException nfe) {
771+
curPath = ((JsonObject) curPath).get(pathParts[index]);
772+
}
773+
// curPath = ((JsonObject) curPath).get(pathParts[index]);
768774
logger.fine("Found next Path object " + curPath.toString());
769775
return processPathSegment(index + 1, pathParts, curPath, termUri);
770776
}

0 commit comments

Comments
 (0)