Croway commented on PR #25871:
URL: https://github.com/apache/camel/pull/25871#issuecomment-5453084983

   Thanks for the rework. The `TypeConversionException` change addresses the 
actual error path, but the `MessageSupport` size guard should be removed.
   
   Please scope the implementation approximately as follows:
   
   ```java
   public static String createMessage(Object value, Class<?> type, Throwable 
cause) {
       // Do not concatenate value or invoke value.toString():
       // message bodies may be sensitive or extremely large.
       return "Error during type conversion from type: "
              + typeName(value != null ? value.getClass() : null)
              + " to the required type: " + typeName(type)
              + " due to " + cause.getClass().getName()
              + ": " + cause.getMessage();
   }
   ```
   
   The value can remain available through `getValue()`; it just should not be 
rendered in the message.
   
   Please move the regression coverage into the existing 
`TypeConversionExceptionMessageTest`, including:
   
   ```java
   // Fails immediately if exception construction invokes body.toString().
   Object body = new Object() {
       @Override
       public String toString() {
           throw new AssertionError("must not be called");
       }
   };
   
   TypeConversionException exception =
           new TypeConversionException(body, String.class, new 
RuntimeException("cause"));
   
   assertThat(exception.getValue()).isSameAs(body);
   assertThat(exception.getMessage())
           .contains(body.getClass().getName())
           .contains("cause");
   ```
   
   Please remove the `MessageSupport` guard and its configuration/tests, then 
update the PR description to reflect the reduced scope.


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