HBASE-6306 TestFSUtils fails against hadoop 2.0
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1356954 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f2f468cc65
commit
d3dccec7af
|
@ -267,7 +267,14 @@ public abstract class FSUtils {
|
|||
public static String getVersion(FileSystem fs, Path rootdir)
|
||||
throws IOException, DeserializationException {
|
||||
Path versionFile = new Path(rootdir, HConstants.VERSION_FILE_NAME);
|
||||
FileStatus [] status = fs.listStatus(versionFile);
|
||||
FileStatus[] status = null;
|
||||
try {
|
||||
// hadoop 2.0 throws FNFE if directory does not exist.
|
||||
// hadoop 1.0 returns null if directory does not exist.
|
||||
status = fs.listStatus(versionFile);
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
return null;
|
||||
}
|
||||
if (status == null || status.length == 0) return null;
|
||||
String version = null;
|
||||
byte [] content = new byte [(int)status[0].getLen()];
|
||||
|
|
Loading…
Reference in New Issue