diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java index 25f59c1e647..a7409e6f11d 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,11 +147,11 @@ public class InvocableHandlerMethod extends HandlerMethod { args[i] = this.resolvers.resolveArgument(parameter, message); } catch (Exception ex) { - // Leave stack trace for later, exception may actually be resolved and handled.. + // Leave stack trace for later, exception may actually be resolved and handled... if (logger.isDebugEnabled()) { - String error = ex.getMessage(); - if (error != null && !error.contains(parameter.getExecutable().toGenericString())) { - logger.debug(formatArgumentError(parameter, error)); + String exMsg = ex.getMessage(); + if (exMsg != null && !exMsg.contains(parameter.getExecutable().toGenericString())) { + logger.debug(formatArgumentError(parameter, exMsg)); } } throw ex; diff --git a/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java b/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java index 1426e0f94a5..37eef7ada0d 100644 --- a/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java +++ b/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -166,11 +166,11 @@ public class InvocableHandlerMethod extends HandlerMethod { args[i] = this.resolvers.resolveArgument(parameter, mavContainer, request, this.dataBinderFactory); } catch (Exception ex) { - // Leave stack trace for later, exception may actually be resolved and handled.. + // Leave stack trace for later, exception may actually be resolved and handled... if (logger.isDebugEnabled()) { - String error = ex.getMessage(); - if (error != null && !error.contains(parameter.getExecutable().toGenericString())) { - logger.debug(formatArgumentError(parameter, error)); + String exMsg = ex.getMessage(); + if (exMsg != null && !exMsg.contains(parameter.getExecutable().toGenericString())) { + logger.debug(formatArgumentError(parameter, exMsg)); } } throw ex; diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java index 45ee9374605..c108c13cfdc 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -190,7 +190,7 @@ public class InvocableHandlerMethod extends HandlerMethod { try { argMonos.add(this.resolvers.resolveArgument(parameter, bindingContext, exchange) .defaultIfEmpty(NO_ARG_VALUE) - .doOnError(cause -> logArgumentErrorIfNecessary(exchange, parameter, cause))); + .doOnError(ex -> logArgumentErrorIfNecessary(exchange, parameter, ex))); } catch (Exception ex) { logArgumentErrorIfNecessary(exchange, parameter, ex); @@ -201,14 +201,12 @@ public class InvocableHandlerMethod extends HandlerMethod { Stream.of(values).map(o -> o != NO_ARG_VALUE ? o : null).toArray()); } - private void logArgumentErrorIfNecessary( - ServerWebExchange exchange, MethodParameter parameter, Throwable cause) { - - // Leave stack trace for later, if error is not handled.. - String message = cause.getMessage(); - if (!message.contains(parameter.getExecutable().toGenericString())) { + private void logArgumentErrorIfNecessary(ServerWebExchange exchange, MethodParameter parameter, Throwable ex) { + // Leave stack trace for later, if error is not handled... + String exMsg = ex.getMessage(); + if (exMsg != null && !exMsg.contains(parameter.getExecutable().toGenericString())) { if (logger.isDebugEnabled()) { - logger.debug(exchange.getLogPrefix() + formatArgumentError(parameter, message)); + logger.debug(exchange.getLogPrefix() + formatArgumentError(parameter, exMsg)); } } }