You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Francisco Borges (JIRA)" <ji...@apache.org> on 2008/08/21 12:10:44 UTC
[jira] Created: (IO-179) StringIndexOutOfBounds exception on
FilenameUtils.getPathNoEndSeparator
StringIndexOutOfBounds exception on FilenameUtils.getPathNoEndSeparator
-----------------------------------------------------------------------
Key: IO-179
URL: https://issues.apache.org/jira/browse/IO-179
Project: Commons IO
Issue Type: Bug
Components: Utilities
Affects Versions: 1.4, 1.3.2
Environment: Javadoc says that method is text based. In any case, the problem has been reproduced in Windows and Linux.
Reporter: Francisco Borges
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)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (IO-179) StringIndexOutOfBounds exception on
FilenameUtils.getPathNoEndSeparator
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niall Pemberton resolved IO-179.
--------------------------------
Resolution: Fixed
Fix Version/s: (was: 1.5)
2.0
Assignee: Niall Pemberton
Patch applied, thanks!
http://svn.apache.org/viewvc?view=rev&revision=721610
> StringIndexOutOfBounds exception on FilenameUtils.getPathNoEndSeparator
> -----------------------------------------------------------------------
>
> Key: IO-179
> URL: https://issues.apache.org/jira/browse/IO-179
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2, 1.4
> Environment: Javadoc says that method is text based. In any case, the problem has been reproduced in Windows and Linux.
> Reporter: Francisco Borges
> Assignee: Niall Pemberton
> Fix For: 2.0
>
> Attachments: IO-179.patch
>
>
> 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)
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (IO-179) StringIndexOutOfBounds exception on
FilenameUtils.getPathNoEndSeparator
Posted by "Gwenaël Le Roux (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gwenaël Le Roux updated IO-179:
-------------------------------
Attachment: IO-179.patch
A proposal patch for this issue
> StringIndexOutOfBounds exception on FilenameUtils.getPathNoEndSeparator
> -----------------------------------------------------------------------
>
> Key: IO-179
> URL: https://issues.apache.org/jira/browse/IO-179
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2, 1.4
> Environment: Javadoc says that method is text based. In any case, the problem has been reproduced in Windows and Linux.
> Reporter: Francisco Borges
> Fix For: 1.5
>
> Attachments: IO-179.patch
>
>
> 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)
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (IO-179) StringIndexOutOfBounds exception on
FilenameUtils.getPathNoEndSeparator
Posted by "Gwenaël Le Roux (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640645#action_12640645 ]
Gwenaël Le Roux commented on IO-179:
------------------------------------
The issue is due to a call to String#substring(beginIndex,lastIndex) where beginIndex>lastIndex.
The attached file is a patch that includes the updated test code and the correction.
> StringIndexOutOfBounds exception on FilenameUtils.getPathNoEndSeparator
> -----------------------------------------------------------------------
>
> Key: IO-179
> URL: https://issues.apache.org/jira/browse/IO-179
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2, 1.4
> Environment: Javadoc says that method is text based. In any case, the problem has been reproduced in Windows and Linux.
> Reporter: Francisco Borges
> Fix For: 1.5
>
> Attachments: IO-179.patch
>
>
> 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)
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (IO-179) StringIndexOutOfBounds exception on
FilenameUtils.getPathNoEndSeparator
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell updated IO-179:
-----------------------------
Fix Version/s: 1.5
> StringIndexOutOfBounds exception on FilenameUtils.getPathNoEndSeparator
> -----------------------------------------------------------------------
>
> Key: IO-179
> URL: https://issues.apache.org/jira/browse/IO-179
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2, 1.4
> Environment: Javadoc says that method is text based. In any case, the problem has been reproduced in Windows and Linux.
> Reporter: Francisco Borges
> Fix For: 1.5
>
>
> 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)
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.