You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2016/10/09 11:40:20 UTC

[jira] [Created] (IMAGING-189) parseXpmValuesSection uses && instead of ||

Sebb created IMAGING-189:
----------------------------

             Summary: parseXpmValuesSection uses && instead of ||
                 Key: IMAGING-189
                 URL: https://issues.apache.org/jira/browse/IMAGING-189
             Project: Commons Imaging
          Issue Type: Bug
            Reporter: Sebb


The parseXpmValuesSection method in the class XpmImageParser has the code:

{code}
 if (tokens.length < 4 && tokens.length > 7) { // FindBugs reports this
    throw new ImageReadException("Parsing XPM file failed, "
         + "<Values> section has incorrect tokens");
}
...
// subsequent code
if (tokens.length == 5 || tokens.length == 7) {
...
{code}

Findbugs points out that the second part of the condition is impossible.

The code that follows the condition expects that tokens.length may be > 4, so clearly the original condition should have used || rather than &&



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)