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

StringIndexOutOfBounds exception on FilenameUtils.getPathNoEndSeparator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.2, 1.4
    • 2.0
    • Utilities
    • None
    • Javadoc says that method is text based. In any case, the problem has been reproduced in Windows and Linux.

    Description

      public void testFilenameUtils()

      { String path = "/foo.xml"; org.apache.commons.io.FilenameUtils.getPathNoEndSeparator(path); }

      Leads to:

      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1768)
      at org.apache.commons.io.FilenameUtils.doGetPath(FilenameUtils.java:705)
      at org.apache.commons.io.FilenameUtils.getPathNoEndSeparator(FilenameUtils.java:683)

      Attachments

        1. IO-179.patch
          2 kB
          Gwenaël Le Roux

        Activity

          People

            niallp Niall Pemberton
            francisco Francisco Borges
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: