Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-189

parseXpmValuesSection uses && instead of ||

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-alpha1
    • None
    • None

    Description

      The parseXpmValuesSection method in the class XpmImageParser has the 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) {
      ...
      

      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 &&

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: