NPE fix when exception is null
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/88d99844 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/88d99844 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/88d99844 Branch: refs/heads/2.7.x-fixes Commit: 88d998449b0485eef5de60d9f63a6e9235652378 Parents: 2b15d76 Author: Colm O hEigeartaigh <[email protected]> Authored: Fri Aug 28 15:55:51 2015 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Fri Aug 28 15:59:40 2015 +0100 ---------------------------------------------------------------------- .../org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/88d99844/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java index a209026..74ea1ac 100644 --- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java +++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java @@ -197,7 +197,11 @@ public abstract class AbstractSamlInHandler implements RequestHandler { protected void throwFault(String error, Exception ex) { // TODO: get bundle resource message once this filter is moved // to rt/rs/security - LOG.warning(error + ": " + ExceptionUtils.getStackTrace(ex)); + String errorMsg = error; + if (ex != null) { + errorMsg += ": " + ExceptionUtils.getStackTrace(ex); + } + LOG.warning(errorMsg); Response response = JAXRSUtils.toResponseBuilder(401).entity(error).build(); throw ExceptionUtils.toNotAuthorizedException(null, response); }
