Thanks for your reply <3

First, I want to make sure I understand the issue well, so I can discuss
the solutions effectively.

Here's my understanding so far (please correct me if I'm mistaken):
When the command is processing and an error occurs `publishHookEvent()` is
invoked and executes the code when `(result instanceof ErrorInfo ex)` is
true which tries to map the error to JSON which is not
always valid and (throw an exception).

Proposed Solution:
Implement a validation method to ensure the JSON string is valid.
What comes to my mind is something like this:

private boolean isValidJson(String json, Type type) {
    try {
        gson.fromJson(json, type);
        return true;
    } catch (Exception e) {
        return false;
    }
}

I couldn't understand how and why to "enhance the processor logic to handle
the empty body as an empty JSON"

did you mean modify `processCommand()` in `CommandSourceService`

Thank you!

On Sat, Mar 16, 2024 at 12:04 AM Ádám Sághy <adamsa...@gmail.com> wrote:

> Hi Zeyad,
>
> I would say we should have a validation in the
> `SynchronousCommandProcessingService` class before executing the command to
> check whether the body is a valid JSON or not.
>
> Alternatively we could enhance the processor logic to handle the empty
> body as an empty JSON ( {} )...
>
> What do you think?
>
> Regards,
> Adam
>
> > On 15 Mar 2024, at 14:47, Zeyad Nasef <zeyad.nasef....@gmail.com> wrote:
> >
> > Hi there.
> > I encountered an issue while attempting to resolve FINERACT-1269 and I'm
> seeking assistance.
> >
> > Issue Overview:
> > The problem entails a JsonSyntaxException appearing in the logs, which
> violates the logging guidelines outlined in the README.md, as it's an error
> with the client request.
> >
> > My Approach:
> > I utilized the IntelliJ debugger to trace the code and sent a POST
> request to the /v1/codes endpoint. I observed that the exception arises
> within the JsonHelper class in fineract-core module, specifically within
> the parse() method, when attempting to parse invalid JSON.
> >
> > The Problem:
> > This exception is thrown before reaching the line discussed by Michael
> Vorburger.
> > Map<String, Object> errorMap = gson.fromJson(ex.getMessage(), type);
> > Thus, idk if I misunderstood the issue. Any insights into the exact
> problem and suggestions on how to address it would be greatly appreciated.
> > Additionally, the project's build and run times are excessively long
> (~10 min) each time. That's Painful :")
> > I would highly appreciate any recommendations to reduce the build and
> run time.
> >
> > Apologies for the lengthy message.
> > Thank you!
>
>

Reply via email to