From 6ddef6ccdbbefc49414e11ee8cf4ac77ed1acc5d Mon Sep 17 00:00:00 2001 From: Tom Cunningham Date: Tue, 28 Jan 2025 16:07:29 -0500 Subject: [PATCH 1/2] CAMEL-21673 Fix missing stream closes; fix getBackOffMaxDelay usage --- .../apache/camel/springboot/catalog/components/as2.json | 4 ++-- .../http/springboot/SpringBootPlatformHttpBinding.java | 1 + .../SupervisingRouteControllerAutoConfiguration.java | 2 +- .../maven/SpringBootAutoConfigurationMojo.java | 1 + .../camel/springboot/maven/SpringBootStarterMojo.java | 9 +++++++-- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/as2.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/as2.json index 6d232405e0c2..922acaf29ca3 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/as2.json +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/as2.json @@ -75,12 +75,12 @@ "validateSigningCertificateChain": { "index": 41, "kind": "parameter", "displayName": "Validate Signing Certificate Chain", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.security.cert.Certificate[]", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.as2.AS2Configuration", "configurationField": "configuration", "description": "Certificates to validate the message's signature against. If not supplied, validation will not take place. Server: validates the received message. Client: not yet implemented, should validate the MDN" } }, "apis": { - "client": { "consumerOnly": false, "producerOnly": true, "description": "Sends EDI Messages over HTTP", "methods": { "send": { "description": "Send ediMessage to trading partner", "signatures": [ "org.apache.hc.core5.http.protocol.HttpCoreContext send(String ediMessage, String requestUri, String subject, String from, String as2From, String as2To, org.apache.camel.component.as2.api.AS2MessageStructure as2MessageStructure, org.apache.hc.core5.http.ContentType ediMessageContentType, String ediMessageTransferEncoding, org.apache.camel.component.as2.api.AS2SignatureAlgorithm signingAlgorithm, java.security.cert.Certificate[] signingCertificateChain, java.security.PrivateKey signingPrivateKey, org.apache.camel.component.as2.api.AS2CompressionAlgorithm compressionAlgorithm, String dispositionNotificationTo, String[] signedReceiptMicAlgorithms, org.apache.camel.component.as2.api.AS2EncryptionAlgorithm encryptingAlgorithm, java.security.cert.Certificate[] encryptingCertificateChain, String attachedFileName, String receiptDeliveryOption)" ] } } }, + "client": { "consumerOnly": false, "producerOnly": true, "description": "Sends EDI Messages over HTTP", "methods": { "send": { "description": "Send ediMessage to trading partner", "signatures": [ "org.apache.hc.core5.http.protocol.HttpCoreContext send(Object ediMessage, String requestUri, String subject, String from, String as2From, String as2To, org.apache.camel.component.as2.api.AS2MessageStructure as2MessageStructure, org.apache.hc.core5.http.ContentType ediMessageContentType, String ediMessageTransferEncoding, org.apache.camel.component.as2.api.AS2SignatureAlgorithm signingAlgorithm, java.security.cert.Certificate[] signingCertificateChain, java.security.PrivateKey signingPrivateKey, org.apache.camel.component.as2.api.AS2CompressionAlgorithm compressionAlgorithm, String dispositionNotificationTo, String[] signedReceiptMicAlgorithms, org.apache.camel.component.as2.api.AS2EncryptionAlgorithm encryptingAlgorithm, java.security.cert.Certificate[] encryptingCertificateChain, String attachedFileName, String receiptDeliveryOption)" ] } } }, "receipt": { "consumerOnly": true, "producerOnly": false, "description": "Receives the asynchronous AS2-MDN that is requested by the sender of an AS2 message", "methods": { "receive": { "description": "", "signatures": [ "void receive(String requestUriPattern, org.apache.hc.core5.http.io.HttpRequestHandler handler)" ] } } }, "server": { "consumerOnly": true, "producerOnly": false, "description": "Receives EDI Messages over HTTP", "methods": { "listen": { "description": "", "signatures": [ "void listen(String requestUriPattern, org.apache.hc.core5.http.io.HttpRequestHandler handler)" ] } } } }, "apiProperties": { - "client": { "methods": { "send": { "properties": { "as2From": { "index": 0, "kind": "parameter", "displayName": "As2 From", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "AS2 name of sender", "optional": false }, "as2MessageStructure": { "index": 1, "kind": "parameter", "displayName": "As2 Message Structure", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.as2.api.AS2MessageStructure", "enum": [ "PLAIN", "SIGNED", "ENCRYPTED", "SIGNED_ENCRYPTED", "PLAIN_COMPRESSED", "COMPRESSED_SIGNED", "SIGNED_COMPRESSED", "ENCRYPTED_COMPRESSED", "ENCRYPTED_COMPRESSED_SIGNED", "ENCRYPTED_SIGNED_COMPRESSED" ], "deprecated": false, "autowired": false, "secret": false, "description": "The structure of AS2 to send; see AS2MessageStructure", "optional": false }, "as2To": { "index": 2, "kind": "parameter", "displayName": "As2 To", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "AS2 name of recipient", "optional": false }, "attachedFileName": { "index": 3, "kind": "parameter", "displayName": "Attached File Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the attached file or null if user doesn't want to specify it", "optional": true }, "compressionAlgorithm": { "index": 4, "kind": "parameter", "displayName": "Compression Algorithm", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.as2.api.AS2CompressionAlgorithm", "enum": [ "ZLIB" ], "deprecated": false, "autowired": false, "secret": false, "description": "The algorithm used to compress the message or null if sending EDI message uncompressed", "optional": true }, "dispositionNotificationTo": { "index": 5, "kind": "parameter", "displayName": "Disposition Notification To", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "An RFC2822 address to request a receipt or null if no receipt requested", "optional": true }, "ediMessage": { "index": 6, "kind": "parameter", "displayName": "Edi Message", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "EDI message to transport", "optional": false }, "ediMessageContentType": { "index": 7, "kind": "parameter", "displayName": "Edi Message Content Type", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.hc.core5.http.ContentType", "deprecated": false, "autowired": false, "secret": false, "description": "The content type of EDI message", "optional": false }, "ediMessageTransferEncoding": { "index": 8, "kind": "parameter", "displayName": "Edi Message Transfer Encoding", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The transfer encoding used to transport EDI message", "optional": true }, "encryptingAlgorithm": { "index": 9, "kind": "parameter", "displayName": "Encrypting Algorithm", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.as2.api.AS2EncryptionAlgorithm", "enum": [ "AES128_CBC", "AES192_CBC", "AES256_CBC", "AES128_CCM", "AES192_CCM", "AES256_CCM", "AES128_GCM", "AES192_GCM", "AES256_GCM", "CAMELLIA128_CBC", "CAMELLIA192_CBC", "CAMELLIA256_CBC", "CAST5_CBC", "DES_CBC", "DES_EDE3_CBC", "GOST28147_GCFB", "IDEA_CBC", "RC2_CBC", "RC4", "SEED_CBC" ], "deprecated": false, "autowired": false, "secret": false, "description": "The algorithm used to encrypt the message or null if sending EDI message unencrypted", "optional": true }, "encryptingCertificateChain": { "index": 10, "kind": "parameter", "displayName": "Encrypting Certificate Chain", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "java.security.cert.Certificate[]", "deprecated": false, "autowired": false, "secret": false, "description": "The chain of certificates used to encrypt the message or null if sending EDI message unencrypted", "optional": true }, "from": { "index": 11, "kind": "parameter", "displayName": "From", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "RFC2822 address of sender", "optional": false }, "receiptDeliveryOption": { "index": 12, "kind": "parameter", "displayName": "Receipt Delivery Option", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "", "optional": true }, "requestUri": { "index": 13, "kind": "parameter", "displayName": "Request Uri", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Resource location to deliver message", "optional": false }, "signedReceiptMicAlgorithms": { "index": 14, "kind": "parameter", "displayName": "Signed Receipt Mic Algorithms", "group": "producer", "label": "", "required": false, "type": "array", "javaType": "java.lang.String[]", "deprecated": false, "autowired": false, "secret": false, "description": "The senders list of signing algorithms for signing receipt, in preferred order, or null if requesting an unsigned receipt.", "optional": true }, "signingAlgorithm": { "index": 15, "kind": "parameter", "displayName": "Signing Algorithm", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.as2.api.AS2SignatureAlgorithm", "enum": [ "SHA3_224WITHRSA", "SHA3_256WITHRSA", "SHA3_384withRSA", "SHA3_512WITHRSA", "MD5WITHRSA", "SHA1WITHRSA", "MD2WITHRSA", "SHA224WITHRSA", "SHA256WITHRSA", "SHA384WITHRSA", "SHA512WITHRSA", "RIPEMD128WITHRSA", "RIPEMD160WITHRSA", "RIPEMD256WITHRSA", "SHA224WITHDSA", "SHA256WITHDSA", "SHA384WITHDSA", "SHA512WITHDSA", "SHA3_224WITHDSA", "SHA3_256WITHDSA", "SHA3_384WITHDSA", "SHA3_512WITHDSA", "SHA1WITHDSA", "SHA3_224WITHECDSA", "SHA3_256WITHECDSA", "SHA3_384WITHECDSA", "SHA3_512WITHECDSA", "SHA1WITHECDSA", "SHA224WITHECDSA", "SHA256WITHECDSA", "SHA384WITHECDSA", "SHA512WITHECDSA", "SHA1WITHPLAIN_ECDSA", "SHA224WITHPLAIN_ECDSA", "SHA256WITHPLAIN_ECDSA", "SHA384WITHPLAIN_ECDSA", "SHA512WITHPLAIN_ECDSA", "RIPEMD160WITHPLAIN_ECDSA", "SHA1WITHRSAANDMGF1", "SHA224WITHRSAANDMGF1", "SHA256WITHRSAANDMGF1", "SHA384WITHRSAANDMGF1", "SHA512WITHRSAANDMGF1", "SHA3_224WITHRSAANDMGF1", "SHA3_256WITHRSAANDMGF1", "SHA3_384WITHRSAANDMGF1", "SHA3_512WITHRSAANDMGF1" ], "deprecated": false, "autowired": false, "secret": false, "description": "The algorithm used to sign the message or null if sending EDI message unsigned", "optional": true }, "signingCertificateChain": { "index": 16, "kind": "parameter", "displayName": "Signing Certificate Chain", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "java.security.cert.Certificate[]", "deprecated": false, "autowired": false, "secret": false, "description": "The chain of certificates used to sign the message or null if sending EDI message unsigned", "optional": true }, "signingPrivateKey": { "index": 17, "kind": "parameter", "displayName": "Signing Private Key", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "java.security.PrivateKey", "deprecated": false, "autowired": false, "secret": false, "description": "The private key used to sign EDI message", "optional": true }, "subject": { "index": 18, "kind": "parameter", "displayName": "Subject", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Message subject", "optional": false } } } } }, + "client": { "methods": { "send": { "properties": { "as2From": { "index": 0, "kind": "parameter", "displayName": "As2 From", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "AS2 name of sender", "optional": false }, "as2MessageStructure": { "index": 1, "kind": "parameter", "displayName": "As2 Message Structure", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.as2.api.AS2MessageStructure", "enum": [ "PLAIN", "SIGNED", "ENCRYPTED", "SIGNED_ENCRYPTED", "PLAIN_COMPRESSED", "COMPRESSED_SIGNED", "SIGNED_COMPRESSED", "ENCRYPTED_COMPRESSED", "ENCRYPTED_COMPRESSED_SIGNED", "ENCRYPTED_SIGNED_COMPRESSED" ], "deprecated": false, "autowired": false, "secret": false, "description": "The structure of AS2 to send; see AS2MessageStructure", "optional": false }, "as2To": { "index": 2, "kind": "parameter", "displayName": "As2 To", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "AS2 name of recipient", "optional": false }, "attachedFileName": { "index": 3, "kind": "parameter", "displayName": "Attached File Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the attached file or null if user doesn't want to specify it", "optional": true }, "compressionAlgorithm": { "index": 4, "kind": "parameter", "displayName": "Compression Algorithm", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.as2.api.AS2CompressionAlgorithm", "enum": [ "ZLIB" ], "deprecated": false, "autowired": false, "secret": false, "description": "The algorithm used to compress the message or null if sending EDI message uncompressed", "optional": true }, "dispositionNotificationTo": { "index": 5, "kind": "parameter", "displayName": "Disposition Notification To", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "An RFC2822 address to request a receipt or null if no receipt requested", "optional": true }, "ediMessage": { "index": 6, "kind": "parameter", "displayName": "Edi Message", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "description": "EDI message to transport", "optional": false }, "ediMessageContentType": { "index": 7, "kind": "parameter", "displayName": "Edi Message Content Type", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.hc.core5.http.ContentType", "deprecated": false, "autowired": false, "secret": false, "description": "The content type of EDI message", "optional": false }, "ediMessageTransferEncoding": { "index": 8, "kind": "parameter", "displayName": "Edi Message Transfer Encoding", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The transfer encoding used to transport EDI message", "optional": true }, "encryptingAlgorithm": { "index": 9, "kind": "parameter", "displayName": "Encrypting Algorithm", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.as2.api.AS2EncryptionAlgorithm", "enum": [ "AES128_CBC", "AES192_CBC", "AES256_CBC", "AES128_CCM", "AES192_CCM", "AES256_CCM", "AES128_GCM", "AES192_GCM", "AES256_GCM", "CAMELLIA128_CBC", "CAMELLIA192_CBC", "CAMELLIA256_CBC", "CAST5_CBC", "DES_CBC", "DES_EDE3_CBC", "GOST28147_GCFB", "IDEA_CBC", "RC2_CBC", "RC4", "SEED_CBC" ], "deprecated": false, "autowired": false, "secret": false, "description": "The algorithm used to encrypt the message or null if sending EDI message unencrypted", "optional": true }, "encryptingCertificateChain": { "index": 10, "kind": "parameter", "displayName": "Encrypting Certificate Chain", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "java.security.cert.Certificate[]", "deprecated": false, "autowired": false, "secret": false, "description": "The chain of certificates used to encrypt the message or null if sending EDI message unencrypted", "optional": true }, "from": { "index": 11, "kind": "parameter", "displayName": "From", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "RFC2822 address of sender", "optional": false }, "receiptDeliveryOption": { "index": 12, "kind": "parameter", "displayName": "Receipt Delivery Option", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "", "optional": true }, "requestUri": { "index": 13, "kind": "parameter", "displayName": "Request Uri", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Resource location to deliver message", "optional": false }, "signedReceiptMicAlgorithms": { "index": 14, "kind": "parameter", "displayName": "Signed Receipt Mic Algorithms", "group": "producer", "label": "", "required": false, "type": "array", "javaType": "java.lang.String[]", "deprecated": false, "autowired": false, "secret": false, "description": "The senders list of signing algorithms for signing receipt, in preferred order, or null if requesting an unsigned receipt.", "optional": true }, "signingAlgorithm": { "index": 15, "kind": "parameter", "displayName": "Signing Algorithm", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.as2.api.AS2SignatureAlgorithm", "enum": [ "SHA3_224WITHRSA", "SHA3_256WITHRSA", "SHA3_384withRSA", "SHA3_512WITHRSA", "MD5WITHRSA", "SHA1WITHRSA", "MD2WITHRSA", "SHA224WITHRSA", "SHA256WITHRSA", "SHA384WITHRSA", "SHA512WITHRSA", "RIPEMD128WITHRSA", "RIPEMD160WITHRSA", "RIPEMD256WITHRSA", "SHA224WITHDSA", "SHA256WITHDSA", "SHA384WITHDSA", "SHA512WITHDSA", "SHA3_224WITHDSA", "SHA3_256WITHDSA", "SHA3_384WITHDSA", "SHA3_512WITHDSA", "SHA1WITHDSA", "SHA3_224WITHECDSA", "SHA3_256WITHECDSA", "SHA3_384WITHECDSA", "SHA3_512WITHECDSA", "SHA1WITHECDSA", "SHA224WITHECDSA", "SHA256WITHECDSA", "SHA384WITHECDSA", "SHA512WITHECDSA", "SHA1WITHPLAIN_ECDSA", "SHA224WITHPLAIN_ECDSA", "SHA256WITHPLAIN_ECDSA", "SHA384WITHPLAIN_ECDSA", "SHA512WITHPLAIN_ECDSA", "RIPEMD160WITHPLAIN_ECDSA", "SHA1WITHRSAANDMGF1", "SHA224WITHRSAANDMGF1", "SHA256WITHRSAANDMGF1", "SHA384WITHRSAANDMGF1", "SHA512WITHRSAANDMGF1", "SHA3_224WITHRSAANDMGF1", "SHA3_256WITHRSAANDMGF1", "SHA3_384WITHRSAANDMGF1", "SHA3_512WITHRSAANDMGF1" ], "deprecated": false, "autowired": false, "secret": false, "description": "The algorithm used to sign the message or null if sending EDI message unsigned", "optional": true }, "signingCertificateChain": { "index": 16, "kind": "parameter", "displayName": "Signing Certificate Chain", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "java.security.cert.Certificate[]", "deprecated": false, "autowired": false, "secret": false, "description": "The chain of certificates used to sign the message or null if sending EDI message unsigned", "optional": true }, "signingPrivateKey": { "index": 17, "kind": "parameter", "displayName": "Signing Private Key", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "java.security.PrivateKey", "deprecated": false, "autowired": false, "secret": false, "description": "The private key used to sign EDI message", "optional": true }, "subject": { "index": 18, "kind": "parameter", "displayName": "Subject", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Message subject", "optional": false } } } } }, "receipt": { "methods": { "receive": { "properties": { "requestUriPattern": { "index": 0, "kind": "parameter", "displayName": "Request Uri Pattern", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "", "optional": false } } } } }, "server": { "methods": { "listen": { "properties": { "requestUriPattern": { "index": 0, "kind": "parameter", "displayName": "Request Uri Pattern", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "", "optional": false } } } } } } diff --git a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java index d5e493a28b4b..e0b1a8e64277 100644 --- a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java +++ b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java @@ -168,6 +168,7 @@ protected void doWriteDirectResponse(Message message, HttpServletResponse respon } finally { IOHelper.close(new Closeable[]{is, os}); } + stream.close(); } else { if (LOG.isDebugEnabled()) { LOG.debug("Streaming response in chunked mode with buffer size {}", response.getBufferSize()); diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routecontroller/SupervisingRouteControllerAutoConfiguration.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routecontroller/SupervisingRouteControllerAutoConfiguration.java index dcdc34f9cf03..3b0428213aed 100644 --- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routecontroller/SupervisingRouteControllerAutoConfiguration.java +++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routecontroller/SupervisingRouteControllerAutoConfiguration.java @@ -61,7 +61,7 @@ public SupervisingRouteController supervisingRouteController(SupervisingRouteCon src.setBackOffMaxAttempts(config.getBackOffMaxAttempts()); } if (config.getBackOffMaxDelay() > 0) { - src.setBackOffMaxDelay(config.getBackOffDelay()); + src.setBackOffMaxDelay(config.getBackOffMaxDelay()); } if (config.getBackOffMaxElapsedTime() > 0) { src.setBackOffMaxElapsedTime(config.getBackOffMaxElapsedTime()); diff --git a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java index 13d5e91e1c6a..da2b5947e3f2 100644 --- a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java +++ b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java @@ -1938,6 +1938,7 @@ private void writeComponentSpringFactorySource(String packageName, String name) FileUtils.write(target, code, StandardCharsets.UTF_8); getLog().info("Created file: " + target); + is.close(); } catch (Exception e) { throw new MojoFailureException("IOError with file " + target, e); } diff --git a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootStarterMojo.java b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootStarterMojo.java index 7a016385ed93..bfcf25779fd8 100644 --- a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootStarterMojo.java +++ b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootStarterMojo.java @@ -117,7 +117,9 @@ protected void executeAll() throws MojoExecutionException, MojoFailureException private void fixAdditionalDependencies(Document pom) throws Exception { Properties properties = new Properties(); - properties.load(getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties")); + InputStream is = getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties"); + properties.load(is); + is.close(); Set deps = new TreeSet<>(csvToSet(properties.getProperty(getMainDepArtifactId()))); @@ -233,7 +235,10 @@ private void fixExcludedDependencies(Document pom) throws Exception { // excluded dependencies Set configExclusions = new HashSet<>(); Properties properties = new Properties(); - properties.load(getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties")); + InputStream is = getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties"); + properties.load(is); + is.close(); + String artExcl = properties.getProperty("exclude_" + getMainDepArtifactId()); getLog().debug("Configured exclusions: " + artExcl); if (artExcl != null && !artExcl.trim().isEmpty()) { From afc80fe580053b29081cb3426fea945834e439f3 Mon Sep 17 00:00:00 2001 From: Tom Cunningham Date: Wed, 29 Jan 2025 17:31:12 -0500 Subject: [PATCH 2/2] Move stream.close() into finally block --- .../platform/http/springboot/SpringBootPlatformHttpBinding.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java index e0b1a8e64277..657eb8f90898 100644 --- a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java +++ b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java @@ -167,8 +167,8 @@ protected void doWriteDirectResponse(Message message, HttpServletResponse respon } } finally { IOHelper.close(new Closeable[]{is, os}); + stream.close(); } - stream.close(); } else { if (LOG.isDebugEnabled()) { LOG.debug("Streaming response in chunked mode with buffer size {}", response.getBufferSize());