Internal Server Error for GET /stockCardRangeSummaries

Description

Currently, we are not able to get the stock card range summaries by facility and program because the backed doesn't check whether we provide start and end date, and tries to use them. This causes Internal Server Error with the following message:

[Assertion failed] - this argument is required; it must not be null; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null

Logs from Scalyr:

14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at com.sun.proxy.$Proxy130.findByStockCardIdAndOccurredDateBetween(Unknown Source)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at org.openlmis.stockmanagement.service.StockCardSummariesService.assignOrderableToStockCard(StockCardSummariesService.java:293)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at org.openlmis.stockmanagement.service.StockCardSummariesService.lambda$getGroupedStockCards$0(StockCardSummariesService.java:116)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at org.openlmis.stockmanagement.service.StockCardSummariesService.getGroupedStockCards(StockCardSummariesService.java:119)
14:39:49.675 test.openlmis.org /var/log/messages 2019-11-19T13:39:46+00:00 f94344415b60 #011at org.openlmis.stockmanagement.web.stockcardrangesummary.StockCardRangeSummaryController.getStockCardRangeSummaries(StockCardRangeSummaryController.java:73)

Reproduction steps:

  1. Log into the application as administrator and obtain the user's access token.

  2. Go to https://uat.openlmis.org/stockmanagement/docs/ and to the details of the stockCardRangeSummaries endpoint.

  3. Query the endpoint with only the facilityId and programId parameters.

  4. The Internal Server Error is returned.

  5. Query the endpoint with only the facilityId, programId and endDate parameters.

  6. The Internal Server Error is returned.

Acceptance Criteria:

  • performance tests for GET /stockCardRangeSummaries passes with no errors

  • getting stockCardRangeSummaries by program and facility works properly

Environment

None

Status

Assignee

Paweł Pinker

Reporter

Klaudia Pałkowska

Labels

Story Points

3

Time tracking

40h

Components

Fix versions

Priority

Major
Configure