Skip to content

Commit b78060a

Browse files
authored
Merge pull request #11762 from TIK-NFL/fix_ror-v2_api_cvoc
Fixing ror v2 api access for cvoc
2 parents a042fc5 + 3cf657f commit b78060a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import jakarta.persistence.criteria.*;
4444
import org.apache.commons.codec.digest.DigestUtils;
4545
import org.apache.commons.lang3.StringUtils;
46+
import org.apache.commons.lang3.math.NumberUtils;
4647
import org.apache.http.HttpResponse;
4748
import org.apache.http.HttpResponseInterceptor;
4849
import org.apache.http.client.methods.HttpGet;
@@ -804,8 +805,18 @@ Object processPathSegment(int index, String[] pathParts, JsonValue curPath, Stri
804805
}
805806

806807
} else {
807-
curPath = ((JsonObject) curPath).get(pathParts[index]);
808-
logger.fine("Found next Path object " + curPath);
808+
if ((curPath instanceof JsonArray) && NumberUtils.isCreatable(pathParts[index])) {
809+
try {
810+
int indexNumber = Integer.parseInt(pathParts[index]);
811+
curPath = ((JsonArray) curPath).get(indexNumber);
812+
} catch (NumberFormatException nfe) {
813+
logger.fine("Please provide a valid integer number " + pathParts[index]);
814+
}
815+
} else {
816+
curPath = ((JsonObject) curPath).get(pathParts[index]);
817+
}
818+
// curPath = ((JsonObject) curPath).get(pathParts[index]);
819+
logger.fine("Found next Path object " + ((curPath == null) ? "null" : curPath.toString()));
809820
return processPathSegment(index + 1, pathParts, curPath, termUri);
810821
}
811822
} else {

0 commit comments

Comments
 (0)