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

        hippo spark created issue -
        Niall Pemberton made changes -
        Field Original Value New Value
        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


        code:

        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);
        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


        {code}
        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);
        {code}
        Show
        Niall Pemberton added a comment - Thanks, fixed: http://svn.apache.org/viewvc?view=revision&revision=1002806
        Niall Pemberton made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Niall Pemberton [ niallp ]
        Fix Version/s 2.0 [ 12312961 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Workflow jira [ 12520457 ] Default workflow, editable Closed status [ 12601886 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        15d 8h 43m 1 Niall Pemberton 29/Sep/10 18:52
        Resolved Resolved Closed Closed
        406d 23h 16m 1 Henri Yandell 10/Nov/11 18:09

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development