This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new c6b807e  Fix MongoDB InputStream conversion bug
     new 18eb634  Merge pull request #2954 from 
DenisIstomin/fix-mongodb-conversion
c6b807e is described below

commit c6b807e6208b103709c3b8d7bebb447fd01fa93b
Author: Denis Istomin <istomin....@gmail.com>
AuthorDate: Fri May 31 20:19:10 2019 +0500

    Fix MongoDB InputStream conversion bug
---
 .../component/mongodb3/converters/MongoDbBasicConverters.java     | 2 ++
 .../apache/camel/component/mongodb3/MongoDbConversionsTest.java   | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git 
a/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/converters/MongoDbBasicConverters.java
 
b/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/converters/MongoDbBasicConverters.java
index ac73a069..f647aa4 100644
--- 
a/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/converters/MongoDbBasicConverters.java
+++ 
b/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/converters/MongoDbBasicConverters.java
@@ -106,6 +106,8 @@ public final class MongoDbBasicConverters {
             } else if (!Character.isWhitespace(input[i])) {
                 return true;
             }
+
+            i++;
         }
         return true;
     }
diff --git 
a/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbConversionsTest.java
 
b/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbConversionsTest.java
index d4b3dc9..9c14d5d 100644
--- 
a/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbConversionsTest.java
+++ 
b/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbConversionsTest.java
@@ -81,6 +81,14 @@ public class MongoDbConversionsTest extends 
AbstractMongoDbTest {
     }
 
     @Test
+    public void testInsertJsonInputStreamWithSpaces() throws Exception {
+        assertEquals(0, testCollection.count());
+        template.requestBody("direct:insertJsonString", 
IOConverter.toInputStream("    {\"test\": [\"test\"], \"_id\": 
\"testInsertJsonStringWithSpaces\"}\n", null));
+        Document b = testCollection.find(eq(MONGO_ID, 
"testInsertJsonStringWithSpaces")).first();
+        assertNotNull("No record with 'testInsertJsonStringWithSpaces' _id", 
b);
+    }
+
+    @Test
     public void testInsertBsonInputStream() {
         assertEquals(0, testCollection.count());
 

Reply via email to