[
https://issues.apache.org/jira/browse/IO-483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15125914#comment-15125914
]
Bruno P. Kinoshita commented on IO-483:
---------------------------------------
Looks like FilenameUtils#getPrefixLength is finding the colon character in the
second position, and then it gets the previous character (around line 660 and
666 r1727892) and checks the following:
{code}
ch0 = Character.toUpperCase(ch0);
if (ch0 >= 'A' && ch0 <= 'Z') {
if (len == 2 || isSeparator(filename.charAt(2)) == false) {
return 2;
}
return 3;
}
return NOT_FOUND;
{code}
The ch0 >= 'A' && ch0 <= 'Z' is evaluated to false, since ch0 is '/'.
Maybe this issue could be fixed by updating the Javadoc to state that one of
the valid prefixes is a case insensitive character, from a to z, followed by a
colon?
> getPrefixLength return -1 if unix file contains colon
> -----------------------------------------------------
>
> Key: IO-483
> URL: https://issues.apache.org/jira/browse/IO-483
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.4
> Reporter: Tristan Lins
>
> A simple
> {code:java}
> int prefixLength = FilenameUtils.getPrefixLength("/:foo/bar");
> {code}
> return {{-1}}, but {{0}} was expected. The path is absolutely valid for unix
> systems.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)