Author: ningjiang Date: Thu Dec 15 07:55:58 2011 New Revision: 1214648 URL: http://svn.apache.org/viewvc?rev=1214648&view=rev Log: Merged revisions 1214639 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk
........ r1214639 | ningjiang | 2011-12-15 15:10:05 +0800 (Thu, 15 Dec 2011) | 1 line CAMEL-4781 Improving NoTypeConversionAvailableException message with cause ........ Modified: camel/branches/camel-2.8.x/ (props changed) camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java Propchange: camel/branches/camel-2.8.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Dec 15 07:55:58 2011 @@ -1 +1 @@ -/camel/trunk:1202148,1202167,1202204-1202206,1202214-1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116,1206414,1207743,1207784,1208301,1208930,1208964-1208965,1209006-1209007,1209382,1209401,1209477,1209845-1209846,1210113,1210391,1210771,1210830,1211363,1211414,1211773,1211811,1212275-1212276,1212408,1213197,1213219,1213232,1213526,1214132 +/camel/trunk:1202148,1202167,1202204-1202206,1202214-1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116,1206414,1207743,1207784,1208301,1208930,1208964-1208965,1209006-1209007,1209382,1209401,1209477,1209845-1209846,1210113,1210391,1210771,1210830,1211363,1211414,1211773,1211811,1212275-1212276,1212408,1213197,1213219,1213232,1213526,1214132,1214639 Propchange: camel/branches/camel-2.8.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java?rev=1214648&r1=1214647&r2=1214648&view=diff ============================================================================== --- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java (original) +++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java Thu Dec 15 07:55:58 2011 @@ -34,8 +34,9 @@ public class NoTypeConversionAvailableEx } public NoTypeConversionAvailableException(Object value, Class<?> type, Throwable cause) { - this(value, type); - initCause(cause); + super(createMessage(value, type, cause), cause); + this.value = value; + this.type = type; } /** @@ -71,4 +72,13 @@ public class NoTypeConversionAvailableEx return "No type converter available to convert from type: " + (value != null ? value.getClass().getCanonicalName() : null) + " to the required type: " + type.getCanonicalName() + " with value " + value; } + + /** + * Returns an error message for no type converter available with the cause. + */ + public static String createMessage(Object value, Class<?> type, Throwable cause) { + return "Converting Exception when converting from type: " + + (value != null ? value.getClass().getCanonicalName() : null) + " to the required type: " + + type.getCanonicalName() + " with value " + value + ", which is caused by " + cause; + } }