Done
Details
Assignee
Chas WoodfieldChas WoodfieldReporter
Chas WoodfieldChas WoodfieldLabels
Components
Target Version
Fix versions
Sprint
NonePriority
TBD
Details
Details
Assignee
Chas Woodfield
Chas WoodfieldReporter
Chas Woodfield
Chas WoodfieldLabels
Components
Target Version
Fix versions
Sprint
None
Priority
Created November 26, 2024 at 9:06 AM
Updated January 22, 2025 at 9:17 AM
Resolved January 22, 2025 at 9:17 AM
The following exception occurs when ingesting for a Sierra LMS
[36m04:58:44.646[0;39m [37m[reactor-tcp-epoll-6][0;39m [1;31mERROR[0;39m [35mo.o.d.d.job.SourceRecordService[0;39m - Terminating job SEMO Source Record Import because of Error java.lang.NullPointerException: Cannot invoke "java.time.LocalDateTime.truncatedTo(java.time.temporal.TemporalUnit)" because "this.fromDate" is null at services.k_int.interaction.sierra.DateTimeRange.toString(DateTimeRange.java:26) at java.base/java.util.Objects.toString(Objects.java:164) at services.k_int.interaction.sierra.SierraApiClient.bibsRawResponse(SierraApiClient.java:48) at org.olf.dcb.core.interaction.sierra.SierraLmsClient.lambda$getChunk$1(SierraLmsClient.java:302) at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:153)
It is fairly simple to stop the null pointer exception happening, but what should happen with regards to the logic, the assumption has been made that there should always be a from date, but in the following code this is not always the case
default Publisher<JsonNode> bibsRawResponse( BibParams params ) { return bibsRawResponse(params.getLimit(), params.getOffset(), Objects.toString(params.getCreatedDate(), null), Objects.toString(params.getUpdatedDate(), null), nullIfEmpty(params.getFields()), params.getDeleted(), Objects.toString(params.getDeletedDate(), null), params.getSuppressed(), nullIfEmpty(params.getLocations())); }
which is called from the following code
// Use the inbuilt marshalling to convert into the BibParams. final Optional<BibParams> optParams = checkpoint.isPresent() ? Optional.of( objectMapper.readValueFromTree(checkpoint.get(), BibParams.class) ) : Optional.empty(); final BibParams apiParams = mergeApiParameters(optParams); final Instant now = Instant.now(); return Mono.just( apiParams ) .flatMap( params -> Mono.from( client.bibsRawResponse(params) )) .mapNotNull( itemPage -> itemPage.get("entries") )
I am guessing this is because this is the first call made to get the records from the sierra host