I see, so line 63 should be a FallBackConverter? I guess a JIRA is in order.
https://fisheye6.atlassian.com/browse/camel/trunk/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/converters/MongoDbBasicConverters.java?hb=true In the case of this Mongo component I think it must have a from Object converter as any POJO could be passed to the endpoint. It sounds like FallBackConverter will over it though... On 9 October 2012 16:31, Claus Ibsen <claus.ib...@gmail.com> wrote: > On Tue, Oct 9, 2012 at 4:11 PM, Mark Doyle <markjohndo...@gmail.com> > wrote: > > Hi all, > > > > Camel-mongodb has a set of provided type converters. > > > > @Converter > > public static DBObject fromStringToDBObject(String s) { > > ..blah blah > > } > > > > @Converter > > public static DBObject fromAnyObjectToDBObject(Object value) { > > ...blah blah > > } > > This should be a @FallbackConverter instead. You should never convert > from Object -> XXX. > Instead it should be fallback and decided at runtime whether to convert or > not. > > > > > > > > I'm trying to run a query which means sending a json string. After some > > debugging it looks like Camel selects the fromAnyObjectToDBObject > converter > > rather than the fromStringToDBObject converter. I''m not sure of the > > consequences of this yet, with regards to the the mongodb component, but > it > > did raise the question on how Camel deals with converters that could > > overlap given inheritance, a String is an Object after all. > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > FuseSource is now part of Red Hat > Email: cib...@redhat.com > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen >