Commons IO
  1. Commons IO
  2. IO-248

getFullPathNoEndSeparator return empty while path is one level directory

    Details

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

      linux 2.6.x 32bit java version 1.6.0_20 OpenJDK

      Description

      the getFullPathNoEndSeparator method in FilenameUtils.java (Revision 736890)
      if filename="/" return "/" <<==right
      if filename="/abc" return empty <<==bug
      if filename="/abc/xyz" return "/abc" <<==right

      885 	int index = indexOfLastSeparator(filename);
      886 	if (index < 0) {
      887 		return filename.substring(0, prefix);
      888 	}
      889 	int end = index + (includeSeparator ? 1 : 0);
      ================
                      if(end==0) return "/";
      >>>>>>>>>>>>>>>>
      890 	return filename.substring(0, end);
      

        Activity

          People

          • Assignee:
            Niall Pemberton
            Reporter:
            hippo spark
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development