[ 
https://issues.apache.org/jira/browse/CAMEL-10504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16014127#comment-16014127
 ] 

Damien B edited comment on CAMEL-10504 at 5/17/17 2:40 PM:
-----------------------------------------------------------

Working on it. We can see the same behavior in the current (slightly modified) 
tests:
{code:java}
    @Test
    public void testMultiInsertStringFromListNoHeader() throws Exception {
        assertEquals(0, testCollection.count());
        Object result = template.requestBody("direct:insert", 
                Collections.newArrayList("{\"_id\":\"testInsertString\", 
\"scientist\":\"Einstein\"}",
                        "{\"_id\":\"testInsertString2\", 
\"scientist\":\"Einstein Too\"}"));
        assertTrue(result instanceof List);
        DBObject b = testCollection.find(new BasicDBObject("_id", 
"testInsertString")).first();
        assertNotNull("No record with 'testInsertString' _id", b);
        b = testCollection.find(new BasicDBObject("_id", 
"testInsertString2")).first();
        assertNotNull("No record with 'testInsertString' _id", b);
    }
{code}

{code}
2017-05-17 16:31:21,310 [main           ] WARN  MongoDbBasicConverters         
- Conversion has fallen back to generic Object -> DBObject, but unable to 
convert type java.util.ArrayList. Returning null. 
java.lang.IllegalArgumentException: Can not deserialize instance of 
java.util.LinkedHashMap out of START_ARRAY token
 at [Source: N/A; line: -1, column: -1]
2017-05-17 16:34:13,380 [main           ] WARN  MongoDbBasicConverters         
- Conversion has fallen back to generic Object -> DBObject, but unable to 
convert type org.apache.camel.impl.DefaultMessage. Returning null. 
java.lang.IllegalArgumentException: (was java.lang.NullPointerException) 
(through reference chain: 
org.apache.camel.impl.DefaultMessage["exchange"]->org.apache.camel.impl.DefaultExchange["context"]->org.apache.camel.spring.SpringCamelContext["managementNameStrategy"]->org.apache.camel.impl.DefaultManagementNameStrategy["name"])
{code}

Is there a way with the current structure of testing to check if those logs 
happen (I don't really want to parse camel-mongodb-test.log)?



was (Author: damien_b):
Working on it. We can see the same behavior in the current tests:
{code}
2017-05-17 16:31:21,310 [main           ] WARN  MongoDbBasicConverters         
- Conversion has fallen back to generic Object -> DBObject, but unable to 
convert type java.util.ArrayList. Returning null. 
java.lang.IllegalArgumentException: Can not deserialize instance of 
java.util.LinkedHashMap out of START_ARRAY token
 at [Source: N/A; line: -1, column: -1]
2017-05-17 16:34:13,380 [main           ] WARN  MongoDbBasicConverters         
- Conversion has fallen back to generic Object -> DBObject, but unable to 
convert type org.apache.camel.impl.DefaultMessage. Returning null. 
java.lang.IllegalArgumentException: (was java.lang.NullPointerException) 
(through reference chain: 
org.apache.camel.impl.DefaultMessage["exchange"]->org.apache.camel.impl.DefaultExchange["context"]->org.apache.camel.spring.SpringCamelContext["managementNameStrategy"]->org.apache.camel.impl.DefaultManagementNameStrategy["name"])
{code}

Is there a way with the current structure of testing to check if those logs 
happen (I don't really want to parse camel-mongodb-test.log)?


> Hiding an underlying exception if MongoDbBasicConverters fails to convert to 
> DBObject
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-10504
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10504
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mongodb
>    Affects Versions: 2.17.3, 2.18.0
>            Reporter: Evgenii Lomonosov
>            Assignee: Andrea Cosentino
>            Priority: Minor
>             Fix For: 2.18.1, 2.19.0
>
>
> If conversion fails it could be hard to understand what is a problem because 
> it returns just a message "Conversion has fallen back to generic Object -> 
> DBObject, but unable to convert type {}. Returning null" that points to a 
> class that was not converted.
> In case of, as example, if a list of objects that should be converted leads 
> to a memory error because of parent-child link are cycled for 2 objects, it 
> would take a lot of efforts to understand what is going on. And information 
> about underlying exception, stackoverflow in this case, could help to find 
> the root cause much faster than now.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to