gnodet-bot commented on code in PR #26486:
URL: https://github.com/apache/camel/pull/26486#discussion_r4021218561


##########
components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java:
##########
@@ -793,15 +840,15 @@ public String getXmlCipherAlgorithm() {
     }
 
     public void setXmlCipherAlgorithm(String xmlCipherAlgorithm) {
-        this.xmlCipherAlgorithm = xmlCipherAlgorithm;
+        this.xmlCipherAlgorithm = resolveAlgorithm(xmlCipherAlgorithm);

Review Comment:
   **Serialization regression — resolve lazily, not eagerly.**
   
   By resolving to the URI here, `getXmlCipherAlgorithm()` always returns a 
URI. The generated `ModelWriter` compares `getXmlCipherAlgorithm()` against the 
string `"AES_256_GCM"` to decide whether to suppress the default — that check 
now always fails, so the attribute is written unconditionally.
   
   Preferred fix: move `resolveAlgorithm()` to the marshal/unmarshal call-sites 
where the value is passed to `XMLCipher.getInstance()`, and leave the setter as 
a plain assignment:
   
   ```suggestion
           this.xmlCipherAlgorithm = xmlCipherAlgorithm;
   ```



##########
components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java:
##########
@@ -793,15 +840,15 @@ public String getXmlCipherAlgorithm() {
     }
 
     public void setXmlCipherAlgorithm(String xmlCipherAlgorithm) {
-        this.xmlCipherAlgorithm = xmlCipherAlgorithm;
+        this.xmlCipherAlgorithm = resolveAlgorithm(xmlCipherAlgorithm);
     }
 
     public String getKeyCipherAlgorithm() {
         return keyCipherAlgorithm;
     }
 
     public void setKeyCipherAlgorithm(String keyCipherAlgorithm) {
-        this.keyCipherAlgorithm = keyCipherAlgorithm;
+        this.keyCipherAlgorithm = resolveAlgorithm(keyCipherAlgorithm);

Review Comment:
   Same issue — `getKeyCipherAlgorithm()` now returns a URI, but the writer 
compares it against `"RSA_OAEP"`. Suggest lazy resolution at use-site.
   
   ```suggestion
           this.keyCipherAlgorithm = keyCipherAlgorithm;
   ```



##########
components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java:
##########
@@ -861,15 +908,15 @@ public String getDigestAlgorithm() {
     }
 
     public void setDigestAlgorithm(String digestAlgorithm) {
-        this.digestAlgorithm = digestAlgorithm;
+        this.digestAlgorithm = resolveAlgorithm(digestAlgorithm);

Review Comment:
   Same issue — writer default is `"SHA1"`, getter now returns a URI.
   
   ```suggestion
           this.digestAlgorithm = digestAlgorithm;
   ```



##########
components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java:
##########
@@ -861,15 +908,15 @@ public String getDigestAlgorithm() {
     }
 
     public void setDigestAlgorithm(String digestAlgorithm) {
-        this.digestAlgorithm = digestAlgorithm;
+        this.digestAlgorithm = resolveAlgorithm(digestAlgorithm);
     }
 
     public String getMgfAlgorithm() {
         return mgfAlgorithm;
     }
 
     public void setMgfAlgorithm(String mgfAlgorithm) {
-        this.mgfAlgorithm = mgfAlgorithm;
+        this.mgfAlgorithm = resolveAlgorithm(mgfAlgorithm);

Review Comment:
   Same issue — writer default is `"MGF1_SHA1"`, getter now returns a URI.
   
   ```suggestion
           this.mgfAlgorithm = mgfAlgorithm;
   ```



-- 
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]

Reply via email to