From 6d5713a8a84b5fdae9b371fb692a818352758bd5 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Tue, 6 Oct 2015 21:39:33 +0100 Subject: [PATCH] HADOOP-12284. UserGroupInformation doAs can throw misleading exception (Aaron Dosset via stevel) --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../org/apache/hadoop/security/UserGroupInformation.java | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index cfdb88d0d3..f92d720f75 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -1124,6 +1124,9 @@ Release 2.8.0 - UNRELEASED HADOOP-11098. [JDK8] Max Non Heap Memory default changed between JDK7 and 8. (ozawa) + HADOOP-12284. UserGroupInformation doAs can throw misleading exception + (Aaron Dosset via stevel) + OPTIMIZATIONS HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString() diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java index 80a08980f0..b511494cb7 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java @@ -1670,7 +1670,10 @@ public T doAs(PrivilegedExceptionAction action if (LOG.isDebugEnabled()) { LOG.debug("PrivilegedActionException as:" + this + " cause:" + cause); } - if (cause instanceof IOException) { + if (cause == null) { + throw new RuntimeException("PrivilegedActionException with no " + + "underlying cause. UGI [" + this + "]", pae); + } else if (cause instanceof IOException) { throw (IOException) cause; } else if (cause instanceof Error) { throw (Error) cause;