ISA upload endpoint is broken

Description

According to performance test, the ISA upload endpoint is broken. Please see the following error message:

1 2 3 4 5 6 7 8 { "timestamp" : "2018-01-29T09:25:37.356+0000", "status" : 500, "error" : "Internal Server Error", "exception" : "java.util.concurrent.CompletionException", "message" : "org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [] did not match expected type [org.openlmis.referencedata.domain.Code (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [] did not match expected type [org.openlmis.referencedata.domain.Code (n/a)]", "path" : "/api/idealStockAmounts" }

It seems like code is incorrectly read from the file. Moreover, our ISA upload does not work correctly. Instead of updating values, it always creates new ones. The whole custom SQL retrieve query has some problem and even after fixing all of the above, the code throws exception on ISA update.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 2018-02-06 16:48:00.052 ERROR 24 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with pat h [] threw exception [Request processing failed; nested exception is java.util.concurrent.CompletionException: java.lang.StackOverflowError] with root cause java.lang.StackOverflowError: null at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:131) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108) at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:75) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108) at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:81) at com.sun.proxy.$Proxy87.prepareStatement(Unknown Source) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1929) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1898) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1876) at org.hibernate.loader.Loader.doQuery(Loader.java:919) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:306) at org.hibernate.loader.Loader.loadEntity(Loader.java:2204) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:60) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:50) at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4019) at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:508) at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:478) at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:219) at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:278) at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121) at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89) at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1129) at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1022) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:639) at org.hibernate.type.EntityType.resolve(EntityType.java:431) at org.hibernate.type.ComponentType.resolve(ComponentType.java:687) at org.hibernate.loader.Loader.extractKeysFromResultSet(Loader.java:848) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:714) at org.hibernate.loader.Loader.processResultSet(Loader.java:972) at org.hibernate.loader.Loader.doQuery(Loader.java:930) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:306)

Acceptance criteria

  • check why endpoint is broken

  • fix the problem

  • make sure that ISA amount update works correctly

  • make sure that ISA create works correctly

  • add contract test that will verify upload works correctly

Environment

None

Status

Assignee

Sebastian Brudziński

Reporter

Łukasz Lewczyński

Labels

None

Story Points

5

Time tracking

12h

Components

Sprint

None

Fix versions

Affects versions

3.2.1

Priority

Critical
Configure