mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
HCFS: fix mkdirs NPE
This commit is contained in:
parent
cb299dfaa2
commit
af8b413a9c
|
@ -34,13 +34,12 @@ public class FilerClient {
|
||||||
|
|
||||||
public boolean mkdirs(String path, int mode, int uid, int gid, String userName, String[] groupNames) {
|
public boolean mkdirs(String path, int mode, int uid, int gid, String userName, String[] groupNames) {
|
||||||
|
|
||||||
Path pathObject = Paths.get(path);
|
|
||||||
String parent = pathObject.getParent().toString();
|
|
||||||
String name = pathObject.getFileName().toString();
|
|
||||||
|
|
||||||
if ("/".equals(path)) {
|
if ("/".equals(path)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Path pathObject = Paths.get(path);
|
||||||
|
String parent = pathObject.getParent().toString();
|
||||||
|
String name = pathObject.getFileName().toString();
|
||||||
|
|
||||||
mkdirs(parent, mode, uid, gid, userName, groupNames);
|
mkdirs(parent, mode, uid, gid, userName, groupNames);
|
||||||
|
|
||||||
|
|
|
@ -13,5 +13,11 @@ public class SeaweedFilerTest {
|
||||||
System.out.println(entry.toString());
|
System.out.println(entry.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filerClient.mkdirs("/new_folder", 0755);
|
||||||
|
filerClient.touch("/new_folder/new_empty_file", 0755);
|
||||||
|
filerClient.touch("/new_folder/new_empty_file2", 0755);
|
||||||
|
filerClient.rm("/new_folder/new_empty_file", false);
|
||||||
|
filerClient.rm("/new_folder", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue