SonarQube: Change this condition so that it does not always evaluate to "false" (for finally in javax.mail receiving)
<p>Why is SonarQube complaining about this part of the code??</p>

<p>SonarQube says:
Change this condition so that it does not always evaluate to "false"</p>

<p>However I can't seem to understand why the condition would always be false? Indeed, actually it's not, I just reran this part again in debug mode and it works perfectly, it does go inside, and the condition is not false most of the time.</p>

<p>Here's the code part:</p>

<pre><code>    } finally {
        if ((inboxFolder != null) &amp;&amp; (inboxFolder.isOpen())) {
            try {
                inboxFolder.close(true);
            } catch (MessagingException e) {
                log.error(e.getMessage(), e);
            }
        }
        if ((store != null) &amp;&amp; (store.isConnected())) {
            try {
                store.close();
            } catch (MessagingException e) {
                log.error(e.getMessage(), e);
            }
        }
    }
</code></pre>

<p>It's the finally part of try-catch when trying to receive email with javax.email, it's complaining about both if conditions.</p>

<p>This is the declaration of those variables, they get instantiated int the try part:</p>

<pre><code>Folder inboxFolder = null;
Store store = null;
</code></pre>

<p>So why is SonarQube complaining about this?</p>