You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by sh...@apache.org on 2015/07/29 06:57:02 UTC
[15/50] [abbrv] incubator-lens git commit: LENS-649 : Improve
exception handling in UserConfigLoaderFactory
LENS-649 : Improve exception handling in UserConfigLoaderFactory
Project: http://git-wip-us.apache.org/repos/asf/incubator-lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-lens/commit/588baef0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-lens/tree/588baef0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-lens/diff/588baef0
Branch: refs/heads/LENS-581
Commit: 588baef059051a29d2e7d2abb70f4196468305a7
Parents: c7261d1
Author: Rajat Khandelwal <pr...@apache.org>
Authored: Mon Jul 20 13:45:45 2015 +0530
Committer: Amareshwari Sriramadasu <am...@apache.org>
Committed: Mon Jul 20 13:45:45 2015 +0530
----------------------------------------------------------------------
.../lens/server/user/UserConfigLoaderFactory.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/588baef0/lens-server/src/main/java/org/apache/lens/server/user/UserConfigLoaderFactory.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/user/UserConfigLoaderFactory.java b/lens-server/src/main/java/org/apache/lens/server/user/UserConfigLoaderFactory.java
index f92584b..eaf3848 100644
--- a/lens-server/src/main/java/org/apache/lens/server/user/UserConfigLoaderFactory.java
+++ b/lens-server/src/main/java/org/apache/lens/server/user/UserConfigLoaderFactory.java
@@ -29,9 +29,12 @@ import org.apache.lens.server.api.user.UserConfigLoaderException;
import org.apache.hadoop.hive.conf.HiveConf;
+import lombok.extern.slf4j.Slf4j;
+
/**
* A factory for creating UserConfigLoader objects.
*/
+@Slf4j
public final class UserConfigLoaderFactory {
private UserConfigLoaderFactory() {
@@ -133,6 +136,15 @@ public final class UserConfigLoaderFactory {
* @return the user config
*/
public static Map<String, String> getUserConfig(String loggedInUser) {
- return getUserConfigLoader().getUserConfig(loggedInUser);
+ try {
+ Map<String, String> config = getUserConfigLoader().getUserConfig(loggedInUser);
+ if (config == null) {
+ throw new UserConfigLoaderException("Got null User config for: " + loggedInUser);
+ }
+ return config;
+ } catch (RuntimeException e) {
+ log.error("Couldn't get user config for user: " + loggedInUser, e);
+ throw e;
+ }
}
}