Skip to content

Commit

Permalink
Merge pull request #2313 from atlanhq/PLT-1831-aioob
Browse files Browse the repository at this point in the history
PLT-1831 ArrayIndexOutOfBoundsException
  • Loading branch information
nikhilbonte21 authored Aug 25, 2023
2 parents 5da6cd5 + 1c6b597 commit 002ab9b
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,15 @@ public boolean isKeycloakSubjectsStoreUpdated(long cacheLastUpdatedTime) throws
List<AdminEventRepresentation> adminEvents = getKeycloakClient().getAdminEvents(OPERATION_TYPES,
null, null, null, null, null, null, null,
from, size);
Optional<AdminEventRepresentation> event = adminEvents.stream().filter(x -> RESOURCE_TYPES.contains(x.getResourceType())).findFirst();

if (event.isPresent()) {
latestKeycloakEventTime = event.get().getTime();
if (CollectionUtils.isEmpty(adminEvents) || cacheLastUpdatedTime > adminEvents.get(adminEvents.size() - 1).getTime()) {
break;
}

if (cacheLastUpdatedTime > adminEvents.get(adminEvents.size() - 1).getTime()) {
Optional<AdminEventRepresentation> event = adminEvents.stream().filter(x -> RESOURCE_TYPES.contains(x.getResourceType())).findFirst();

if (event.isPresent()) {
latestKeycloakEventTime = event.get().getTime();
break;
}
}
Expand All @@ -114,16 +115,16 @@ public boolean isKeycloakSubjectsStoreUpdated(long cacheLastUpdatedTime) throws
List<EventRepresentation> events = getKeycloakClient().getEvents(EVENT_TYPES,
null, null, null, null, null, from, size);

if (CollectionUtils.isEmpty(events) || cacheLastUpdatedTime > events.get(events.size() - 1).getTime()) {
break;
}

Optional<EventRepresentation> event = events.stream().filter(this::isUpdateProfileEvent).findFirst();

if (event.isPresent()) {
latestKeycloakEventTime = event.get().getTime();
break;
}

if (cacheLastUpdatedTime > events.get(events.size() - 1).getTime()) {
break;
}
}

if (latestKeycloakEventTime > cacheLastUpdatedTime) {
Expand Down

0 comments on commit 002ab9b

Please sign in to comment.