Ingest v2 Null pointer exception (Sierra: fromDate)

Description

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

Activity

Show:

Chas Woodfield January 15, 2025 at 6:00 PM

On mobius staging the migration only seems to have updated 1 record as one is fine while the other sierra ones are problematic, I would not have thought that the job checkpoint records would have been cached as I would have thought no sql would have been executed until after the migrations had been run.

Chas Woodfield January 8, 2025 at 4:55 PM

Been chatting with Steve and it tirns out there is a problem with the serialization for the job checkpoint, so that the json does not have all the properties it should have, Steve will look into why.

Jag Goraya December 17, 2024 at 9:32 AM

what is the knock-on effects of returning a null or empty string in this scenario?

/cc

Done

Details

Assignee

Reporter

Components

Target Version

Fix versions

Sprint

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

Flag notifications