gnodet-bot commented on code in PR #28553:
URL: https://github.com/apache/camel/pull/28553#discussion_r4386795973
##########
components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioProducer.java:
##########
@@ -256,11 +272,26 @@ private void copyObject(MinioClient minioClient, Exchange
exchange) throws Excep
.bucket(bucketName)
.object(sourceKey);
+ if (getConfiguration().getServerSideEncryptionCustomerKey() !=
null) {
+
copySourceBuilder.ssec(getConfiguration().getServerSideEncryptionCustomerKey());
+ }
+
CopyObjectArgs.Builder copyObjectRequest = CopyObjectArgs.builder()
.bucket(destinationBucketName)
.object(destinationKey)
.source(copySourceBuilder.build());
+ if (getConfiguration().getServerSideEncryption() != null
+ && getConfiguration().getServerSideEncryptionCustomerKey()
!= null) {
+ throw new IllegalArgumentException(
+ "Only one of serverSideEncryption or
serverSideEncryptionCustomerKey may be configured, not both");
+ }
Review Comment:
⚠️ **Ordering issue:** This guard runs *after* `copySourceBuilder.ssec()`
(line 275) and `copySourceBuilder.build()` (line 282). In `doPutObject`, the
guard runs *before* any encryption is applied. For correctness and consistency,
move this guard before line 275 (before any encryption work is done on
`copySourceBuilder`).
##########
components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioProducer.java:
##########
@@ -196,6 +196,17 @@ private void doPutObject(
.object(objectName)
.userMetadata(objectMetadata);
+ if (getConfiguration().getServerSideEncryption() != null
+ && getConfiguration().getServerSideEncryptionCustomerKey() !=
null) {
+ throw new IllegalArgumentException(
+ "Only one of serverSideEncryption or
serverSideEncryptionCustomerKey may be configured, not both");
+ }
Review Comment:
💡 **Suggestion:** The mutual exclusion guard (lines 199–203) is duplicated
verbatim in `copyObject` (lines 284–288). Consider extracting it to a private
helper:
```java
private void validateEncryptionConfiguration() {
if (getConfiguration().getServerSideEncryption() != null
&& getConfiguration().getServerSideEncryptionCustomerKey() !=
null) {
throw new IllegalArgumentException(
"Only one of serverSideEncryption or
serverSideEncryptionCustomerKey may be configured, not both");
}
}
```
Then call `validateEncryptionConfiguration()` at the start of both methods.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]