Description
Situation:
FilenameUtils.getPrefixLength is used in FilenameUtils.doNormalize.
FilenameUtils.normalize("////I don't want to become null!") returns null.
Problem:
Expected was: "I don't want to become null!"
The method FilenameUtils.getPrefixLength returns -1 for the mentioned string.
The root problem is found in following lines of code:
FilenameUtils.getPrefixLength
... int posUnix = filename.indexOf(UNIX_SEPARATOR, 2); int posWin = filename.indexOf(WINDOWS_SEPARATOR, 2); if ((posUnix == -1 && posWin == -1) || posUnix == 2 || posWin == 2) { return -1; } ...
Solution:
All leading slashes should be ignored at all, but considering the rest of the string.