Skip to content

Commit 218eec1

Browse files
Merge remote-tracking branch 'origin/main' into junit/migrate5
2 parents 743fed7 + d518814 commit 218eec1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisResultService.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ public SecurityAnalysisStatus findStatus(UUID resultUuid) {
289289
return securityAnalysisResult.get().getStatus();
290290
}
291291

292+
private static Page<?> emptyPage(Pageable pageable) {
293+
return new PageImpl<>(List.of(), pageable, 0);
294+
}
295+
292296
@Transactional(readOnly = true)
293297
public Page<ContingencyEntity> findContingenciesPage(UUID resultUuid, List<ResourceFilterDTO> resourceFilters, Pageable pageable) {
294298
Objects.requireNonNull(resultUuid);
@@ -310,7 +314,8 @@ public Page<ContingencyEntity> findContingenciesPage(UUID resultUuid, List<Resou
310314
);
311315

312316
if (!uuidPage.hasContent()) {
313-
return Page.empty();
317+
// Since springboot 3.2, the return value of Page.empty() is not serializable. See https://github.com/spring-projects/spring-data-commons/issues/2987
318+
return (Page<ContingencyEntity>) emptyPage(pageable);
314319
} else {
315320
List<UUID> uuids = uuidPage.map(ContingencyRepository.EntityUuid::getUuid).toList();
316321
// Then we fetch the main entities data for each UUID
@@ -343,7 +348,8 @@ public Page<SubjectLimitViolationEntity> findSubjectLimitViolationsPage(UUID res
343348
);
344349

345350
if (!uuidPage.hasContent()) {
346-
return Page.empty();
351+
// Since springboot 3.2, the return value of Page.empty() is not serializable. See https://github.com/spring-projects/spring-data-commons/issues/2987
352+
return (Page<SubjectLimitViolationEntity>) emptyPage(pageable);
347353
} else {
348354
List<UUID> uuids = uuidPage.map(u -> u.getId()).toList();
349355
// Then we fetch the main entities data for each UUID

0 commit comments

Comments
 (0)