-
Type:
Bug
-
Status: Resolved
-
Priority:
P2
-
Resolution: Fixed
-
Affects Version/s: 2.17.0
-
Fix Version/s: 2.19.0
-
Component/s: io-java-hadoop-file-system
-
Labels:None
HadoopResourceId returns for directory uri wrong fileName() which doesnt conform ResourceId interface javadoc
Returns the name of the file or directory..
String getFilename();
URI hdfsClusterBaseUri = new URI(configuration.get("fs.defaultFS") + "/"); HadoopResourceId hadoopResourceId = new HadoopResourceId(hdfsClusterBaseUri.resolve("/dirA/file1"));
Expected behavior:
hadoopResourceId.getCurrentDirectory().getFilename() returns dirA
Actual behavior:
hadoopResourceId.getCurrentDirectory().getFilename() returns ""
The problem is that uri for folder is ending with '/' and getFileName() is using hadoop Path.getName() which returns everything after last slash.