Hi,
Since a couple of days, our company has introduced SonarQube on Android projects. Many issues have been solved already, except for one case: surrounding a FileOutputStream() object with try-catch-finally.
Before, the FileOutputStream() was not guarded with the try-catch-finally construction (note: we can’t use the try-with-rescources alternative since the API level used is 18 and should be 19+ for this alternative), so SonarQube/SonarLint was right in indicating it as a critical bug. Result: I guarded the construction as it should be guarded.
However, even if the guard is present and correctly implemented, SonarQube is still telling me to guard it like so:
Snapshot of code with issue underlined by SonarQube/SonarLint:
Oops… I wanted to post two more images but apparently new users can only post one image per post. Strange…
I will post the other 2 images in replies to this post, so pls. also check those.
I simply don’t understand as to why SonarQube/SonarLint still tells me to do something I already did…
Can someone shed a light on what else (if possible) has to be done?
Many thanks,
PS: I erroneously posted this very same topic on the wrong SonarQube forum. Apologise for that…
Best,
–Geert