You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/07/02 05:08:51 UTC

(camel) branch main updated: CAMEL-22174 catch SMBRuntimeExceptions on connect and always close connection on disconnect (#18507)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 800b91d790d CAMEL-22174  catch SMBRuntimeExceptions on connect and always close connection on disconnect (#18507)
800b91d790d is described below

commit 800b91d790d1c5e149365a41479b31930a509d45
Author: jubar <j_...@proton.me>
AuthorDate: Wed Jul 2 07:08:45 2025 +0200

    CAMEL-22174  catch SMBRuntimeExceptions on connect and always close connection on disconnect (#18507)
    
    * camel-smb: added SMBRuntimeException to the catch clause in connectIfNecessary()
    
    * camel-smb: always close connection on disconnect
---
 .../src/main/java/org/apache/camel/component/smb/SmbOperations.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbOperations.java b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbOperations.java
index b7e40c1da09..6f9839a6caf 100644
--- a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbOperations.java
+++ b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbOperations.java
@@ -97,7 +97,7 @@ public class SmbOperations implements SmbFileOperations {
                 LOG.debug("Connected and logged in to: {}:{}", configuration.getHostname(), configuration.getPort());
                 loggedIn = true;
             }
-        } catch (IOException e) {
+        } catch (SMBRuntimeException | IOException e) {
             disconnect();
             throw new GenericFileOperationFailedException(
                     "Cannot connect to: " + configuration.getHostname() + ":" + configuration.getPort() + " due to: "
@@ -128,6 +128,7 @@ public class SmbOperations implements SmbFileOperations {
         if (session != null) {
             try {
                 session.close();
+                session.getConnection().close();
             } catch (TransportException t) {
                 try {
                     session.getConnection().close(true);