Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-302

ArrayIndexOutOfBoundsException in BOMInputStream when reading a file without BOM multiple times

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.2
    • Streams/Writers
    • None
    • Win7 64bit, Java 6 32bit

    Description

      Resetting the BOMInputStream doesn't reset the fbLength member variable. This causes fbLength to grow bigger than the firstBytes array (when the file doesn't contain a BOM), which leads to an ArrayIndexOutOfBoundsException in the readFirstBytes method.

      The attached test case reveals the problem.

      Attachments

        1. Test.java
          2 kB
          Jan Steuerwald
        2. testfileBOM.xml
          6 kB
          Jan Steuerwald
        3. testfileNoBOM.xml
          6 kB
          Jan Steuerwald
        4. IO-302.patch
          2 kB
          Marcos Vinícius da Silva

        Activity

          People

            ggregory Gary D. Gregory
            jsteuerwald Jan Steuerwald
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: