[JAVA] Try-catch blocks should not be nested - False Positive - try-catch block inside lambda

168 views
Skip to first unread message

Adam Gabryś

unread,
Sep 26, 2017, 6:04:09 AM9/26/17
to SonarQube

Hi,

Rule S1141 Try-catch blocks should not be nested is raising a false positive for lambda expression which declares try-catch block and is located in inside another try-catch block.



Environment:

  • SonarQube: 5.6.6
  • SonarJava plugin: 4.12.0.11033

Example class:


Project:

Build:
mvn clean package sonar

Best Regards

Adam Gabryś

Adam Gabryś

unread,
Sep 26, 2017, 6:06:42 AM9/26/17
to SonarQube
The issue is similar to SONARJAVA-1948.

Best Regards
Adam Gabryś

Michael Gumowski

unread,
Sep 27, 2017, 11:06:38 AM9/27/17
to Adam Gabryś, SonarQube
Hey Adam,

Thanks for the feedback (and reproducer! I like your github repo listing them a lot, useful!).
 It's of course a FP. We should have handled lambdas the same way we excluded anonymous classes, indeed. 

Ticket created: SONARJAVA-2487

Cheers,
Michael


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/4328f468-de69-4ed9-84e0-5e6315b19474%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Michael Gumowski | SonarSource
Software Developer, Language Team
http://sonarsource.com
Reply all
Reply to author
Forward
0 new messages