Describe the bug
When migrating from GN 3.10.x to GN 4.0.x the migration v3110/UpdateMetadataStatus.java is executed and does never end.
To Reproduce
Steps to reproduce the behavior:
- Get a database from GN 3.10.x
- Start GN 4.0.6-SNAPSHOT using that database.
Expected behavior
The v3110/UpdateMetadataStatus is executed and finish after processing all the records.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
The problem seems to be related to the check done to finish the loop:
|
pageRequest=page.nextPageable(); |
|
} while (pageRequest != null && page.hasContent()); |
It can be fixed with something like this:
if (!page.hasNext()) {
break;
}
pageRequest = page.nextPageable();
} while (page.hasContent());
In previous versions of spring-data-commons (1.6.1.RELEASE) the docs of Page.nextPageable() says
Returns the Pageable to request the next Page. Can be null in case the current Page is already the last one. Clients should check hasNextPage() before calling this method to make sure they receive a non-null value.
However, in the version used in GN 4 (2.2.8.RELEASE) it says
Returns the Pageable to request the next Slice. Can be Pageable.unpaged() in case the current Slice is already the last one. Clients should check hasNext() before calling this method.
Describe the bug
When migrating from GN 3.10.x to GN 4.0.x the migration v3110/UpdateMetadataStatus.java is executed and does never end.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The
v3110/UpdateMetadataStatusis executed and finish after processing all the records.Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
The problem seems to be related to the check done to finish the loop:
core-geonetwork/web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v3110/UpdateMetadataStatus.java
Lines 257 to 258 in 1a61cfd
It can be fixed with something like this:
In previous versions of
spring-data-commons(1.6.1.RELEASE) the docs ofPage.nextPageable()saysHowever, in the version used in GN 4 (
2.2.8.RELEASE) it says