You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Lars W (JIRA)" <ji...@apache.org> on 2018/03/22 17:11:00 UTC

[jira] [Created] (CONFIGURATION-692) Preserve ConversionException cause

Lars W created CONFIGURATION-692:
------------------------------------

             Summary: Preserve ConversionException cause
                 Key: CONFIGURATION-692
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-692
             Project: Commons Configuration
          Issue Type: Improvement
          Components: Type conversion
    Affects Versions: 2.2
            Reporter: Lars W


When improving the error message of the ConversionException thrown by the ConversionHandler in AbstractConfiguration.java:1768 the cause is lost.

If for example a string is converted into a URL the MalformedURLException, that contains the actual reason for the failed conversion, is gone.

A possible fix for that could be to attach the cause to the new ConversionException:

AbstractConfiguration.java:1768:

throw new ConversionException(
        String.format(
                "Key '%s' cannot be converted to class %s. Value is: '%s'.",
                key, cls.getName(), String.valueOf(value)), cex.getCause());

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)