Skip to content

Commit 36f4029

Browse files
committed
Revert "mkdirs(..) tolerance + unit test."
This reverts commit b77dc84.
1 parent b77dc84 commit 36f4029

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFileSystem.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,18 @@ public boolean exists(Path path) throws IOException {
180180
return f.exists();
181181
}
182182

183-
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
184-
185-
if(f==null) return true;
186-
187-
Path parent = f.getParent();
188-
Path absolute = makeAbsolute(f);
189-
File p2f = new File(absolute.toUri().getPath());
190-
return (f == null || mkdirs(parent)) && (p2f.mkdir() || p2f.isDirectory());
183+
public boolean mkdirs(Path path, FsPermission permission)
184+
throws IOException {
185+
boolean created = false;
186+
Path absolute = makeAbsolute(path);
187+
File f = new File(absolute.toUri().getPath());
188+
189+
if (f.exists()) {
190+
System.out.println("Directory " + f.getPath() + " already exist");
191+
return true;
192+
}
193+
194+
return f.mkdirs();
191195
}
192196

193197
@Deprecated

src/test/java/org/gluster/test/TestGluster.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static void before() throws Exception{
138138

139139
@org.junit.Test
140140
public void testTolerantMkdirs() throws Exception{
141-
141+
System.out.println("Testing tollerance of mkdirs(a/b/c/d) then mkdirs(a/b/c)");
142142
Path longPath = new Path("a/b/c/d");
143143
assertFalse(gfs.exists(longPath));
144144
gfs.mkdirs(longPath);

0 commit comments

Comments
 (0)