[
https://issues.apache.org/jira/browse/FINERACT-1269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17240032#comment-17240032
]
Michael Vorburger commented on FINERACT-1269:
---------------------------------------------
Oh... I got it! :P Our "regular" malformed JSON error handled works just fine,
I've just tried it out, and I do get a HTTP 400 response e.g. like this:
{code}{
"developerMessage": "The JSON syntax provided in the body of the request is
invalid: java.io.EOFException: End of input at line 1 column 6 path $.bad",
"defaultUserMessage": "The JSON syntax provided in the body of the request
is invalid: java.io.EOFException: End of input at line 1 column 6 path $.bad",
"userMessageGlobalisationCode": "error.msg.invalid.request.body",
"parameterName": "id",
"value": null,
"args": []
}{code}
But this is something slightly different - this comes from the (current version
of code on the develop branch) from the {{LOG.error("Error", e);}} in
{{SynchronousCommandProcessingService.publishEvent()}}. And it's because of
line 273 {{Map<String, Object> errorMap = gson.fromJson(ex.getMessage(),
type);}}. That... doesn't seem right, to me. I haven't looked into the full
details (and I don't really have the time to), but that code seems to make an
implicit assumption that {{ErrorInfo}}'s {{getMessage()}} is valid JSON.
However, that's clearly not the case here... :D
This is brand new code, this comes from [~fynmanoj]
https://github.com/apache/fineract/pull/1488 for FINERACT-1241 (FYI
[~avikganguly010] [~avikg]? [~avikganguly]?). Would you like to raise a PR to
fix this bug? Or may I just go ahead and remove that error handling which seems
wrong?
> JsonSyntaxException: MalformedJsonException: at
> SynchronousCommandProcessingService.publishEvent
> ------------------------------------------------------------------------------------------------
>
> Key: FINERACT-1269
> URL: https://issues.apache.org/jira/browse/FINERACT-1269
> Project: Apache Fineract
> Issue Type: Bug
> Affects Versions: 1.5.0
> Reporter: Michael Vorburger
> Assignee: Michael Vorburger
> Priority: Blocker
> Fix For: 1.5.0
>
>
> See FINERACT-932 for general background; I've found this in logs of
> https://www.fineract.dev:
> {code:java}com.google.gson.JsonSyntaxException:
> com.google.gson.stream.MalformedJsonException: Unterminated object at line 1
> column 55 path $.
> at com.google.gson.Gson.fromJson (Gson.java:947)
> at com.google.gson.Gson.fromJson (Gson.java:897)
> at com.google.gson.Gson.fromJson (Gson.java:846)
> at
> org.apache.fineract.commands.service.SynchronousCommandProcessingService.publishEvent
> (SynchronousCommandProcessingService.java:273)
> at
> org.apache.fineract.commands.service.SynchronousCommandProcessingService.publishErrorEvent
> (SynchronousCommandProcessingService.java:236)
> at
> org.apache.fineract.commands.service.SynchronousCommandProcessingService.processAndLogCommand
> (SynchronousCommandProcessingService.java:98)
> at
> org.apache.fineract.commands.service.SynchronousCommandProcessingService$$FastClassBySpringCGLIB$$ec92d53f.invoke
> (<generated>)
> at org.springframework.cglib.proxy.MethodProxy.invoke
> (MethodProxy.java:218)
> at
> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint
> (CglibAopProxy.java:771)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> (ReflectiveMethodInvocation.java:163)
> at
> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed
> (CglibAopProxy.java:749)
> at
> org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction
> (TransactionAspectSupport.java:367)
> at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke
> (TransactionInterceptor.java:118)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> (ReflectiveMethodInvocation.java:186)
> at
> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed
> (CglibAopProxy.java:749)
> at
> org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept
> (CglibAopProxy.java:691)
> at
> org.apache.fineract.commands.service.SynchronousCommandProcessingService$$EnhancerBySpringCGLIB$$3f40ed52.processAndLogCommand
> (<generated>)
> at
> org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformServiceImpl.logCommandSource
> (PortfolioCommandSourceWritePlatformServiceImpl.java:99)
> at
> org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformServiceImpl$$FastClassBySpringCGLIB$$31c15082.invoke
> (<generated>)
> at org.springframework.cglib.proxy.MethodProxy.invoke
> (MethodProxy.java:218)
> at
> org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept
> (CglibAopProxy.java:687)
> at
> org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformServiceImpl$$EnhancerBySpringCGLIB$$97e600fb.logCommandSource
> (<generated>)
> at
> org.apache.fineract.organisation.office.api.OfficesApiResource.createOffice
> (OfficesApiResource.java:162){code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)