Commons IO
  1. Commons IO
  2. IO-179

StringIndexOutOfBounds exception on FilenameUtils.getPathNoEndSeparator

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.2, 1.4
    • Fix Version/s: 2.0
    • Component/s: Utilities
    • Labels:
      None
    • Environment:

      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)

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

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Niall Pemberton
            Reporter:
            Francisco Borges
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development