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

        Francisco Borges created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        Fix Version/s 1.5 [ 12313370 ]
        Gwenaël Le Roux made changes -
        Attachment IO-179.patch [ 12392376 ]
        Niall Pemberton made changes -
        Resolution Fixed [ 1 ]
        Assignee Niall Pemberton [ niallp ]
        Fix Version/s 2.0 [ 12312961 ]
        Fix Version/s 1.5 [ 12313370 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12440484 ] Default workflow, editable Closed status [ 12601832 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development