Skip to content

Commit 438a4f0

Browse files
committed
Throw RuntimeException if a volume doesn't exist.
1 parent ccd7f65 commit 438a4f0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,12 @@ public File pathToFile(Path path) {
198198
}else if(volume==null){
199199
volume = default_volume;
200200
}
201-
202-
return new File(this.volumes.get(volume) + "/" + path.toUri().getPath());
201+
String volPath = this.volumes.get(volume);
202+
if(volPath==null){
203+
throw new RuntimeException("Error undefined volume:" + volume + " in path: " + path);
204+
}
205+
206+
return new File(volPath + "/" + path.toUri().getPath());
203207
}
204208

205209
protected Path getInitialWorkingDirectory() {
@@ -222,6 +226,10 @@ public Path fileToPath(File path) {
222226
root = nextPath;
223227
}
224228
}
229+
230+
if(volume==null){
231+
throw new RuntimeException("No volume matching path: " + path);
232+
}
225233

226234
if(default_volume.equalsIgnoreCase(volume))
227235
volume = "";

0 commit comments

Comments
 (0)