You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/07/16 05:27:46 UTC
[06/11] incubator-kylin git commit: minor,
fix FileNotFoundException in FileTable.getSignature()
minor, fix FileNotFoundException in FileTable.getSignature()
Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/84679816
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/84679816
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/84679816
Branch: refs/heads/KYLIN-876
Commit: 846798162aae5fc706129212dd57a444b8ddc9e9
Parents: 866ae10
Author: Li, Yang <ya...@ebay.com>
Authored: Tue Jul 14 10:48:28 2015 +0800
Committer: Li, Yang <ya...@ebay.com>
Committed: Tue Jul 14 10:48:28 2015 +0800
----------------------------------------------------------------------
.../org/apache/kylin/dict/lookup/FileTable.java | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/84679816/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java
----------------------------------------------------------------------
diff --git a/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java b/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java
index 383513f..92f0c10 100644
--- a/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java
+++ b/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java
@@ -18,6 +18,7 @@
package org.apache.kylin.dict.lookup;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -60,18 +61,22 @@ public class FileTable implements ReadableTable {
@Override
public TableSignature getSignature() throws IOException {
- Pair<Long, Long> sizeAndLastModified = getSizeAndLastModified(path);
- return new TableSignature(path, sizeAndLastModified.getFirst(), sizeAndLastModified.getSecond());
+ try {
+ Pair<Long, Long> sizeAndLastModified = getSizeAndLastModified(path);
+ return new TableSignature(path, sizeAndLastModified.getFirst(), sizeAndLastModified.getSecond());
+ } catch (FileNotFoundException ex) {
+ return null;
+ }
}
@Override
public String toString() {
return path;
}
-
+
public static Pair<Long, Long> getSizeAndLastModified(String path) throws IOException {
FileSystem fs = HadoopUtil.getFileSystem(path);
-
+
// get all contained files if path is directory
ArrayList<FileStatus> allFiles = new ArrayList<>();
FileStatus status = fs.getFileStatus(new Path(path));
@@ -81,14 +86,14 @@ public class FileTable implements ReadableTable {
FileStatus[] listStatus = fs.listStatus(new Path(path));
allFiles.addAll(Arrays.asList(listStatus));
}
-
+
long size = 0;
long lastModified = 0;
for (FileStatus file : allFiles) {
size += file.getLen();
lastModified = Math.max(lastModified, file.getModificationTime());
}
-
+
return new Pair<Long, Long>(size, lastModified);
}
}