You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/09/06 07:52:49 UTC

[camel] 03/09: CAMEL-13851: checkstyle fixes and cleanups

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

commit 8222a95281eafe420487447bd20ccc27c57d08d9
Author: Marc Giger <gi...@apache.org>
AuthorDate: Thu Aug 22 19:47:45 2019 +0200

    CAMEL-13851: checkstyle fixes and cleanups
---
 components/camel-xj/pom.xml                        |  32 +-
 .../camel/component/xj/JsonFileResultHandler.java  |   1 +
 .../component/xj/JsonFileResultHandlerFactory.java |   3 +-
 .../component/xj/JsonSourceHandlerFactoryImpl.java |   4 +-
 .../component/xj/JsonStreamResultHandler.java      |   3 +-
 .../xj/JsonStreamResultHandlerFactory.java         |   3 +-
 .../component/xj/JsonStringResultHandler.java      |   1 +
 .../xj/JsonStringResultHandlerFactory.java         |   3 +-
 .../camel/component/xj/JsonXmlStreamReader.java    | 185 +++----
 .../org/apache/camel/component/xj/XJConstants.java |   7 +-
 .../org/apache/camel/component/xj/XJEndpoint.java  |  21 +-
 .../camel/component/xj/XmlJsonStreamWriter.java    | 557 ++++++++++-----------
 .../camel/component/xj/J2XInputStreamTest.java     |  10 +-
 .../camel/component/xj/J2XOutputBytesTest.java     |   4 +-
 .../camel/component/xj/J2XOutputFileTest.java      |   8 +-
 .../camel/component/xj/J2XOutputIdentityTest.java  |  12 +-
 .../camel/component/xj/J2XOutputStringTest.java    |   4 +-
 .../camel/component/xj/X2JInputStreamTest.java     |  10 +-
 .../camel/component/xj/X2JOutputBytesTest.java     |   4 +-
 .../camel/component/xj/X2JOutputFileTest.java      |   8 +-
 .../camel/component/xj/X2JOutputIdentityTest.java  |   4 +-
 .../camel/component/xj/X2JOutputStringTest.java    |   4 +-
 .../org/apache/camel/component/xj/XJTestUtils.java |  80 +--
 .../camel-xj/src/test/resources/json2xml/test1.xml |  18 +
 .../src/test/resources/json2xml/test10.xml         |  18 +
 .../src/test/resources/json2xml/test11.xml         |  21 +-
 .../camel-xj/src/test/resources/json2xml/test2.xml |  18 +
 .../camel-xj/src/test/resources/json2xml/test3.xml |  18 +
 .../camel-xj/src/test/resources/json2xml/test4.xml |  18 +
 .../camel-xj/src/test/resources/json2xml/test5.xml |  18 +
 .../camel-xj/src/test/resources/json2xml/test6.xml |  18 +
 .../camel-xj/src/test/resources/json2xml/test7.xml |  18 +
 .../camel-xj/src/test/resources/json2xml/test8.xml |  18 +
 .../camel-xj/src/test/resources/json2xml/test9.xml |  18 +
 .../camel-xj/src/test/resources/log4j2.properties  |  32 +-
 .../camel-xj/src/test/resources/xml2json/test1.xml |  18 +
 .../src/test/resources/xml2json/test10.xml         |  18 +
 .../src/test/resources/xml2json/test11.xml         |  18 +
 .../src/test/resources/xml2json/test12.xml         |  18 +
 .../src/test/resources/xml2json/test13.xml         |  18 +
 .../src/test/resources/xml2json/test14.xml         |  18 +
 .../src/test/resources/xml2json/test15.xml         |  18 +
 .../src/test/resources/xml2json/test16.xml         |  18 +
 .../src/test/resources/xml2json/test17.xml         |  18 +
 .../src/test/resources/xml2json/test18.xml         |  18 +
 .../src/test/resources/xml2json/test19.xml         |  18 +
 .../camel-xj/src/test/resources/xml2json/test2.xml |  18 +
 .../src/test/resources/xml2json/test20.xml         |  18 +
 .../src/test/resources/xml2json/test21.xml         |  18 +
 .../src/test/resources/xml2json/test22.xml         |  18 +
 .../src/test/resources/xml2json/test23.xml         |  18 +
 .../camel-xj/src/test/resources/xml2json/test3.xml |  18 +
 .../camel-xj/src/test/resources/xml2json/test4.xml |  18 +
 .../camel-xj/src/test/resources/xml2json/test5.xml |  18 +
 .../camel-xj/src/test/resources/xml2json/test6.xml |  18 +
 .../camel-xj/src/test/resources/xml2json/test7.xml |  18 +
 .../camel-xj/src/test/resources/xml2json/test8.xml |  21 +-
 .../camel-xj/src/test/resources/xml2json/test9.xml |  21 +-
 58 files changed, 1127 insertions(+), 494 deletions(-)

diff --git a/components/camel-xj/pom.xml b/components/camel-xj/pom.xml
index 3d593ff..a7655c2 100644
--- a/components/camel-xj/pom.xml
+++ b/components/camel-xj/pom.xml
@@ -1,20 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandler.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandler.java
index 538976f..e9bb8b3 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandler.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandler.java
@@ -37,6 +37,7 @@ public class JsonFileResultHandler implements ResultHandler {
 
     /**
      * Creates a new json to file result handler instance
+     *
      * @param jsonFactory the {@link JsonFactory} to use to write the json.
      */
     public JsonFileResultHandler(JsonFactory jsonFactory, File file) throws Exception {
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandlerFactory.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandlerFactory.java
index d56a320..59ce3a2 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandlerFactory.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandlerFactory.java
@@ -25,13 +25,14 @@ import org.apache.camel.component.xslt.ResultHandlerFactory;
 import org.apache.camel.support.ExchangeHelper;
 
 /**
- * {@JsonFileResultHandler} factory
+ * A {@link JsonFileResultHandler} factory
  */
 public class JsonFileResultHandlerFactory implements ResultHandlerFactory {
     private final JsonFactory jsonFactory;
 
     /**
      * Creates a new json to file result handler factory
+     *
      * @param jsonFactory the {@link JsonFactory} to use to write the json.
      */
     public JsonFileResultHandlerFactory(JsonFactory jsonFactory) {
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonSourceHandlerFactoryImpl.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonSourceHandlerFactoryImpl.java
index 9ba17a8..07c0305 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonSourceHandlerFactoryImpl.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonSourceHandlerFactoryImpl.java
@@ -35,11 +35,12 @@ import org.apache.camel.component.xslt.SourceHandlerFactory;
  */
 public class JsonSourceHandlerFactoryImpl implements SourceHandlerFactory {
 
-    private JsonFactory jsonFactory;
+    private final JsonFactory jsonFactory;
     private boolean isFailOnNullBody = true;
 
     /**
      * Creates a new instance
+     *
      * @param jsonFactory the jsonFactory to use to read the json document
      */
     public JsonSourceHandlerFactoryImpl(JsonFactory jsonFactory) {
@@ -55,7 +56,6 @@ public class JsonSourceHandlerFactoryImpl implements SourceHandlerFactory {
 
     /**
      * Set if we should fail when the body is null
-     * @param failOnNullBody
      */
     public void setFailOnNullBody(boolean failOnNullBody) {
         isFailOnNullBody = failOnNullBody;
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStreamResultHandler.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStreamResultHandler.java
index 4bf71f1..3cf9303 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStreamResultHandler.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStreamResultHandler.java
@@ -28,7 +28,7 @@ import org.apache.camel.Message;
 import org.apache.camel.component.xslt.ResultHandler;
 
 /**
- * Result handler impl. to write a json document into a {@ByteArrayOutputStream}
+ * Result handler impl. to write a json document into a {@link ByteArrayOutputStream}
  */
 public class JsonStreamResultHandler implements ResultHandler {
 
@@ -37,6 +37,7 @@ public class JsonStreamResultHandler implements ResultHandler {
 
     /**
      * Creates a new json to stream result handler instance
+     *
      * @param jsonFactory the {@link JsonFactory} to use to write the json.
      */
     public JsonStreamResultHandler(JsonFactory jsonFactory) throws Exception {
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStreamResultHandlerFactory.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStreamResultHandlerFactory.java
index f9034fe..3485700 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStreamResultHandlerFactory.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStreamResultHandlerFactory.java
@@ -22,13 +22,14 @@ import org.apache.camel.component.xslt.ResultHandler;
 import org.apache.camel.component.xslt.ResultHandlerFactory;
 
 /**
- * {@JsonStreamResultHandler} factory
+ * A {@link JsonStreamResultHandler} factory
  */
 public class JsonStreamResultHandlerFactory implements ResultHandlerFactory {
     private final JsonFactory jsonFactory;
 
     /**
      * Creates a new json to stream result handler factory
+     *
      * @param jsonFactory the {@link JsonFactory} to use to write the json.
      */
     public JsonStreamResultHandlerFactory(JsonFactory jsonFactory) {
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStringResultHandler.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStringResultHandler.java
index 7abf4e0..99da73b 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStringResultHandler.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStringResultHandler.java
@@ -36,6 +36,7 @@ public class JsonStringResultHandler implements ResultHandler {
 
     /**
      * Creates a new json to string result handler instance
+     *
      * @param jsonFactory the {@link JsonFactory} to use to write the json.
      */
     public JsonStringResultHandler(JsonFactory jsonFactory) throws Exception {
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStringResultHandlerFactory.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStringResultHandlerFactory.java
index c534c68..8c605e0 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStringResultHandlerFactory.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonStringResultHandlerFactory.java
@@ -22,7 +22,7 @@ import org.apache.camel.component.xslt.ResultHandler;
 import org.apache.camel.component.xslt.ResultHandlerFactory;
 
 /**
- * {@JsonStringResultHandler} factory
+ * A {@link JsonStringResultHandler} factory
  */
 public class JsonStringResultHandlerFactory implements ResultHandlerFactory {
 
@@ -30,6 +30,7 @@ public class JsonStringResultHandlerFactory implements ResultHandlerFactory {
 
     /**
      * Creates a new json to string result handler factory
+     *
      * @param jsonFactory the {@link JsonFactory} to use to write the json.
      */
     public JsonStringResultHandlerFactory(JsonFactory jsonFactory) {
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonXmlStreamReader.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonXmlStreamReader.java
index b1d9e1a..ffd99d0 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonXmlStreamReader.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonXmlStreamReader.java
@@ -18,6 +18,7 @@
 package org.apache.camel.component.xj;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -40,6 +41,10 @@ import com.fasterxml.jackson.core.JsonToken;
  */
 public class JsonXmlStreamReader implements XMLStreamReader {
 
+    private static final String ERROR_MSG_NOT_IN_START_ELEMENT = "Current event is not start element";
+    private static final String ERROR_MSG_NOT_IN_START_END_ELEMENT = "Current event is not start element";
+    private static final String ERROR_MSG_NOT_IN_CHARACTERS = "Current event is not character";
+
     private static final Location LOCATION = new Location() {
         @Override
         public int getLineNumber() {
@@ -68,10 +73,13 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     };
 
     private final JsonParser jsonParser;
+    private final Deque<StackElement> tokenStack = new ArrayDeque<>();
+    private boolean eof;
 
-    private Deque<StackElement> tokenStack = new ArrayDeque<>();
-    private boolean eof = false;
-
+    /**
+     * Creates a new JsonXmlStreamReader instance
+     * @param jsonParser the {@link JsonParser} to use to read the json document.
+     */
     public JsonXmlStreamReader(JsonParser jsonParser) {
         this.jsonParser = jsonParser;
     }
@@ -87,29 +95,30 @@ public class JsonXmlStreamReader implements XMLStreamReader {
             final StackElement previousElement = tokenStack.peek();
             if (previousElement != null) {
                 switch (previousElement.jsonToken) {
-                    case VALUE_STRING:
-                    case VALUE_NUMBER_INT:
-                    case VALUE_NUMBER_FLOAT:
-                    case VALUE_NULL:
-                    case VALUE_TRUE:
-                    case VALUE_FALSE: {
-                        switch (previousElement.xmlEvent) {
-                            case XMLEvent.START_ELEMENT:
-                                previousElement.xmlEvent = XMLEvent.CHARACTERS;
-                                return XMLEvent.CHARACTERS;
-
-                            case XMLEvent.CHARACTERS:
-                                removeStackElement(previousElement.jsonToken);
-                                removeStackElement(JsonToken.FIELD_NAME);
-
-                                tokenStack.peek().xmlEvent = XMLEvent.END_ELEMENT;
-                                return XMLEvent.END_ELEMENT;
-
-                            default:
-                                throw new IllegalStateException("illegal state");
-                        }
+                case VALUE_STRING:
+                case VALUE_NUMBER_INT:
+                case VALUE_NUMBER_FLOAT:
+                case VALUE_NULL:
+                case VALUE_TRUE:
+                case VALUE_FALSE: {
+                    switch (previousElement.xmlEvent) {
+                    case XMLEvent.START_ELEMENT:
+                        previousElement.xmlEvent = XMLEvent.CHARACTERS;
+                        return XMLEvent.CHARACTERS;
+                    case XMLEvent.CHARACTERS:
+                        removeStackElement(previousElement.jsonToken);
+                        removeStackElement(JsonToken.FIELD_NAME);
+
+                        assert tokenStack.peek() != null;
+                        tokenStack.peek().xmlEvent = XMLEvent.END_ELEMENT;
+                        return XMLEvent.END_ELEMENT;
+                    default:
+                        throw new IllegalStateException("illegal state");
                     }
                 }
+                default:
+                    break;
+                }
             }
 
             if (eof) {
@@ -132,36 +141,33 @@ public class JsonXmlStreamReader implements XMLStreamReader {
             }
 
             switch (currentToken) {
-                case START_OBJECT:
-                case START_ARRAY:
-                    stackElement.xmlEvent = XMLEvent.START_ELEMENT;
-
-                    return XMLEvent.START_ELEMENT;
-                case END_OBJECT:
-                    removeStackElement(JsonToken.END_OBJECT);
-                    removeStackElement(JsonToken.START_OBJECT);
-                    removeStackElement(JsonToken.FIELD_NAME);
-                    eof = tokenStack.size() == 0;
-
-                    return XMLEvent.END_ELEMENT;
-                case END_ARRAY:
-                    removeStackElement(JsonToken.END_ARRAY);
-                    removeStackElement(JsonToken.START_ARRAY);
-                    removeStackElement(JsonToken.FIELD_NAME);
-                    eof = tokenStack.size() == 0;
-
-                    return XMLEvent.END_ELEMENT;
-                case VALUE_STRING:
-                case VALUE_NUMBER_INT:
-                case VALUE_NUMBER_FLOAT:
-                case VALUE_NULL:
-                case VALUE_TRUE:
-                case VALUE_FALSE:
-                    stackElement.xmlEvent = XMLEvent.START_ELEMENT;
-
-                    return XMLEvent.START_ELEMENT;
-                default:
-                    throw new IllegalStateException("JsonToken: " + currentToken);
+            case START_OBJECT:
+            case START_ARRAY:
+            case VALUE_STRING:
+            case VALUE_NUMBER_INT:
+            case VALUE_NUMBER_FLOAT:
+            case VALUE_NULL:
+            case VALUE_TRUE:
+            case VALUE_FALSE:
+                stackElement.xmlEvent = XMLEvent.START_ELEMENT;
+
+                return XMLEvent.START_ELEMENT;
+            case END_OBJECT:
+                removeStackElement(JsonToken.END_OBJECT);
+                removeStackElement(JsonToken.START_OBJECT);
+                removeStackElement(JsonToken.FIELD_NAME);
+                eof = tokenStack.size() == 0;
+
+                return XMLEvent.END_ELEMENT;
+            case END_ARRAY:
+                removeStackElement(JsonToken.END_ARRAY);
+                removeStackElement(JsonToken.START_ARRAY);
+                removeStackElement(JsonToken.FIELD_NAME);
+                eof = tokenStack.size() == 0;
+
+                return XMLEvent.END_ELEMENT;
+            default:
+                throw new IllegalStateException("JsonToken: " + currentToken);
             }
 
         } catch (IOException e) {
@@ -173,7 +179,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.jsonToken != jsonToken)) {
             if (stackElement != null && jsonToken == JsonToken.FIELD_NAME && (stackElement.jsonToken == JsonToken.START_ARRAY)) {
-                // anonym array
+                // anonymous array
                 return;
             }
 
@@ -190,12 +196,12 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     }
 
     @Override
-    public void require(int type, String namespaceURI, String localName) throws XMLStreamException {
+    public void require(int type, String namespaceURI, String localName) {
         throw new UnsupportedOperationException(XJConstants.UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE);
     }
 
     @Override
-    public String getElementText() throws XMLStreamException {
+    public String getElementText() {
         throw new UnsupportedOperationException(XJConstants.UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE);
     }
 
@@ -210,7 +216,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     }
 
     @Override
-    public boolean hasNext() throws XMLStreamException {
+    public boolean hasNext() {
         return !eof;
     }
 
@@ -272,7 +278,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public int getAttributeCount() {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_ELEMENT);
         }
 
         return stackElement.getAttributeCount();
@@ -282,7 +288,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public QName getAttributeName(int index) {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_ELEMENT);
         }
 
         return stackElement.getAttribute(index);
@@ -292,7 +298,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public String getAttributeNamespace(int index) {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_ELEMENT);
         }
 
         return stackElement.getAttribute(index).getNamespaceURI();
@@ -302,7 +308,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public String getAttributeLocalName(int index) {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_ELEMENT);
         }
 
         return stackElement.getAttribute(index).getLocalPart();
@@ -312,7 +318,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public String getAttributePrefix(int index) {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_ELEMENT);
         }
 
         return stackElement.getAttribute(index).getPrefix();
@@ -322,7 +328,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public String getAttributeType(int index) {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_ELEMENT);
         }
 
         return "CDATA";
@@ -332,7 +338,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public String getAttributeValue(int index) {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_ELEMENT);
         }
 
         return tokenStack.peek().getAttributeValue(index);
@@ -357,7 +363,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public String getNamespacePrefix(int index) {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT && stackElement.xmlEvent != XMLEvent.END_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_END_ELEMENT);
         }
 
         return XJConstants.NS_PREFIX_XJ;
@@ -367,7 +373,7 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public String getNamespaceURI(int index) {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || (stackElement.xmlEvent != XMLEvent.START_ELEMENT && stackElement.xmlEvent != XMLEvent.END_ELEMENT)) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_START_END_ELEMENT);
         }
 
         return XJConstants.NS_XJ;
@@ -400,19 +406,19 @@ public class JsonXmlStreamReader implements XMLStreamReader {
     public char[] getTextCharacters() {
         final StackElement stackElement = tokenStack.peek();
         if (stackElement == null || stackElement.xmlEvent != XMLEvent.CHARACTERS) {
-            throw new IllegalStateException();
+            throw new IllegalStateException(ERROR_MSG_NOT_IN_CHARACTERS);
         }
 
         try {
             setXmlText(stackElement, jsonParser);
             return stackElement.value;
         } catch (IOException e) {
-            throw new IllegalStateException(e);
+            throw new UncheckedIOException(e);
         }
     }
 
     @Override
-    public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException {
+    public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) {
         final char[] text = getTextCharacters();
         System.arraycopy(text, sourceStart, target, targetStart, length);
 
@@ -430,10 +436,11 @@ public class JsonXmlStreamReader implements XMLStreamReader {
         final StackElement stackElement = tokenStack.peek();
 
         try {
+            assert stackElement != null;
             setXmlText(stackElement, jsonParser);
             return stackElement.value.length;
         } catch (IOException e) {
-            throw new IllegalStateException(e);
+            throw new UncheckedIOException(e);
         }
     }
 
@@ -552,13 +559,16 @@ public class JsonXmlStreamReader implements XMLStreamReader {
         return Arrays.copyOfRange(res, 0, copied);
     }
 
+    /**
+     * Class that represents an element on the stack.
+     */
     private static class StackElement {
 
-        private JsonToken jsonToken;
-        private String name;
+        private final JsonToken jsonToken;
+        private final String name;
+        private final List<QName> attributes;
         private int xmlEvent;
         private char[] value;
-        private List<QName> attributes;
 
         StackElement(JsonToken jsonToken, String name) {
             this.jsonToken = jsonToken;
@@ -571,7 +581,6 @@ public class JsonXmlStreamReader implements XMLStreamReader {
                 attributes.add(nameAttribute);
             }
 
-            // todo configurable if type hints should be emitted?
             final QName typeAttribute = new QName(XJConstants.NS_XJ, XJConstants.TYPE_HINT_TYPE, XJConstants.NS_PREFIX_XJ);
             attributes.add(typeAttribute);
         }
@@ -587,24 +596,24 @@ public class JsonXmlStreamReader implements XMLStreamReader {
         String getAttributeValue(int idx) {
             final QName attribute = getAttribute(idx);
             switch (attribute.getLocalPart()) {
-                case XJConstants.TYPE_HINT_NAME:
-                    return this.name;
-                case XJConstants.TYPE_HINT_TYPE:
-                    return XJConstants.JSONTYPE_TYPE_MAP.get(this.jsonToken);
-                default:
-                    throw new IllegalArgumentException("Unknown attribute");
+            case XJConstants.TYPE_HINT_NAME:
+                return this.name;
+            case XJConstants.TYPE_HINT_TYPE:
+                return XJConstants.JSONTYPE_TYPE_MAP.get(this.jsonToken);
+            default:
+                throw new IllegalArgumentException("Unknown attribute " + attribute.getLocalPart());
             }
         }
 
         @Override
         public String toString() {
-            return "StackElement{" +
-                    "jsonToken=" + jsonToken +
-                    ", name='" + name + '\'' +
-                    ", xmlEvent=" + xmlEvent +
-                    ", value=" + Arrays.toString(value) +
-                    ", attributes=" + attributes +
-                    '}';
+            return "StackElement{"
+                    + "jsonToken=" + jsonToken
+                    + ", name='" + name + '\''
+                    + ", xmlEvent=" + xmlEvent
+                    + ", value=" + Arrays.toString(value)
+                    + ", attributes=" + attributes
+                    + '}';
         }
     }
 }
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJConstants.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJConstants.java
index 82ee635..8945d2a 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJConstants.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJConstants.java
@@ -23,7 +23,7 @@ import java.util.Map;
 
 import com.fasterxml.jackson.core.JsonToken;
 
-public class XJConstants {
+public final class XJConstants {
 
     /**
      * The namespace used by xj for typehints
@@ -59,6 +59,11 @@ public class XJConstants {
 
     static final String UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE = "unsupported / not yet implemented";
 
+    /**
+     * Field name when xml contains mixed-content
+     */
+    static final String JSON_WRITER_MIXED_CONTENT_TEXT_KEY = "#text";
+
     static {
         final Map<JsonToken, String> jsonTypeTypeMap = new HashMap<>();
         jsonTypeTypeMap.put(JsonToken.START_OBJECT, "object");
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
index 9c80dd9..6c4a6f0 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
@@ -34,7 +34,7 @@ import org.apache.camel.util.ObjectHelper;
 @UriEndpoint(firstVersion = "3.0.0", scheme = "xj", title = "XJ", syntax = "xj:resourceUri", producerOnly = true, label = "transformation")
 public class XJEndpoint extends XsltEndpoint {
 
-    private JsonFactory jsonFactory = new JsonFactory();
+    private final JsonFactory jsonFactory = new JsonFactory();
 
     @UriParam
     @Metadata(required = true, description = "Transform direction. Either XML2JSON or JSON2XML")
@@ -59,7 +59,8 @@ public class XJEndpoint extends XsltEndpoint {
     @Override
     protected void doStart() throws Exception {
         if (ObjectHelper.isEmpty(getResourceUri())) {
-            // todo using a stylesheet for "identity" transform is slow. But with transformerFactory we can't get an identity transformer...
+            // Using a stylesheet for "identity" transform is slow. but with a {@link TransformerFactory}
+            // we can't get an identity transformer. But for now we leave it that way.
             setResourceUri("org/apache/camel/component/xj/identity.xsl");
         }
 
@@ -93,14 +94,14 @@ public class XJEndpoint extends XsltEndpoint {
      */
     protected void configureOutput(XsltBuilder xsltBuilder, String output) throws Exception {
         switch (this.transformDirection) {
-            case JSON2XML:
-                super.configureOutput(xsltBuilder, output);
-                break;
-            case XML2JSON:
-                configureJsonOutput(xsltBuilder, output);
-                break;
-            default:
-                throw new IllegalArgumentException("Unknown transformation direction: " + this.transformDirection);
+        case JSON2XML:
+            super.configureOutput(xsltBuilder, output);
+            break;
+        case XML2JSON:
+            configureJsonOutput(xsltBuilder, output);
+            break;
+        default:
+            throw new IllegalArgumentException("Unknown transformation direction: " + this.transformDirection);
         }
     }
 
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XmlJsonStreamWriter.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XmlJsonStreamWriter.java
index a9ef928..31ceb29 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XmlJsonStreamWriter.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XmlJsonStreamWriter.java
@@ -41,29 +41,38 @@ import com.fasterxml.jackson.core.JsonToken;
  */
 public class XmlJsonStreamWriter implements XMLStreamWriter {
 
-    private static final String JSON_MIXED_CONTENT_TEXT_KEY = "#text";
-
     private final JsonGenerator jsonGenerator;
 
+    /**
+     * Root element of the internal tree
+     */
     private TreeElement treeRoot;
+
+    /**
+     * Reference to current "level-s" element
+     */
     private TreeElement currentTreeElement;
 
+    /**
+     * Creates a new XmlJsonStreamWriter instance
+     * @param jsonGenerator the {@link JsonGenerator} to use to write the json document
+     */
     public XmlJsonStreamWriter(JsonGenerator jsonGenerator) {
         this.jsonGenerator = jsonGenerator;
     }
 
     @Override
-    public void writeStartElement(String localName) throws XMLStreamException {
+    public void writeStartElement(String localName) {
         writeStartElement(null, localName, null);
     }
 
     @Override
-    public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException {
+    public void writeStartElement(String namespaceURI, String localName) {
         writeStartElement(null, localName, namespaceURI);
     }
 
     @Override
-    public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
+    public void writeStartElement(String prefix, String localName, String namespaceURI) {
         final TreeElement treeElement = new TreeElement(currentTreeElement, XMLEvent.START_ELEMENT, localName);
 
         currentTreeElement.addChild(treeElement);
@@ -71,30 +80,26 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
     }
 
     @Override
-    public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException {
+    public void writeEmptyElement(String namespaceURI, String localName) {
         writeStartElement(null, namespaceURI, localName);
         writeEndElement();
     }
 
     @Override
-    public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
+    public void writeEmptyElement(String prefix, String localName, String namespaceURI) {
         writeStartElement(prefix, localName, namespaceURI);
         writeEndElement();
     }
 
     @Override
-    public void writeEmptyElement(String localName) throws XMLStreamException {
+    public void writeEmptyElement(String localName) {
         writeStartElement(null, localName, null);
         writeEndElement();
     }
 
     @Override
-    public void writeEndElement() throws XMLStreamException {
-        try {
-            currentTreeElement.writeEnd();
-        } catch (IOException e) {
-            throw new XMLStreamException(e);
-        }
+    public void writeEndElement() {
+        currentTreeElement.writeEnd();
         currentTreeElement = currentTreeElement.parent;
     }
 
@@ -126,23 +131,23 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
     }
 
     @Override
-    public void writeAttribute(String localName, String value) throws XMLStreamException {
+    public void writeAttribute(String localName, String value) {
         writeAttribute(null, null, localName, value);
     }
 
     @Override
-    public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException {
+    public void writeAttribute(String prefix, String namespaceURI, String localName, String value) {
         if (XJConstants.NS_XJ.equals(namespaceURI)) {
             switch (localName) {
-                case XJConstants.TYPE_HINT_NAME:
-                    currentTreeElement.setName(value);
-                    return;
-                case XJConstants.TYPE_HINT_TYPE:
-                    currentTreeElement.setJsonToken(XJConstants.TYPE_JSONTYPE_MAP.get(value));
-                    return;
+            case XJConstants.TYPE_HINT_NAME:
+                currentTreeElement.setName(value);
+                return;
+            case XJConstants.TYPE_HINT_TYPE:
+                currentTreeElement.setJsonToken(XJConstants.TYPE_JSONTYPE_MAP.get(value));
+                return;
+            default:
+                return;
             }
-
-            return;
         }
 
         final TreeElement treeElement = new TreeElement(currentTreeElement, XMLEvent.ATTRIBUTE, JsonToken.VALUE_STRING, localName);
@@ -152,62 +157,69 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
     }
 
     @Override
-    public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException {
+    public void writeAttribute(String namespaceURI, String localName, String value) {
         writeAttribute(null, namespaceURI, localName, value);
     }
 
     @Override
-    public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException {
+    public void writeNamespace(String prefix, String namespaceURI) {
+        // ignore event - we don't care
     }
 
     @Override
-    public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException {
+    public void writeDefaultNamespace(String namespaceURI) {
+        // ignore event - we don't care
     }
 
     @Override
-    public void writeComment(String data) throws XMLStreamException {
+    public void writeComment(String data) {
+        // ignore event - we don't care
     }
 
     @Override
-    public void writeProcessingInstruction(String target) throws XMLStreamException {
+    public void writeProcessingInstruction(String target) {
+        // ignore event - we don't care
     }
 
     @Override
-    public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
+    public void writeProcessingInstruction(String target, String data) {
+        // ignore event - we don't care
     }
 
     @Override
-    public void writeCData(String data) throws XMLStreamException {
+    public void writeCData(String data) {
         writeCharacters(data);
     }
 
     @Override
-    public void writeDTD(String dtd) throws XMLStreamException {
+    public void writeDTD(String dtd) {
+        // ignore event - we don't care
     }
 
     @Override
-    public void writeEntityRef(String name) throws XMLStreamException {
+    public void writeEntityRef(String name) {
+        // ignore event - we don't care
     }
 
     @Override
-    public void writeStartDocument() throws XMLStreamException {
+    public void writeStartDocument() {
         writeStartDocument(null);
     }
 
     @Override
-    public void writeStartDocument(String version) throws XMLStreamException {
+    public void writeStartDocument(String version) {
         writeStartDocument(null, version);
     }
 
     @Override
-    public void writeStartDocument(String encoding, String version) throws XMLStreamException {
+    public void writeStartDocument(String encoding, String version) {
         final TreeElement treeElement = new TreeElement(null, XMLEvent.START_DOCUMENT, JsonToken.NOT_AVAILABLE);
         this.treeRoot = treeElement;
         this.currentTreeElement = treeElement;
     }
 
     @Override
-    public void writeCharacters(String text) throws XMLStreamException {
+    public void writeCharacters(String text) {
         // check for non coalescing read
         final List<TreeElement> childs = currentTreeElement.childs;
         if (childs.size() > 0) {
@@ -226,30 +238,33 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
     }
 
     @Override
-    public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
+    public void writeCharacters(char[] text, int start, int len) {
         writeCharacters(new String(text, start, len));
     }
 
     @Override
-    public String getPrefix(String uri) throws XMLStreamException {
+    public String getPrefix(String uri) {
         return null;
     }
 
     @Override
-    public void setPrefix(String prefix, String uri) throws XMLStreamException {
+    public void setPrefix(String prefix, String uri) {
+        // ignore - ATM we don't care
     }
 
     @Override
-    public void setDefaultNamespace(String uri) throws XMLStreamException {
+    public void setDefaultNamespace(String uri) {
+        // ignore - ATM we don't care
     }
 
     @Override
-    public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
+    public NamespaceContext getNamespaceContext() {
+        throw new UnsupportedOperationException(XJConstants.UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE);
     }
 
     @Override
-    public NamespaceContext getNamespaceContext() {
-        throw new UnsupportedOperationException(XJConstants.UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE);
+    public void setNamespaceContext(NamespaceContext context) {
+        // ignore - ATM we don't care
     }
 
     @Override
@@ -257,7 +272,9 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
         throw new IllegalArgumentException(name + " unsupported");
     }
 
-
+    /**
+     * Class that represents an element of the internal tree
+     */
     private static class TreeElement {
 
         private TreeElement parent;
@@ -317,179 +334,98 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
             this.value += value;
         }
 
-        void writeEnd() throws IOException {
+        void writeEnd() {
             if (jsonToken == null) {
+                // no type hints
                 writeEndNoTypeHints();
-            } else { // type hints
-                // move type hints
+            } else {
+                // type hints given
                 writeEndHaveTypeHints();
             }
         }
 
         private void writeEndNoTypeHints() {
-            switch (xmlEvent) {
-                case XMLEvent.START_ELEMENT:
-                    if (childs.isEmpty()) {
-                        // empty root element
-                        if (this.parent.jsonToken == JsonToken.NOT_AVAILABLE) {
-                            jsonToken = JsonToken.START_OBJECT;
-                        } else {
-                            jsonToken = JsonToken.FIELD_NAME;
+            if (xmlEvent == XMLEvent.START_ELEMENT) {
+                if (childs.isEmpty()) {
+                    // empty root element
+                    if (this.parent.jsonToken == JsonToken.NOT_AVAILABLE) {
+                        jsonToken = JsonToken.START_OBJECT;
+                    } else {
+                        jsonToken = JsonToken.FIELD_NAME;
 
-                            final TreeElement treeElement = new TreeElement(this, -1, JsonToken.VALUE_STRING);
-                            treeElement.setValue("");
-                            this.addChild(treeElement);
-                        }
-                    } else if (childs.size() == 1 && childs.get(0).xmlEvent == XMLEvent.CHARACTERS) {
-                        // just character childs.
+                        final TreeElement treeElement = new TreeElement(this, -1, JsonToken.VALUE_STRING);
+                        treeElement.setValue("");
+                        this.addChild(treeElement);
+                    }
+                } else if (childs.size() == 1 && childs.get(0).xmlEvent == XMLEvent.CHARACTERS) {
+                    // just character childs.
 
-                        // empty root element
-                        if (this.parent.jsonToken == JsonToken.NOT_AVAILABLE) {
-                            jsonToken = JsonToken.START_OBJECT;
+                    // empty root element
+                    if (this.parent.jsonToken == JsonToken.NOT_AVAILABLE) {
+                        jsonToken = JsonToken.START_OBJECT;
 
-                            final TreeElement child = childs.get(0);
-                            if (isWhitespace(child.value)) {
-                                childs.remove(0);
-                            } else {
-                                // create new intermediary element
-                                final TreeElement treeElement = new TreeElement(this, -1, JsonToken.FIELD_NAME, JSON_MIXED_CONTENT_TEXT_KEY);
-                                treeElement.addChild(child);
-                                childs.set(childs.indexOf(child), treeElement);
-                                child.parent = treeElement;
-                            }
+                        final TreeElement child = childs.get(0);
+                        if (isWhitespace(child.value)) {
+                            childs.remove(0);
                         } else {
-                            jsonToken = JsonToken.FIELD_NAME;
+                            // create new intermediary element
+                            final TreeElement treeElement = new TreeElement(this, -1, JsonToken.FIELD_NAME, XJConstants.JSON_WRITER_MIXED_CONTENT_TEXT_KEY);
+                            treeElement.addChild(child);
+                            childs.set(childs.indexOf(child), treeElement);
+                            child.parent = treeElement;
                         }
                     } else {
-                        // mixed content fixup.
-                        final Iterator<TreeElement> iterator = childs.iterator();
-                        while (iterator.hasNext()) {
-                            TreeElement element = iterator.next();
-                            if (element.jsonToken == JsonToken.VALUE_STRING) {
-                                if (isWhitespace(element.value)) {
-                                    // remove element if is (ignorable-) whitespace
-                                    iterator.remove();
-                                } else {
-                                    // create new intermediary element
-                                    final TreeElement treeElement = new TreeElement(this, -1, JsonToken.FIELD_NAME,
-                                            element.name != null ? element.name : JSON_MIXED_CONTENT_TEXT_KEY);
-                                    treeElement.addChild(element);
-                                    childs.set(childs.indexOf(element), treeElement);
-                                    element.parent = treeElement;
-                                    element.jsonToken = JsonToken.VALUE_STRING;
-                                }
+                        jsonToken = JsonToken.FIELD_NAME;
+                    }
+                } else {
+                    // mixed content fixup.
+                    final Iterator<TreeElement> iterator = childs.iterator();
+                    while (iterator.hasNext()) {
+                        TreeElement element = iterator.next();
+                        if (element.jsonToken == JsonToken.VALUE_STRING) {
+                            if (isWhitespace(element.value)) {
+                                // remove element if is (ignorable-) whitespace
+                                iterator.remove();
+                            } else {
+                                // create new intermediary element
+                                final TreeElement treeElement = new TreeElement(this, -1, JsonToken.FIELD_NAME,
+                                        element.name != null ? element.name : XJConstants.JSON_WRITER_MIXED_CONTENT_TEXT_KEY);
+                                treeElement.addChild(element);
+                                childs.set(childs.indexOf(element), treeElement);
+                                element.parent = treeElement;
+                                element.jsonToken = JsonToken.VALUE_STRING;
                             }
                         }
+                    }
 
-                        jsonToken = JsonToken.START_OBJECT;
+                    jsonToken = JsonToken.START_OBJECT;
 
-                        final Map<String, Set<TreeElement>> childElementsMap = childs.stream()
-                                .collect(Collectors.groupingBy(o -> o.name, HashMap::new, Collectors.toCollection(LinkedHashSet::new)));
-
-                        // create arrays if element with the same name occurs more than once.
-                        for (Map.Entry<String, Set<TreeElement>> mapEntry : childElementsMap.entrySet()) {
-                            if (mapEntry.getValue().size() > 1) {
-                                if (childElementsMap.size() == 1) {
-                                    jsonToken = JsonToken.START_ARRAY;
-                                } else {
-                                    final TreeElement treeElement = new TreeElement(this, -1, JsonToken.START_ARRAY, mapEntry.getKey());
-                                    treeElement.childs = new ArrayList<>(mapEntry.getValue());
-                                    for (TreeElement child : treeElement.childs) {
-                                        child.parent = treeElement;
-                                    }
-
-                                    final List<TreeElement> newChildList = new ArrayList<>(this.childs.size() - mapEntry.getValue().size() + 1);
-                                    for (TreeElement e : this.childs) {
-                                        if (!mapEntry.getValue().contains(e)) {
-                                            newChildList.add(e);
-                                        }
-                                    }
-                                    childs = newChildList;
-                                    childs.add(treeElement);
-                                }
-                            }
-                        }
-                    }
-                    break;
-                default:
-                    throw new IllegalStateException("XMLEvent: " + xmlEvent + "; Json Token: " + jsonToken);
+                    wrapChildsInArrayIfNecessary();
+                }
+            } else {
+                throw new IllegalStateException("XMLEvent: " + xmlEvent + "; Json Token: " + jsonToken);
             }
         }
 
         private void writeEndHaveTypeHints() {
             switch (jsonToken) {
-                case VALUE_NULL:
-                case VALUE_STRING:
-                case VALUE_NUMBER_INT:
-                case VALUE_NUMBER_FLOAT:
-                case VALUE_TRUE:
-                case VALUE_FALSE:
-                    if (childs.isEmpty()) {
-                        final TreeElement treeElement = new TreeElement(this, -1, jsonToken);
-                        treeElement.setValue("");
-                        this.addChild(treeElement);
-
-                        jsonToken = JsonToken.FIELD_NAME;
-                    } else if (childs.size() == 1) {
-                        childs.get(0).jsonToken = jsonToken;
-                        jsonToken = JsonToken.FIELD_NAME;
-                    } else {
-                        // create FIELD childs if element contains text and attributes.
-                        final Iterator<TreeElement> iterator = childs.iterator();
-                        while (iterator.hasNext()) {
-                            TreeElement element = iterator.next();
-                            if (isValueToken(element.jsonToken)) {
-                                if (isWhitespace(element.value)) {
-                                    // remove element if is (ignorable-) whitespace
-                                    iterator.remove();
-                                } else {
-                                    // create new intermediary element
-                                    final TreeElement treeElement = new TreeElement(this, -1, JsonToken.FIELD_NAME,
-                                            element.name != null ? element.name : JSON_MIXED_CONTENT_TEXT_KEY);
-                                    treeElement.addChild(element);
-                                    childs.set(childs.indexOf(element), treeElement);
-                                    element.parent = treeElement;
-                                    if (element.xmlEvent == XMLEvent.CHARACTERS) {
-                                        element.jsonToken = jsonToken;
-                                    }
-                                }
-                            }
-                        }
-
-                        jsonToken = JsonToken.START_OBJECT;
-
-                        final Map<String, Set<TreeElement>> childElementsMap = childs.stream()
-                                .collect(Collectors.groupingBy(o -> o.name, HashMap::new, Collectors.toCollection(LinkedHashSet::new)));
-
-                        // create arrays if element with the same name occurs more than once.
-                        for (Map.Entry<String, Set<TreeElement>> mapEntry : childElementsMap.entrySet()) {
-                            if (mapEntry.getValue().size() > 1) {
-
-                                if (childElementsMap.size() == 1) {
-                                    jsonToken = JsonToken.START_ARRAY;
-                                } else {
-                                    final TreeElement treeElement = new TreeElement(this, -1, JsonToken.START_ARRAY, mapEntry.getKey());
-                                    treeElement.childs = new ArrayList<>(mapEntry.getValue());
-                                    for (TreeElement child : treeElement.childs) {
-                                        child.parent = treeElement;
-                                    }
-
-                                    final List<TreeElement> newChildList = new ArrayList<>(this.childs.size() - mapEntry.getValue().size() + 1);
-                                    for (TreeElement e : this.childs) {
-                                        if (!mapEntry.getValue().contains(e)) {
-                                            newChildList.add(e);
-                                        }
-                                    }
-                                    childs = newChildList;
-                                    childs.add(treeElement);
-                                }
-                            }
-                        }
-                    }
-                    break;
-                case START_OBJECT:
-                case START_ARRAY:
-                    // mixed content fixup.
+            case VALUE_NULL:
+            case VALUE_STRING:
+            case VALUE_NUMBER_INT:
+            case VALUE_NUMBER_FLOAT:
+            case VALUE_TRUE:
+            case VALUE_FALSE:
+                if (childs.isEmpty()) {
+                    final TreeElement treeElement = new TreeElement(this, -1, jsonToken);
+                    treeElement.setValue("");
+                    this.addChild(treeElement);
+
+                    jsonToken = JsonToken.FIELD_NAME;
+                } else if (childs.size() == 1) {
+                    childs.get(0).jsonToken = jsonToken;
+                    jsonToken = JsonToken.FIELD_NAME;
+                } else {
+                    // create FIELD childs if element contains text and attributes.
                     final Iterator<TreeElement> iterator = childs.iterator();
                     while (iterator.hasNext()) {
                         TreeElement element = iterator.next();
@@ -499,44 +435,79 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
                                 iterator.remove();
                             } else {
                                 // create new intermediary element
-                                final TreeElement treeElement = new TreeElement(this, -1, JsonToken.FIELD_NAME, JSON_MIXED_CONTENT_TEXT_KEY);
+                                final TreeElement treeElement = new TreeElement(this, -1, JsonToken.FIELD_NAME,
+                                        element.name != null ? element.name : XJConstants.JSON_WRITER_MIXED_CONTENT_TEXT_KEY);
                                 treeElement.addChild(element);
                                 childs.set(childs.indexOf(element), treeElement);
                                 element.parent = treeElement;
+                                if (element.xmlEvent == XMLEvent.CHARACTERS) {
+                                    element.jsonToken = jsonToken;
+                                }
                             }
                         }
                     }
 
-                    final Map<String, Set<TreeElement>> childElementsMap = childs.stream()
-                            .collect(Collectors.groupingBy(o -> o.name, HashMap::new, Collectors.toCollection(LinkedHashSet::new)));
+                    jsonToken = JsonToken.START_OBJECT;
+
+                    wrapChildsInArrayIfNecessary();
+                }
+                break;
+            case START_OBJECT:
+            case START_ARRAY:
+                // mixed content fixup.
+                final Iterator<TreeElement> iterator = childs.iterator();
+                while (iterator.hasNext()) {
+                    TreeElement element = iterator.next();
+                    if (isValueToken(element.jsonToken)) {
+                        if (isWhitespace(element.value)) {
+                            // remove element if is (ignorable-) whitespace
+                            iterator.remove();
+                        } else {
+                            // create new intermediary element
+                            final TreeElement treeElement = new TreeElement(this, -1, JsonToken.FIELD_NAME, XJConstants.JSON_WRITER_MIXED_CONTENT_TEXT_KEY);
+                            treeElement.addChild(element);
+                            childs.set(childs.indexOf(element), treeElement);
+                            element.parent = treeElement;
+                        }
+                    }
+                }
+
+                if (jsonToken != JsonToken.START_ARRAY) {
+                    wrapChildsInArrayIfNecessary();
+                }
 
-                    if (this.jsonToken != JsonToken.START_ARRAY) {
+                break;
+            default:
+                throw new IllegalStateException("XMLEvent: " + xmlEvent + "; Json Token: " + jsonToken);
+            }
+        }
 
-                        // create arrays if element with the same name occurs more than once.
-                        for (Map.Entry<String, Set<TreeElement>> mapEntry : childElementsMap.entrySet()) {
-                            if (mapEntry.getValue().size() > 1) {
+        private void wrapChildsInArrayIfNecessary() {
+            final Map<String, Set<TreeElement>> childElementsMap = childs.stream()
+                    .collect(Collectors.groupingBy(o -> o.name, HashMap::new, Collectors.toCollection(LinkedHashSet::new)));
 
-                                final TreeElement treeElement = new TreeElement(this, -1, JsonToken.START_ARRAY, mapEntry.getKey());
-                                treeElement.childs = new ArrayList<>(mapEntry.getValue());
-                                for (TreeElement child : treeElement.childs) {
-                                    child.parent = treeElement;
-                                }
+            // create arrays if element with the same name occurs more than once.
+            for (Map.Entry<String, Set<TreeElement>> mapEntry : childElementsMap.entrySet()) {
+                if (mapEntry.getValue().size() > 1) {
+                    if (childElementsMap.size() == 1) {
+                        jsonToken = JsonToken.START_ARRAY;
+                    } else {
+                        final TreeElement treeElement = new TreeElement(this, -1, JsonToken.START_ARRAY, mapEntry.getKey());
+                        treeElement.childs = new ArrayList<>(mapEntry.getValue());
+                        for (TreeElement child : treeElement.childs) {
+                            child.parent = treeElement;
+                        }
 
-                                final List<TreeElement> newChildList = new ArrayList<>(this.childs.size() - mapEntry.getValue().size() + 1);
-                                for (TreeElement e : this.childs) {
-                                    if (!mapEntry.getValue().contains(e)) {
-                                        newChildList.add(e);
-                                    }
-                                }
-                                childs = newChildList;
-                                childs.add(treeElement);
+                        final List<TreeElement> newChildList = new ArrayList<>(this.childs.size() - mapEntry.getValue().size() + 1);
+                        for (TreeElement e : this.childs) {
+                            if (!mapEntry.getValue().contains(e)) {
+                                newChildList.add(e);
                             }
                         }
+                        childs = newChildList;
+                        childs.add(treeElement);
                     }
-
-                    break;
-                default:
-                    throw new IllegalStateException("XMLEvent: " + xmlEvent + "; Json Token: " + jsonToken);
+                }
             }
         }
 
@@ -552,61 +523,61 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
         }
 
         private boolean isValueToken(JsonToken jsonToken) {
-            return jsonToken == JsonToken.VALUE_STRING ||
-                    jsonToken == JsonToken.VALUE_NUMBER_FLOAT ||
-                    jsonToken == JsonToken.VALUE_NUMBER_INT ||
-                    jsonToken == JsonToken.VALUE_TRUE ||
-                    jsonToken == JsonToken.VALUE_FALSE ||
-                    jsonToken == JsonToken.VALUE_NULL;
+            return jsonToken == JsonToken.VALUE_STRING
+                    || jsonToken == JsonToken.VALUE_NUMBER_FLOAT
+                    || jsonToken == JsonToken.VALUE_NUMBER_INT
+                    || jsonToken == JsonToken.VALUE_TRUE
+                    || jsonToken == JsonToken.VALUE_FALSE
+                    || jsonToken == JsonToken.VALUE_NULL;
         }
 
         void write(JsonGenerator jsonGenerator) throws IOException {
             switch (jsonToken) {
-                case NOT_AVAILABLE:
-                    break;
-                case START_OBJECT:
-                    if (parent.jsonToken == JsonToken.START_OBJECT) {
-                        jsonGenerator.writeObjectFieldStart(name);
-                    } else {
-                        jsonGenerator.writeStartObject();
-                    }
-
-                    break;
-                case START_ARRAY:
-                    if (parent.jsonToken == JsonToken.START_OBJECT) {
-                        jsonGenerator.writeArrayFieldStart(name);
-                    } else {
-                        jsonGenerator.writeStartArray();
-                    }
-
-                    break;
-                case FIELD_NAME:
-                    if (parent.jsonToken != JsonToken.START_ARRAY) {
-                        jsonGenerator.writeFieldName(name);
-                    }
-
-                    break;
-                case VALUE_STRING:
-                    jsonGenerator.writeString(value);
-
-                    break;
-                case VALUE_NUMBER_INT:
-                case VALUE_NUMBER_FLOAT:
-                case VALUE_TRUE:
-                case VALUE_FALSE:
-                    if (value == null || value.isEmpty()) {
-                        jsonGenerator.writeNull();
-                    } else {
-                        jsonGenerator.writeRawValue(value);
-                    }
-
-                    break;
-                case VALUE_NULL:
+            case NOT_AVAILABLE:
+                break;
+            case START_OBJECT:
+                if (parent.jsonToken == JsonToken.START_OBJECT) {
+                    jsonGenerator.writeObjectFieldStart(name);
+                } else {
+                    jsonGenerator.writeStartObject();
+                }
+
+                break;
+            case START_ARRAY:
+                if (parent.jsonToken == JsonToken.START_OBJECT) {
+                    jsonGenerator.writeArrayFieldStart(name);
+                } else {
+                    jsonGenerator.writeStartArray();
+                }
+
+                break;
+            case FIELD_NAME:
+                if (parent.jsonToken != JsonToken.START_ARRAY) {
+                    jsonGenerator.writeFieldName(name);
+                }
+
+                break;
+            case VALUE_STRING:
+                jsonGenerator.writeString(value);
+
+                break;
+            case VALUE_NUMBER_INT:
+            case VALUE_NUMBER_FLOAT:
+            case VALUE_TRUE:
+            case VALUE_FALSE:
+                if (value == null || value.isEmpty()) {
                     jsonGenerator.writeNull();
+                } else {
+                    jsonGenerator.writeRawValue(value);
+                }
+
+                break;
+            case VALUE_NULL:
+                jsonGenerator.writeNull();
 
-                    break;
-                default:
-                    throw new IllegalStateException("XMLEvent: " + xmlEvent + "; Json Token: " + jsonToken);
+                break;
+            default:
+                throw new IllegalStateException("XMLEvent: " + xmlEvent + "; Json Token: " + jsonToken);
             }
 
             for (TreeElement treeElement : childs) {
@@ -614,35 +585,35 @@ public class XmlJsonStreamWriter implements XMLStreamWriter {
             }
 
             switch (jsonToken) {
-                case START_OBJECT:
-                    jsonGenerator.writeEndObject();
-                    break;
-                case START_ARRAY:
-                    jsonGenerator.writeEndArray();
-                    break;
-                case VALUE_NULL:
-                case NOT_AVAILABLE:
-                case FIELD_NAME:
-                case VALUE_STRING:
-                case VALUE_NUMBER_INT:
-                case VALUE_NUMBER_FLOAT:
-                case VALUE_TRUE:
-                case VALUE_FALSE:
-                    // nop;
-                    break;
-                default:
-                    throw new IllegalStateException("XMLEvent: " + xmlEvent + "; Json Token: " + jsonToken);
+            case START_OBJECT:
+                jsonGenerator.writeEndObject();
+                break;
+            case START_ARRAY:
+                jsonGenerator.writeEndArray();
+                break;
+            case VALUE_NULL:
+            case NOT_AVAILABLE:
+            case FIELD_NAME:
+            case VALUE_STRING:
+            case VALUE_NUMBER_INT:
+            case VALUE_NUMBER_FLOAT:
+            case VALUE_TRUE:
+            case VALUE_FALSE:
+                // nop;
+                break;
+            default:
+                throw new IllegalStateException("XMLEvent: " + xmlEvent + "; Json Token: " + jsonToken);
             }
         }
 
         @Override
         public String toString() {
-            return "TreeElement{" +
-                    "name='" + name + '\'' +
-                    ", value='" + value + '\'' +
-                    ", xmlEvent=" + xmlEvent +
-                    ", jsonToken=" + jsonToken +
-                    '}';
+            return "TreeElement{"
+                    + "name='" + name + '\''
+                    + ", value='" + value + '\''
+                    + ", xmlEvent=" + xmlEvent
+                    + ", jsonToken=" + jsonToken
+                    + '}';
         }
     }
 }
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XInputStreamTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XInputStreamTest.java
index 9063cdc..519d16e 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XInputStreamTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XInputStreamTest.java
@@ -17,14 +17,14 @@
 
 package org.apache.camel.component.xj;
 
+import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
+
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import java.io.ByteArrayInputStream;
-import java.nio.charset.StandardCharsets;
-
 public class J2XInputStreamTest extends CamelTestSupport {
 
     @Test
@@ -39,10 +39,10 @@ public class J2XInputStreamTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:hellojson2xml.xsl?transformDirection=JSON2XML")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputBytesTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputBytesTest.java
index 191ef51..0e041d9 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputBytesTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputBytesTest.java
@@ -36,10 +36,10 @@ public class J2XOutputBytesTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:hellojson2xml.xsl?transformDirection=JSON2XML&output=bytes")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputFileTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputFileTest.java
index 5be6d26..7195b8e 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputFileTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputFileTest.java
@@ -17,14 +17,14 @@
 
 package org.apache.camel.component.xj;
 
+import java.io.File;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import java.io.File;
-
 public class J2XOutputFileTest extends CamelTestSupport {
 
     @Test
@@ -39,10 +39,10 @@ public class J2XOutputFileTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:hellojson2xml.xsl?transformDirection=JSON2XML&output=file")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputIdentityTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputIdentityTest.java
index 2dd75ba..e61ce8e 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputIdentityTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputIdentityTest.java
@@ -27,10 +27,10 @@ public class J2XOutputIdentityTest extends CamelTestSupport {
     @Test
     public void testOutput() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedBodiesReceived("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-                "<object xmlns:xj=\"http://camel.apache.org/component/xj\" xj:type=\"object\">" +
-                "<object xj:name=\"hello\" xj:type=\"string\">world!</object>" +
-                "</object>");
+        mock.expectedBodiesReceived("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+                + "<object xmlns:xj=\"http://camel.apache.org/component/xj\" xj:type=\"object\">"
+                + "<object xj:name=\"hello\" xj:type=\"string\">world!</object>"
+                + "</object>");
         mock.message(0).body().isInstanceOf(String.class);
 
         template.sendBody("direct:start", "{\"hello\": \"world!\"}");
@@ -39,10 +39,10 @@ public class J2XOutputIdentityTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:?transformDirection=JSON2XML")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputStringTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputStringTest.java
index 633430c..280009f 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputStringTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputStringTest.java
@@ -36,10 +36,10 @@ public class J2XOutputStringTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:hellojson2xml.xsl?transformDirection=JSON2XML&output=string")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JInputStreamTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JInputStreamTest.java
index 21e9a97..503fe99 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JInputStreamTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JInputStreamTest.java
@@ -17,14 +17,14 @@
 
 package org.apache.camel.component.xj;
 
+import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
+
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import java.io.ByteArrayInputStream;
-import java.nio.charset.StandardCharsets;
-
 public class X2JInputStreamTest extends CamelTestSupport {
 
     @Test
@@ -39,10 +39,10 @@ public class X2JInputStreamTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:helloxml2json.xsl?transformDirection=XML2JSON")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputBytesTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputBytesTest.java
index 2a06655..fa603df 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputBytesTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputBytesTest.java
@@ -36,10 +36,10 @@ public class X2JOutputBytesTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:helloxml2json.xsl?transformDirection=XML2JSON&output=bytes")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputFileTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputFileTest.java
index 6e6e6d3..84aae4a 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputFileTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputFileTest.java
@@ -17,14 +17,14 @@
 
 package org.apache.camel.component.xj;
 
+import java.io.File;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import java.io.File;
-
 public class X2JOutputFileTest extends CamelTestSupport {
 
     @Test
@@ -39,10 +39,10 @@ public class X2JOutputFileTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:helloxml2json.xsl?transformDirection=XML2JSON&output=file")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputIdentityTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputIdentityTest.java
index e68a20f..8858b07 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputIdentityTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputIdentityTest.java
@@ -36,10 +36,10 @@ public class X2JOutputIdentityTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:?transformDirection=XML2JSON")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputStringTest.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputStringTest.java
index 906b0ab..088a151 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputStringTest.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputStringTest.java
@@ -36,10 +36,10 @@ public class X2JOutputStringTest extends CamelTestSupport {
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start")
                         .to("xj:helloxml2json.xsl?transformDirection=XML2JSON&output=string")
                         .to("mock:result");
diff --git a/components/camel-xj/src/test/java/org/apache/camel/component/xj/XJTestUtils.java b/components/camel-xj/src/test/java/org/apache/camel/component/xj/XJTestUtils.java
index edb1ddf..6ee6eb8 100644
--- a/components/camel-xj/src/test/java/org/apache/camel/component/xj/XJTestUtils.java
+++ b/components/camel-xj/src/test/java/org/apache/camel/component/xj/XJTestUtils.java
@@ -17,9 +17,31 @@
 
 package org.apache.camel.component.xj;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Comment;
+
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.core.JsonParser;
+
 import org.apache.commons.io.IOUtils;
 import org.junit.Assert;
 import org.skyscreamer.jsonassert.JSONAssert;
@@ -27,37 +49,29 @@ import org.xmlunit.builder.DiffBuilder;
 import org.xmlunit.builder.Input;
 import org.xmlunit.diff.Diff;
 
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.*;
-import javax.xml.transform.stax.StAXResult;
-import javax.xml.transform.stax.StAXSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
+final class XJTestUtils {
 
-public class XJTestUtils {
+    private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
+    private static final Map<String, Templates> XSL_TEMPLATES = Collections.synchronizedMap(new HashMap<>());
+    private static final JsonFactory JSON_FACTORY = new JsonFactory();
 
     private XJTestUtils() {
     }
 
-    public static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
-    public static final Map<String, Templates> XSL_TEMPLATES = Collections.synchronizedMap(new HashMap<>());
-
-    public static final JsonFactory JSON_FACTORY = new JsonFactory();
-
-    public static Transformer getTransformer() throws Exception {
+    /**
+     * creates an "identity" transformer
+     */
+    private static Transformer getTransformer() throws Exception {
         final Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
         setPrettyPrinting(transformer);
 
         return transformer;
     }
 
-    public static Transformer getTransformer(String xsl) throws TransformerException {
+    /**
+     * creates a transformer with the given stylesheet
+     */
+    private static Transformer getTransformer(String xsl) throws TransformerException {
         final Transformer transformer;
 
         if (XSL_TEMPLATES.containsKey(xsl)) {
@@ -75,12 +89,12 @@ public class XJTestUtils {
         return transformer;
     }
 
-    public static void setPrettyPrinting(Transformer transformer) {
+    private static void setPrettyPrinting(Transformer transformer) {
         transformer.setOutputProperty(OutputKeys.INDENT, "yes");
         transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
     }
 
-    public static void transformXml2JsonAndCompare(String xsl, String testName) throws Exception {
+    static void transformXml2JsonAndCompare(String xsl, String testName) throws Exception {
         final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         final JsonGenerator jsonGenerator = JSON_FACTORY.createGenerator(byteArrayOutputStream);
 
@@ -106,18 +120,18 @@ public class XJTestUtils {
         try {
             transformer.transform(new StreamSource(inputFile), stAXResult);
         } catch (Exception e) {
-            String result = byteArrayOutputStream.toString("UTF-8");
+            String result = byteArrayOutputStream.toString(StandardCharsets.UTF_8.name());
             System.out.println(result);
             throw e;
         }
 
-        final String expected = IOUtils.toString(referenceFile, "UTF-8");
-        final String result = byteArrayOutputStream.toString("UTF-8");
+        final String expected = IOUtils.toString(referenceFile, StandardCharsets.UTF_8.name());
+        final String result = byteArrayOutputStream.toString(StandardCharsets.UTF_8.name());
 
         JSONAssert.assertEquals(result, expected, result, true);
     }
 
-    public static void transformJson2XmlAndCompare(String xsl, String testName) throws Exception {
+    static void transformJson2XmlAndCompare(String xsl, String testName) throws Exception {
 
         final InputStream inputFile = XJTestUtils.class.getClassLoader().getResourceAsStream(testName + ".json");
         if (inputFile == null) {
@@ -145,13 +159,23 @@ public class XJTestUtils {
         final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         transformer.transform(stAXSource, new StreamResult(byteArrayOutputStream));
 
-        final String expected = IOUtils.toString(referenceFile, "UTF-8");
-        final String result = byteArrayOutputStream.toString("UTF-8");
+        final String expected = IOUtils.toString(referenceFile, StandardCharsets.UTF_8.name());
+        final String result = byteArrayOutputStream.toString(StandardCharsets.UTF_8.name());
 
         final Diff diff = DiffBuilder
                 .compare(Input.fromString(expected))
                 .withTest(Input.fromString(result))
                 .ignoreElementContentWhitespace()
+                .withNodeFilter(toTest -> {
+                    if (toTest instanceof Comment) {
+                        final Comment comment = (Comment) toTest;
+                        final String text = comment.getNodeValue();
+                        
+                        return text == null || !text.contains("License");
+                    }
+
+                    return true;
+                })
                 .checkForIdentical()
                 .build();
 
diff --git a/components/camel-xj/src/test/resources/json2xml/test1.xml b/components/camel-xj/src/test/resources/json2xml/test1.xml
index b1c51da..780fb47 100644
--- a/components/camel-xj/src/test/resources/json2xml/test1.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test1.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
    <object xj:type="array">
       <object xj:type="string">1</object>
diff --git a/components/camel-xj/src/test/resources/json2xml/test10.xml b/components/camel-xj/src/test/resources/json2xml/test10.xml
index 80b042f..b645347 100644
--- a/components/camel-xj/src/test/resources/json2xml/test10.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test10.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    <object xj:name="id" xj:type="int">1</object>
    <object xj:name="type" xj:type="null">null</object>
diff --git a/components/camel-xj/src/test/resources/json2xml/test11.xml b/components/camel-xj/src/test/resources/json2xml/test11.xml
index 8036503..46bc64a 100644
--- a/components/camel-xj/src/test/resources/json2xml/test11.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test11.xml
@@ -1,4 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?><object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    <object xj:name="test" xj:type="string">&lt;!DOCTYPE html&gt;
       &lt;html class="client-nojs" lang="de" dir="ltr"&gt;
       &lt;head&gt;
diff --git a/components/camel-xj/src/test/resources/json2xml/test2.xml b/components/camel-xj/src/test/resources/json2xml/test2.xml
index 0165f14..fbb0f7a 100644
--- a/components/camel-xj/src/test/resources/json2xml/test2.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test2.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
    <object xj:type="object">
       <object xj:name="id" xj:type="string">1</object>
diff --git a/components/camel-xj/src/test/resources/json2xml/test3.xml b/components/camel-xj/src/test/resources/json2xml/test3.xml
index 252be62..e179420 100644
--- a/components/camel-xj/src/test/resources/json2xml/test3.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test3.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    <object xj:name="a" xj:type="array">
       <object xj:type="string">1</object>
diff --git a/components/camel-xj/src/test/resources/json2xml/test4.xml b/components/camel-xj/src/test/resources/json2xml/test4.xml
index 73a070a..9deadba 100644
--- a/components/camel-xj/src/test/resources/json2xml/test4.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test4.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    <object xj:name="a" xj:type="array">
       <object xj:type="string">1</object>
diff --git a/components/camel-xj/src/test/resources/json2xml/test5.xml b/components/camel-xj/src/test/resources/json2xml/test5.xml
index b1c51da..780fb47 100644
--- a/components/camel-xj/src/test/resources/json2xml/test5.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test5.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
    <object xj:type="array">
       <object xj:type="string">1</object>
diff --git a/components/camel-xj/src/test/resources/json2xml/test6.xml b/components/camel-xj/src/test/resources/json2xml/test6.xml
index b1c51da..780fb47 100644
--- a/components/camel-xj/src/test/resources/json2xml/test6.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test6.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
    <object xj:type="array">
       <object xj:type="string">1</object>
diff --git a/components/camel-xj/src/test/resources/json2xml/test7.xml b/components/camel-xj/src/test/resources/json2xml/test7.xml
index 3dc4db9..0fa4add 100644
--- a/components/camel-xj/src/test/resources/json2xml/test7.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test7.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    <object xj:name="a" xj:type="object">
       <object xj:name="id" xj:type="string">1</object>
diff --git a/components/camel-xj/src/test/resources/json2xml/test8.xml b/components/camel-xj/src/test/resources/json2xml/test8.xml
index 4bf7cc1..98d4517 100644
--- a/components/camel-xj/src/test/resources/json2xml/test8.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test8.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    <object xj:name="query" xj:type="object">
       <object xj:name="fi&amp;lter" xj:type="object">
diff --git a/components/camel-xj/src/test/resources/json2xml/test9.xml b/components/camel-xj/src/test/resources/json2xml/test9.xml
index 30cc649..86a7d28 100644
--- a/components/camel-xj/src/test/resources/json2xml/test9.xml
+++ b/components/camel-xj/src/test/resources/json2xml/test9.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    <object xj:type="object">
       <object xj:name="" xj:type="string"/>
diff --git a/components/camel-xj/src/test/resources/log4j2.properties b/components/camel-xj/src/test/resources/log4j2.properties
index b5266d5..149c986 100644
--- a/components/camel-xj/src/test/resources/log4j2.properties
+++ b/components/camel-xj/src/test/resources/log4j2.properties
@@ -1,19 +1,19 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
 
 appender.file.type = File
 appender.file.name = file
diff --git a/components/camel-xj/src/test/resources/xml2json/test1.xml b/components/camel-xj/src/test/resources/xml2json/test1.xml
index 3b9892e..d8b191b 100644
--- a/components/camel-xj/src/test/resources/xml2json/test1.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test1.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    <object>
       <object>1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test10.xml b/components/camel-xj/src/test/resources/xml2json/test10.xml
index 4e21b5a..ce41cf7 100644
--- a/components/camel-xj/src/test/resources/xml2json/test10.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test10.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    <object xj:name="id" xj:type="int">1</object>
    <object xj:name="type" xj:type="null">testnull</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test11.xml b/components/camel-xj/src/test/resources/xml2json/test11.xml
index 4f3328c..c7945a4 100644
--- a/components/camel-xj/src/test/resources/xml2json/test11.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test11.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
    <object xj:name="id" xj:type="int">1</object>
    <object xj:name="type" xj:type="null">null</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test12.xml b/components/camel-xj/src/test/resources/xml2json/test12.xml
index 2a00facd..44179a6 100644
--- a/components/camel-xj/src/test/resources/xml2json/test12.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test12.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
    <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
       <object xj:name="id" xj:type="int">1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test13.xml b/components/camel-xj/src/test/resources/xml2json/test13.xml
index 9abb259..d27f986 100644
--- a/components/camel-xj/src/test/resources/xml2json/test13.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test13.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
    text1
    <object xj:name="id" xj:type="int">1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test14.xml b/components/camel-xj/src/test/resources/xml2json/test14.xml
index 3190fb2..ccdd33a 100644
--- a/components/camel-xj/src/test/resources/xml2json/test14.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test14.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    text1
    <object xj:name="id" xj:type="int" id="b">1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test15.xml b/components/camel-xj/src/test/resources/xml2json/test15.xml
index fd9dbe7..d209a39 100644
--- a/components/camel-xj/src/test/resources/xml2json/test15.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test15.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
    text1
    <object xj:name="id" xj:type="int">1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test16.xml b/components/camel-xj/src/test/resources/xml2json/test16.xml
index d53cc45..137fdbb 100644
--- a/components/camel-xj/src/test/resources/xml2json/test16.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test16.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    <test>&lt;!DOCTYPE html&gt;
       &lt;html class="client-nojs" lang="de" dir="ltr"&gt;
diff --git a/components/camel-xj/src/test/resources/xml2json/test17.xml b/components/camel-xj/src/test/resources/xml2json/test17.xml
index e9e9dc9..45cbc0f 100644
--- a/components/camel-xj/src/test/resources/xml2json/test17.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test17.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    text1
    <object id="b">1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test18.xml b/components/camel-xj/src/test/resources/xml2json/test18.xml
index c771450..2d7eecc 100644
--- a/components/camel-xj/src/test/resources/xml2json/test18.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test18.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    text1
    <object id="b"/>
diff --git a/components/camel-xj/src/test/resources/xml2json/test19.xml b/components/camel-xj/src/test/resources/xml2json/test19.xml
index 2f5b13e..6677e0e 100644
--- a/components/camel-xj/src/test/resources/xml2json/test19.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test19.xml
@@ -1,3 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
 </object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test2.xml b/components/camel-xj/src/test/resources/xml2json/test2.xml
index 0a57fb1..032ad49 100644
--- a/components/camel-xj/src/test/resources/xml2json/test2.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test2.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    <object>
       <object xj:name="id">1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test20.xml b/components/camel-xj/src/test/resources/xml2json/test20.xml
index 7fff1ae..f961c05 100644
--- a/components/camel-xj/src/test/resources/xml2json/test20.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test20.xml
@@ -1,3 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="object">
 </object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test21.xml b/components/camel-xj/src/test/resources/xml2json/test21.xml
index 1d25351..79f0292 100644
--- a/components/camel-xj/src/test/resources/xml2json/test21.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test21.xml
@@ -1,3 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
 </object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test22.xml b/components/camel-xj/src/test/resources/xml2json/test22.xml
index 87bd3ef..05efb12 100644
--- a/components/camel-xj/src/test/resources/xml2json/test22.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test22.xml
@@ -1,2 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj"/>
diff --git a/components/camel-xj/src/test/resources/xml2json/test23.xml b/components/camel-xj/src/test/resources/xml2json/test23.xml
index d7a7ba3..2fa56dd 100644
--- a/components/camel-xj/src/test/resources/xml2json/test23.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test23.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj" xj:type="array">
     <object>1</object>
     <object>2</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test3.xml b/components/camel-xj/src/test/resources/xml2json/test3.xml
index 6e4abf2..691398b 100644
--- a/components/camel-xj/src/test/resources/xml2json/test3.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test3.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    <object xj:name="a">
       <object>1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test4.xml b/components/camel-xj/src/test/resources/xml2json/test4.xml
index b879a9b..51653e9 100644
--- a/components/camel-xj/src/test/resources/xml2json/test4.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test4.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    <object xj:name="a">
       <object>1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test5.xml b/components/camel-xj/src/test/resources/xml2json/test5.xml
index 1dc0222..c04bbb4 100644
--- a/components/camel-xj/src/test/resources/xml2json/test5.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test5.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xj:name="id" xmlns:xj="http://camel.apache.org/component/xj">
    <object>
       <object>1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test6.xml b/components/camel-xj/src/test/resources/xml2json/test6.xml
index e7a9557..16d31cb 100644
--- a/components/camel-xj/src/test/resources/xml2json/test6.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test6.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    <object>
       <object xj:name="id">1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test7.xml b/components/camel-xj/src/test/resources/xml2json/test7.xml
index 5176dd2..61f08be 100644
--- a/components/camel-xj/src/test/resources/xml2json/test7.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test7.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
 <object xmlns:xj="http://camel.apache.org/component/xj">
    <object xj:name="a">
       <object xj:name="id">1</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test8.xml b/components/camel-xj/src/test/resources/xml2json/test8.xml
index 35dbc9c..cb15bff 100644
--- a/components/camel-xj/src/test/resources/xml2json/test8.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test8.xml
@@ -1,4 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?><object xmlns:xj="http://camel.apache.org/component/xj">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<object xmlns:xj="http://camel.apache.org/component/xj">
    <object xj:name="query">
       <object xj:name="fi&amp;lter">
          <object xj:name="รค&lt;type">&amp;</object>
diff --git a/components/camel-xj/src/test/resources/xml2json/test9.xml b/components/camel-xj/src/test/resources/xml2json/test9.xml
index cef2dd4..c32ca23 100644
--- a/components/camel-xj/src/test/resources/xml2json/test9.xml
+++ b/components/camel-xj/src/test/resources/xml2json/test9.xml
@@ -1,4 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?><object xmlns:xj="http://camel.apache.org/component/xj">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<object xmlns:xj="http://camel.apache.org/component/xj">
    <object>
       <object xj:name="&#9;">&#9;</object>
       <object xj:name="&#10;">&#10;</object>