[ 
https://issues.apache.org/jira/browse/FINERACT-942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17161551#comment-17161551
 ] 

Manthan Surkar commented on FINERACT-942:
-----------------------------------------

[~vorburger] The illegal catch checkstyle is the last one left, 
I will need some guidance before I proceed:
1. general exceptions are used to timeout request, like eg:

loop:
do some request 
if Exception
wait for 3 sec and goto loop
else
Exit

2. Use it for no reason and just safety, and removing the try-catch block won't 
affect the code/cause any error.

3. A runtime exception is caught and logged

4. When an operation is to be performed on say 10 entities and we don't want to 
stop if an entity 5 has a runtime exception, it is caught. 

TBH I don't know how to tackle any of these situations with confidence.

IMO, 
in 2,3 we should remove the logging completely.
1,4 we should suppress the warning, WDTY? 

> Make Checkstyle detect bad logging anti-patterns (and fix problems found)
> -------------------------------------------------------------------------
>
>                 Key: FINERACT-942
>                 URL: https://issues.apache.org/jira/browse/FINERACT-942
>             Project: Apache Fineract
>          Issue Type: Improvement
>            Reporter: Michael Vorburger
>            Assignee: Manthan Surkar
>            Priority: Major
>             Fix For: 1.4.0
>
>
> A particularly useful part of FINERACT-821, helping to detect real errors in 
> Fineract and not just formating, would be to enable the following in 
> fineract-provider/config/checkstyle/checkstyle.xml, and fix any problems that 
> this finds:
> 1. RegexpSinglelineJava / printStackTrace
> 2. IllegalCatch, IllegalThrows, MutableException, 
> AvoidHidingCauseExceptionCheck
> 3. 
> [EmptyCatchBlock|https://checkstyle.sourceforge.io/config_blocks.html#EmptyCatchBlock]
> Nota bene that we already have FINERACT-696, but this is complementary to 
> that.
> One thing this should detect is e.g. the bad wrong emtpy 
> catch(MessagingException e) in EmailMessageJobEmailServiceImpl.
> It may lead to more of FINERACT-932, which would be a Good Thing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to