From 25dcb88630eb4a6c30db4f20323beeb7fd2584cc Mon Sep 17 00:00:00 2001 From: cnauroth Date: Thu, 11 Feb 2016 16:52:58 -0800 Subject: [PATCH] HADOOP-12795. KMS does not log detailed stack trace for unexpected errors. Contributed by Chris Nauroth. (cherry picked from commit 70c756d35e6ed5608ce82d1a6fbfb02e19af5ecf) --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../hadoop/crypto/key/kms/server/KMSExceptionsProvider.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index edfa9574454..bf2fe1fb90e 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -1056,6 +1056,9 @@ Release 2.8.0 - UNRELEASED "hadoop.workaround.non.threadsafe.getpwuid" is different between core-default.xml and NativeIO.java (Akira AJISAKA via cmccabe) + HADOOP-12795. KMS does not log detailed stack trace for unexpected errors. + (cnauroth) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSExceptionsProvider.java b/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSExceptionsProvider.java index 5cb088567c9..aa9d2995ab9 100644 --- a/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSExceptionsProvider.java +++ b/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSExceptionsProvider.java @@ -86,12 +86,14 @@ public class KMSExceptionsProvider implements ExceptionMapper { status = Response.Status.FORBIDDEN; } else if (exception instanceof IOException) { status = Response.Status.INTERNAL_SERVER_ERROR; + log(status, throwable); } else if (exception instanceof UnsupportedOperationException) { status = Response.Status.BAD_REQUEST; } else if (exception instanceof IllegalArgumentException) { status = Response.Status.BAD_REQUEST; } else { status = Response.Status.INTERNAL_SERVER_ERROR; + log(status, throwable); } if (doAudit) { KMSWebApp.getKMSAudit().error(KMSMDCFilter.getUgi(),