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

ArrayIndexOutOfBoundsException in BOMInputStream when reading a file without BOM multiple times

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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. IO-302.patch
          2 kB
          Marcos Vinícius da Silva
        2. Test.java
          2 kB
          Jan Steuerwald
        3. testfileBOM.xml
          6 kB
          Jan Steuerwald
        4. testfileNoBOM.xml
          6 kB
          Jan Steuerwald

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment