Skip to content

Commit

Permalink
Merge pull request #2315 from atlanhq/revert-2313-PLT-1831-aioob
Browse files Browse the repository at this point in the history
Revert "PLT-1831 ArrayIndexOutOfBoundsException"
  • Loading branch information
nikhilbonte21 authored Aug 28, 2023
2 parents 002ab9b + 5b30e08 commit 16e7d0e
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,16 @@ public boolean isKeycloakSubjectsStoreUpdated(long cacheLastUpdatedTime) throws
List<AdminEventRepresentation> adminEvents = getKeycloakClient().getAdminEvents(OPERATION_TYPES,
null, null, null, null, null, null, null,
from, size);

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

Optional<AdminEventRepresentation> event = adminEvents.stream().filter(x -> RESOURCE_TYPES.contains(x.getResourceType())).findFirst();

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

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

if (latestKeycloakEventTime > cacheLastUpdatedTime) {
Expand All @@ -115,16 +114,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 16e7d0e

Please sign in to comment.