green-code-initiative / ecoCode-java

Reduce the environmental footprint of your Java software programs
https://ecocode.io
GNU General Public License v3.0
4 stars 22 forks source link

NullPointer exception in eco code java Sonar plugin #69

Open rrousset-michelin opened 2 weeks ago

rrousset-michelin commented 2 weeks ago

While launching java eco code plugin with maven sonar goal, i obtained the following error :

[ERROR] 07:05:13.649 Unable to run check class fr.greencodeinitiative.java.checks.FreeResourcesOfAutoCloseableInterface - EC79 on file 's4c_batch/src/main/java/com/michelin/s4c/service/DefaultStockReportGenerationService.java', To help improve the SonarSource Java Analyzer, please report this problem to SonarSource: see https://community.sonarsource.com/ java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because the return value of "java.util.Deque.peek()" is null

It is with the plugin version 1.6.2

rrousset-michelin commented 2 days ago

Hello, i fixed the issue: https://github.com/green-code-initiative/ecoCode-java/pull/70/files

Let me know if it is ok