From d57782444db9b4a4442a71c3c384a658d9379b38 Mon Sep 17 00:00:00 2001 From: Antonis Lempesis Date: Thu, 2 Jun 2022 08:42:08 +0000 Subject: [PATCH] avoiding an OutOfBounds exception --- .../dnetlib/repo/manager/service/RepositoryServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java index f8904c6..436be53 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java @@ -409,7 +409,9 @@ LOGGER.debug("json: " + jsonArray); @Override public List getRepositoryAggregations(String id, int from, int size) throws JSONException { - return getRepositoryAggregations(id).subList(from, from + size); + List res = getRepositoryAggregations(id); + + return res.subList(from, Math.min(from + size, res.size())); } @Override