You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ar...@apache.org on 2023/05/10 08:58:13 UTC

[fineract] branch develop updated: - [x] Fix Batch API internal error

This is an automated email from the ASF dual-hosted git repository.

arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 0f1559cc7 - [x] Fix Batch API internal error
0f1559cc7 is described below

commit 0f1559cc7ae83073b2e9cdef41fb79aa6852cef5
Author: Janos Haber <ja...@finesolution.hu>
AuthorDate: Thu May 4 10:00:46 2023 +0200

    - [x] Fix Batch API internal error
---
 .../apache/fineract/batch/service/BatchApiServiceImpl.java    | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java
index 0ef2b2ac6..f84a08c15 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java
@@ -217,7 +217,10 @@ public class BatchApiServiceImpl implements BatchApiService {
             BatchCallHandler callHandler = new BatchCallHandler(this.batchFilters, commandStrategy::execute);
             if (BatchRequestContextHolder.getEnclosingTransaction().isPresent()) {
                 if (BatchRequestContextHolder.getEnclosingTransaction().get().isRollbackOnly()) {
-                    return new BatchResponse();
+                    BatchResponse br = new BatchResponse();
+                    br.setBody("Parent request was erroneous!");
+                    br.setRequestId(request.getRequestId());
+                    return br;
                 }
                 entityManager.flush();
             }
@@ -314,7 +317,11 @@ public class BatchApiServiceImpl implements BatchApiService {
                 errResponse.setBody("Transaction is being rolled back. First erroneous request: \n" + new Gson().toJson(res));
                 errResponse.setRequestId(res.getRequestId());
                 if (statusCode == -1) {
-                    statusCode = res.getStatusCode();
+                    if (res.getStatusCode() != null) {
+                        statusCode = res.getStatusCode();
+                    } else {
+                        statusCode = Status.INTERNAL_SERVER_ERROR.getStatusCode();
+                    }
                 }
                 break;
             }