From 384bb2bc2cc3a700931797599f4f381dfd074262 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 1 Apr 2025 14:08:50 -0400 Subject: [PATCH] GH-9937: Remove `logger.error` from the `TcpSendingMessageHandler` Fixes: #9937 Issue link: https://github.com/spring-projects/spring-integration/issues/9937 The `TcpSendingMessageHandler` throws exceptions to the caller this or other way. There is just no reason to have extra `logger.error()` in those cases (cherry picked from commit fe5b12d98bc98ff03a27ae95a72a2768ab3795a2) --- .../integration/ip/tcp/TcpSendingMessageHandler.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandler.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandler.java index fe33345b7f..ceaa8d437c 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandler.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 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. @@ -90,7 +90,6 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements connection = this.clientConnectionFactory.getConnection(); } catch (Exception ex) { - logger.error(ex, "Error creating connection"); throw new MessageHandlingException(message, "Failed to obtain a connection in the [" + this + ']', ex); } return connection; @@ -123,7 +122,6 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements connection.send(message); } catch (Exception ex) { - logger.error(ex, "Error sending message"); connection.close(); throw IntegrationUtils.wrapInHandlingExceptionIfNecessary(message, () -> "Error sending message in the [" + this + ']', ex); @@ -135,7 +133,6 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements } } else { - logger.error(() -> "Unable to find outbound socket for " + message); MessageHandlingException messageHandlingException = new MessageHandlingException(message, "Unable to find outbound socket in the [" + this + ']'); publishNoConnectionEvent(messageHandlingException, connectionId);