You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by lu...@apache.org on 2015/09/06 09:39:25 UTC
[19/50] [abbrv] incubator-kylin git commit: KYLIN-940 ,
fix NPE in monitor module , apply patch from Xiaoyu Wang
KYLIN-940 ,fix NPE in monitor module ,apply patch from Xiaoyu Wang
Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/623585fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/623585fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/623585fd
Branch: refs/heads/master
Commit: 623585fdeceda70ded8469d7dc5363a82132963e
Parents: 5bcce8b
Author: jiazhong <ji...@ebay.com>
Authored: Wed Aug 12 11:06:15 2015 +0800
Committer: jiazhong <ji...@ebay.com>
Committed: Wed Aug 12 11:06:15 2015 +0800
----------------------------------------------------------------------
.../org/apache/kylin/monitor/FileUtils.java | 28 ++++++++++++-----
.../org/apache/kylin/monitor/QueryParser.java | 32 +++++++++++++++-----
2 files changed, 45 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/623585fd/monitor/src/main/java/org/apache/kylin/monitor/FileUtils.java
----------------------------------------------------------------------
diff --git a/monitor/src/main/java/org/apache/kylin/monitor/FileUtils.java b/monitor/src/main/java/org/apache/kylin/monitor/FileUtils.java
index 184b2c2..1daa404 100644
--- a/monitor/src/main/java/org/apache/kylin/monitor/FileUtils.java
+++ b/monitor/src/main/java/org/apache/kylin/monitor/FileUtils.java
@@ -47,7 +47,9 @@ public class FileUtils {
return false;
}
} catch (Exception e) {
- fs.close();
+ if(fs != null) {
+ fs.close();
+ }
logger.info("Failed to init:", e);
}
return true;
@@ -67,8 +69,12 @@ public class FileUtils {
} catch (Exception e) {
logger.info("Exception", e);
} finally {
- writer.close();
- fs.close();
+ if(writer != null) {
+ writer.close();
+ }
+ if(fs != null) {
+ fs.close();
+ }
}
}
@@ -90,9 +96,15 @@ public class FileUtils {
} catch (Exception e) {
logger.info("Exception", e);
} finally {
- writer.close();
- cwriter.close();
- fs.close();
+ if(writer != null) {
+ writer.close();
+ }
+ if(cwriter != null) {
+ cwriter.close();
+ }
+ if(fs != null) {
+ fs.close();
+ }
}
}
@@ -106,7 +118,9 @@ public class FileUtils {
try {
fs = FileSystem.newInstance(conf);
} catch (IOException e) {
- fs.close();
+ if(fs != null) {
+ fs.close();
+ }
logger.info("Failed to get hdfs FileSystem", e);
}
return fs;
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/623585fd/monitor/src/main/java/org/apache/kylin/monitor/QueryParser.java
----------------------------------------------------------------------
diff --git a/monitor/src/main/java/org/apache/kylin/monitor/QueryParser.java b/monitor/src/main/java/org/apache/kylin/monitor/QueryParser.java
index 53f4bc6..4996265 100644
--- a/monitor/src/main/java/org/apache/kylin/monitor/QueryParser.java
+++ b/monitor/src/main/java/org/apache/kylin/monitor/QueryParser.java
@@ -107,7 +107,9 @@ public class QueryParser {
this.writeResultToHdfs(QueryParser.QUERY_PARSE_RESULT_PATH, QueryParser.KYLIN_QUERY_CSV_HEADER);
}
} catch (IOException e) {
- fs.close();
+ if(fs != null) {
+ fs.close();
+ }
logger.info("Failed to init:", e);
}
}
@@ -181,9 +183,15 @@ public class QueryParser {
} catch (IOException ex) {
logger.info("Failed to write to hdfs:", ex);
} finally {
- writer.close();
- cwriter.close();
- fs.close();
+ if(writer != null) {
+ writer.close();
+ }
+ if(cwriter != null) {
+ cwriter.close();
+ }
+ if(fs != null) {
+ fs.close();
+ }
}
logger.info("Finish parsing file " + filePath + " !");
@@ -208,9 +216,15 @@ public class QueryParser {
} catch (IOException e) {
logger.info("Exception", e);
} finally {
- writer.close();
- cwriter.close();
- fs.close();
+ if(writer != null) {
+ writer.close();
+ }
+ if(cwriter != null) {
+ cwriter.close();
+ }
+ if(fs != null) {
+ fs.close();
+ }
}
}
@@ -247,7 +261,9 @@ public class QueryParser {
try {
fs = FileSystem.get(conf);
} catch (IOException e) {
- fs.close();
+ if(fs != null) {
+ fs.close();
+ }
logger.info("Failed to get hdfs FileSystem", e);
}
return fs;