Dhairya-007 opened a new pull request, #29960:
URL: https://github.com/apache/camel/pull/29960

   ## Problem
   
   `JacksonXMLConstants` declares two public constants holding the same string:
   
   ```java
   public static final String ENABLE_TYPE_CONVERTER = 
"CamelJacksonXmlEnableTypeConverter";
   
   public static final String ENABLE_XML_TYPE_CONVERTER = 
"CamelJacksonXmlEnableTypeConverter";
   ```
   
   and the two sides of the feature reach for different ones. The fallback 
converter reads `ENABLE_XML_TYPE_CONVERTER`:
   
   ```java
   String text = 
exchange.getContext().getGlobalOptions().get(JacksonXMLConstants.ENABLE_XML_TYPE_CONVERTER);
   enabled = "true".equalsIgnoreCase(text);
   ```
   
   while both tests that switch it on set `ENABLE_TYPE_CONVERTER`:
   
   ```java
   context.getGlobalOptions().put(JacksonXMLConstants.ENABLE_TYPE_CONVERTER, 
"true");
   ```
   
   It works only because the two constants happen to hold the same value. 
Anyone reading the class has to check the string to find out that the two names 
are one option, and anything that changed one value without the other would 
break the feature silently - the converter would just stay disabled, with 
nothing to say why.
   
   `ENABLE_TYPE_CONVERTER` is the name `camel-jackson` and `camel-jackson3` use 
for the same switch, in their own `JacksonConstants`, so it is the one to keep.
   
   Both the Jackson 2 and the Jackson 3 copy of the component have this.
   
   ## Fix
   
   Read `ENABLE_TYPE_CONVERTER` in the converter and deprecate the XML-only 
duplicate.
   
   The global option name does not change - it is 
`CamelJacksonXmlEnableTypeConverter` either way - so nothing a route sets has 
to change, and the deprecated constant stays, so nothing stops compiling.


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