You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2025/10/14 07:49:20 UTC

(camel) branch main updated (0c563418f50a -> 6838d8ca2438)

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

pcongiusti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 0c563418f50a chore(deps-dev): Bump net.javacrumbs.json-unit:json-unit-assertj
     new b3beba95eb37 CAMEL-22502: Replaced System.out with SLF4J logger
     new 35164df399bd CAMEL-22502: Undo some unnecessary changes regarding System.out and slf4j
     new 0b0f2cfbabfe chore: remove body toString()
     new b13abdb63ce3 Update components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
     new 9cb981825e2f chore: add log properties conf
     new f8bbd0a7910e chore(components): as2 revert lambda
     new 6838d8ca2438 chore(artifacts): revert log output

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/as2/api/AS2MessageTest.java    |   4 +-
 .../component/aws/xray/CustomComponentTest.java    |   8 +-
 .../component/debezium/DebeziumConsumerTest.java   |   5 +-
 .../integration/DigitalOceanComponentIT.java       |   8 +-
 .../camel/component/exec/ExecJava8IssueTest.java   |   6 +-
 .../github/consumer/CommitConsumerLastTest.java    |   2 +-
 .../camel/component/hl7/HL7ValidateTest.java       |   5 +-
 .../camel/component/iec60870/ConnectionTest.java   |   6 +-
 .../ConcurrentConsumerLoadManualTest.java          |   2 +-
 .../org/apache/camel/component/jmx/XmlFixture.java |  17 +---
 .../keycloak/security/KeycloakSecurityIT.java      |   6 +-
 .../server/core/integ5/DSAnnotationProcessor.java  |   2 +-
 .../server/core/integ5/DSAnnotationProcessor.java  |   2 +-
 .../camel/service/lra/LRASagaRoutesTest.java       |  10 +-
 .../test/oauth/AbstractOAuthCodeFlowTest.java      |  12 ++-
 .../apache/camel/test/oauth/SSLCertTrustTest.java  |   8 +-
 .../src/test/resources/log4j2.properties           |   2 +-
 .../component/salesforce/LoginConfigHelper.java    | 109 +++++++++++----------
 .../org/apache/camel/component/xj/XJTestUtils.java |   5 +-
 .../ValidatorIncludeEncodingRouteTest.java         |   6 +-
 .../src/main}/resources/log4j2.properties          |   2 +-
 .../java/org/apache/camel/xml/in/ParserTest.java   |  49 ++++-----
 .../common/services/ContainerTestService.java      |   2 +-
 .../src/test/resources/log4j2.properties           |   5 +-
 24 files changed, 161 insertions(+), 122 deletions(-)
 copy components/{camel-coap => camel-oauth}/src/test/resources/log4j2.properties (96%)
 copy {components/camel-ai/camel-kserve/src/test => core/camel-xml-io/src/main}/resources/log4j2.properties (96%)
 copy {components/camel-debezium/camel-debezium-common/camel-debezium-common-component => test-infra/camel-test-infra-common}/src/test/resources/log4j2.properties (95%)


(camel) 05/07: chore: add log properties conf

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9cb981825e2f6d076e5077d76d561e948bbbfa4e
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Mon Oct 13 09:16:51 2025 +0200

    chore: add log properties conf
---
 .../src/test/resources/log4j2.properties           | 28 ++++++++++++++++++++++
 .../src/main/resources/log4j2.properties           | 28 ++++++++++++++++++++++
 .../src/test/resources/log4j2.properties           | 28 ++++++++++++++++++++++
 3 files changed, 84 insertions(+)

diff --git a/components/camel-oauth/src/test/resources/log4j2.properties b/components/camel-oauth/src/test/resources/log4j2.properties
new file mode 100644
index 000000000000..d10ff8f6f288
--- /dev/null
+++ b/components/camel-oauth/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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
+appender.file.fileName = target/camel-oauth-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
diff --git a/core/camel-xml-io/src/main/resources/log4j2.properties b/core/camel-xml-io/src/main/resources/log4j2.properties
new file mode 100644
index 000000000000..4c6d16f2fc48
--- /dev/null
+++ b/core/camel-xml-io/src/main/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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
+appender.file.fileName = target/camel-xml-io-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
diff --git a/test-infra/camel-test-infra-common/src/test/resources/log4j2.properties b/test-infra/camel-test-infra-common/src/test/resources/log4j2.properties
new file mode 100644
index 000000000000..863dbd2a2a4e
--- /dev/null
+++ b/test-infra/camel-test-infra-common/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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
+appender.file.fileName = target/camel-test-infra-common-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file


(camel) 03/07: chore: remove body toString()

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0b0f2cfbabfed374d8714cbd068b250adcd372ef
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Mon Oct 13 08:56:18 2025 +0200

    chore: remove body toString()
    
    Co-authored-by: Babak Vahdat <bv...@apache.org>
---
 .../resources/archetype-resources/src/main/java/__name__Producer.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java b/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
index 2c2892bf605a..dcf6d26572db 100644
--- a/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
+++ b/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
@@ -31,7 +31,7 @@ public class ${name}Producer extends DefaultProducer {
     }
 
     public void process(Exchange exchange) throws Exception {
-        LOG.info(exchange.getIn().getBody().toString());
+        LOG.info(exchange.getIn().getBody());
     }
 
 }


(camel) 06/07: chore(components): as2 revert lambda

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f8bbd0a7910ef34dd20cfb5dbb4128185a31663b
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Mon Oct 13 09:46:15 2025 +0200

    chore(components): as2 revert lambda
---
 .../test/java/org/apache/camel/component/as2/api/AS2MessageTest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
index 07c0ce1c1d31..7e68bd233fe1 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
@@ -515,7 +515,7 @@ public class AS2MessageTest extends AS2MessageTestBase {
         // Send MDN
         HttpCoreContext httpContext = mdnManager.send(mdn, mdn.getMainMessageContentType(), RECIPIENT_DELIVERY_ADDRESS);
         HttpRequest mndRequest = httpContext.getRequest();
-        Arrays.stream(request.getHeaders(AS2Header.CONTENT_DISPOSITION)).forEach(h -> LOG.debug(h));
+        Arrays.stream(request.getHeaders(AS2Header.CONTENT_DISPOSITION)).forEach(h -> LOG.debug("{}", h));
         DispositionNotificationMultipartReportEntity reportEntity
                 = HttpMessageUtils.getEntity(mndRequest, DispositionNotificationMultipartReportEntity.class);
         assertNotNull(reportEntity, "Request does not contain report");


(camel) 04/07: Update components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b13abdb63ce3e10409210b0e76c0332290bb578f
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Mon Oct 13 08:56:38 2025 +0200

    Update components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
    
    chore: remove log param
    
    Co-authored-by: Babak Vahdat <bv...@apache.org>
---
 .../test/java/org/apache/camel/component/as2/api/AS2MessageTest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
index 7e68bd233fe1..07c0ce1c1d31 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
@@ -515,7 +515,7 @@ public class AS2MessageTest extends AS2MessageTestBase {
         // Send MDN
         HttpCoreContext httpContext = mdnManager.send(mdn, mdn.getMainMessageContentType(), RECIPIENT_DELIVERY_ADDRESS);
         HttpRequest mndRequest = httpContext.getRequest();
-        Arrays.stream(request.getHeaders(AS2Header.CONTENT_DISPOSITION)).forEach(h -> LOG.debug("{}", h));
+        Arrays.stream(request.getHeaders(AS2Header.CONTENT_DISPOSITION)).forEach(h -> LOG.debug(h));
         DispositionNotificationMultipartReportEntity reportEntity
                 = HttpMessageUtils.getEntity(mndRequest, DispositionNotificationMultipartReportEntity.class);
         assertNotNull(reportEntity, "Request does not contain report");


(camel) 01/07: CAMEL-22502: Replaced System.out with SLF4J logger

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b3beba95eb372235e42b886e6a8987f8ef970b54
Author: Mikołaj Diakowski <mi...@interia.pl>
AuthorDate: Thu Oct 9 14:56:03 2025 +0200

    CAMEL-22502: Replaced System.out with SLF4J logger
---
 .../src/main/java/__name__Producer.java            |   2 +-
 .../htmlxlsx/process/CoverageResultsProcessor.java |  11 +-
 .../camel/component/as2/api/AS2MessageTest.java    |   4 +-
 .../component/aws/xray/CustomComponentTest.java    |   8 +-
 .../component/debezium/DebeziumConsumerTest.java   |   5 +-
 .../integration/DigitalOceanComponentIT.java       |   8 +-
 .../camel/component/exec/ExecJava8IssueTest.java   |   6 +-
 .../github/consumer/CommitConsumerLastTest.java    |   2 +-
 .../camel/component/hl7/HL7ValidateTest.java       |   5 +-
 .../camel/component/iec60870/ConnectionTest.java   |   6 +-
 .../ConcurrentConsumerLoadManualTest.java          |   2 +-
 .../org/apache/camel/component/jasypt/Main.java    |  25 +-
 .../org/apache/camel/component/jmx/XmlFixture.java |   9 +-
 .../keycloak/security/KeycloakSecurityIT.java      |   6 +-
 .../server/core/integ5/DSAnnotationProcessor.java  |   2 +-
 .../server/core/integ5/DSAnnotationProcessor.java  |   2 +-
 .../camel/service/lra/LRASagaRoutesTest.java       |  10 +-
 .../mllp/MllpTcpServerConsumerTransactionTest.java |  20 +-
 .../test/oauth/AbstractOAuthCodeFlowTest.java      |  12 +-
 .../apache/camel/test/oauth/SSLCertTrustTest.java  |   8 +-
 .../component/salesforce/LoginConfigHelper.java    | 109 ++--
 .../camel/component/splunk/ProducerTest.java       |   5 +-
 .../camel/component/splunk/RawProducerTest.java    |   5 +-
 .../org/apache/camel/component/xj/XJTestUtils.java |   5 +-
 .../ValidatorIncludeEncodingRouteTest.java         |   6 +-
 .../apache/camel/main/MainCommandLineSupport.java  |  13 +-
 .../java/org/apache/camel/xml/io/MXParser.java     | 669 ++-------------------
 .../java/org/apache/camel/xml/in/ParserTest.java   |  49 +-
 .../dsl/jbang/core/commands/bind/PipeProvider.java |   7 +-
 .../camel/dsl/jbang/core/common/Printer.java       |  14 +-
 .../core/commands/kubernetes/KubernetesHelper.java |   9 +-
 .../java/org/apache/camel/main/KameletMain.java    |   6 +-
 .../common/services/ContainerTestService.java      |   2 +-
 .../generator/openapi/RestDslYamlGenerator.java    |   6 +-
 34 files changed, 270 insertions(+), 788 deletions(-)

diff --git a/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java b/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
index 098b60305f10..2c2892bf605a 100644
--- a/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
+++ b/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
@@ -31,7 +31,7 @@ public class ${name}Producer extends DefaultProducer {
     }
 
     public void process(Exchange exchange) throws Exception {
-        System.out.println(exchange.getIn().getBody());
+        LOG.info(exchange.getIn().getBody().toString());
     }
 
 }
diff --git a/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessor.java b/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessor.java
index 4273ba7b674e..e6a922840e3a 100644
--- a/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessor.java
+++ b/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessor.java
@@ -39,9 +39,13 @@ import org.apache.camel.maven.htmlxlsx.model.RouteStatistic;
 import org.apache.camel.maven.htmlxlsx.model.RouteTotalsStatistic;
 import org.apache.camel.maven.htmlxlsx.model.TestResult;
 import org.apache.maven.project.MavenProject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class CoverageResultsProcessor {
 
+    private static final Logger LOG = LoggerFactory.getLogger(CoverageResultsProcessor.class);
+
     private static final String DETAILS_FILE = "/details.html";
 
     private static final String INDEX_FILE = "/index.html";
@@ -224,10 +228,9 @@ public class CoverageResultsProcessor {
                     }
                 } catch (Exception t) {
                     // this is an edge case that needs to be identified. Log some useful debugging information.
-                    System.out.println(t.getClass().toString());
-                    System.out.printf("routeID: %s%n", routeId);
-                    System.out.printf("route: %s%n", route);
-                    System.out.printf("mappedRoute: %s%n", mappedRoute != null ? mappedRoute.toString() : "null");
+                    LOG.error("Error processing route coverage for routeId: {}", routeId, t);
+                    LOG.error("Route: {}", route);
+                    LOG.error("MappedRoute: {}", mappedRoute != null ? mappedRoute.toString() : "null");
                 }
             });
         });
diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
index b221c6240acd..7e68bd233fe1 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
@@ -111,7 +111,7 @@ public class AS2MessageTest extends AS2MessageTestBase {
                     ediEntity = HttpMessageUtils.extractEdiPayload(request, new HttpMessageUtils.DecrpytingAndSigningInfo(
                             testServer.getValidateSigningCertificateChain(), testServer.getDecryptingPrivateKey()));
                 } catch (Exception e) {
-                    throw new HttpException("Failed to parse AS2 Message Entity", e);
+                    throw new HttpException("Failed to parse AS2Message Entity", e);
                 }
             }
         });
@@ -515,7 +515,7 @@ public class AS2MessageTest extends AS2MessageTestBase {
         // Send MDN
         HttpCoreContext httpContext = mdnManager.send(mdn, mdn.getMainMessageContentType(), RECIPIENT_DELIVERY_ADDRESS);
         HttpRequest mndRequest = httpContext.getRequest();
-        Arrays.stream(request.getHeaders(AS2Header.CONTENT_DISPOSITION)).forEach(System.out::println);
+        Arrays.stream(request.getHeaders(AS2Header.CONTENT_DISPOSITION)).forEach(h -> LOG.debug("{}", h));
         DispositionNotificationMultipartReportEntity reportEntity
                 = HttpMessageUtils.getEntity(mndRequest, DispositionNotificationMultipartReportEntity.class);
         assertNotNull(reportEntity, "Request does not contain report");
diff --git a/components/camel-aws/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/CustomComponentTest.java b/components/camel-aws/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/CustomComponentTest.java
index 5d1b1c77d48d..d9905f5283e6 100644
--- a/components/camel-aws/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/CustomComponentTest.java
+++ b/components/camel-aws/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/CustomComponentTest.java
@@ -26,6 +26,8 @@ import org.apache.camel.component.aws.xray.bean.ProcessingCamelBean;
 import org.apache.camel.component.aws.xray.component.CommonEndpoints;
 import org.apache.camel.spi.InterceptStrategy;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.camel.component.aws.xray.TestDataBuilder.createSegment;
 import static org.apache.camel.component.aws.xray.TestDataBuilder.createSubsegment;
@@ -53,6 +55,8 @@ import static org.hamcrest.Matchers.greaterThan;
  */
 public class CustomComponentTest extends CamelAwsXRayTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(CustomComponentTest.class);
+
     private static final String START = "seda:start";
     private static final String DELIVERY = "seda:delivery";
     private static final String IN_QUEUE = "seda:inqueue";
@@ -144,8 +148,8 @@ public class CustomComponentTest extends CamelAwsXRayTestSupport {
                 from("seda:backingTask").routeId("backingTask")
                         .onException(Exception.class)
                             .redeliveryDelay(100L)
-                            .onRedelivery((Exchange exchange) -> System.err.println(">> Retrying due to "
-                                    + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getLocalizedMessage()))
+                            .onRedelivery((Exchange exchange) -> LOG.warn(">> Retrying due to: {}",
+                                    exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getLocalizedMessage()))
                             .logExhausted(true)
                             .handled(true)
                             .logStackTrace(true)
diff --git a/components/camel-debezium/camel-debezium-common/camel-debezium-common-component/src/test/java/org/apache/camel/component/debezium/DebeziumConsumerTest.java b/components/camel-debezium/camel-debezium-common/camel-debezium-common-component/src/test/java/org/apache/camel/component/debezium/DebeziumConsumerTest.java
index 80f47c0d5472..ebd9947418fa 100644
--- a/components/camel-debezium/camel-debezium-common/camel-debezium-common-component/src/test/java/org/apache/camel/component/debezium/DebeziumConsumerTest.java
+++ b/components/camel-debezium/camel-debezium-common/camel-debezium-common-component/src/test/java/org/apache/camel/component/debezium/DebeziumConsumerTest.java
@@ -37,9 +37,12 @@ import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class DebeziumConsumerTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(DebeziumConsumerTest.class);
     private static final int NUMBER_OF_LINES = 5;
     private static final String DEFAULT_DATA_TESTING_FOLDER = "target/data";
     private static final Path TEST_FILE_PATH = createTestingPath("camel-debezium-test-file-input.txt").toAbsolutePath();
@@ -167,7 +170,7 @@ public class DebeziumConsumerTest extends CamelTestSupport {
         try {
             IoUtil.delete(path);
         } catch (IOException e) {
-            System.err.printf("Unable to delete %s%n", path.toAbsolutePath());
+            LOG.error("Unable to delete {}", path.toAbsolutePath(), e);
         }
     }
 
diff --git a/components/camel-digitalocean/src/test/java/org/apache/camel/component/digitalocean/integration/DigitalOceanComponentIT.java b/components/camel-digitalocean/src/test/java/org/apache/camel/component/digitalocean/integration/DigitalOceanComponentIT.java
index 71f8402f3b09..8525c57df845 100644
--- a/components/camel-digitalocean/src/test/java/org/apache/camel/component/digitalocean/integration/DigitalOceanComponentIT.java
+++ b/components/camel-digitalocean/src/test/java/org/apache/camel/component/digitalocean/integration/DigitalOceanComponentIT.java
@@ -35,6 +35,8 @@ import org.apache.camel.component.digitalocean.constants.DigitalOceanOperations;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledIf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.camel.test.junit5.TestSupport.assertCollectionSize;
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -46,6 +48,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
            disabledReason = "Must be manually tested. Provide your own oAuthToken on test-options.properties")
 public class DigitalOceanComponentIT extends DigitalOceanTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(DigitalOceanComponentIT.class);
+
     @EndpointInject("mock:result")
     protected MockEndpoint mockResultEndpoint;
 
@@ -324,7 +328,7 @@ public class DigitalOceanComponentIT extends DigitalOceanTestSupport {
 
         MockEndpoint.assertIsSatisfied(context);
         List<Size> sizes = (List<Size>) exchange.getMessage().getBody();
-        System.out.println(sizes);
+        LOG.debug("Sizes: {}", sizes);
         assertNotEquals(1, sizes.size());
     }
 
@@ -336,7 +340,7 @@ public class DigitalOceanComponentIT extends DigitalOceanTestSupport {
 
         MockEndpoint.assertIsSatisfied(context);
         List<Region> regions = (List<Region>) exchange.getMessage().getBody();
-        System.out.println(regions);
+        LOG.debug("Regions: {}", regions);
         assertNotEquals(1, regions.size());
     }
 
diff --git a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJava8IssueTest.java b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJava8IssueTest.java
index b7b499de1d5d..30bdfa790ec5 100644
--- a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJava8IssueTest.java
+++ b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJava8IssueTest.java
@@ -33,6 +33,8 @@ import org.apache.commons.io.FileUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.fail;
@@ -43,6 +45,8 @@ import static org.junit.jupiter.api.Assertions.fail;
  */
 public class ExecJava8IssueTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(ExecJava8IssueTest.class);
+
     private File tempDir;
     private final String tempDirName = name();
     private final String tempFileName = name();
@@ -64,7 +68,7 @@ public class ExecJava8IssueTest {
     public void test() throws Exception {
 
         if (!OS.isFamilyUnix()) {
-            System.err.println("The test 'CamelExecTest' does not support the following OS : " + System.getProperty("os.name"));
+            LOG.warn("The test 'CamelExecTest' does not support the following OS : {}", System.getProperty("os.name"));
             return;
         }
 
diff --git a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/CommitConsumerLastTest.java b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/CommitConsumerLastTest.java
index fc933ba6f654..b3c77bda78fb 100644
--- a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/CommitConsumerLastTest.java
+++ b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/CommitConsumerLastTest.java
@@ -74,7 +74,7 @@ public class CommitConsumerLastTest extends GitHubComponentTestBase {
             String author = exchange.getMessage().getHeader(GitHubConstants.GITHUB_COMMIT_AUTHOR, String.class);
             String sha = exchange.getMessage().getHeader(GitHubConstants.GITHUB_COMMIT_SHA, String.class);
             if (log.isDebugEnabled()) {
-                System.out.println(sha);
+                log.debug("Commit SHA: {}", sha);
                 log.debug("Got commit with author: {}: SHA {}", author, sha);
             }
         }
diff --git a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ValidateTest.java b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ValidateTest.java
index f8c195cb122e..a9e4a28e8dff 100644
--- a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ValidateTest.java
+++ b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ValidateTest.java
@@ -36,6 +36,8 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -43,6 +45,7 @@ import static org.junit.jupiter.api.Assertions.fail;
 
 public class HL7ValidateTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(HL7ValidateTest.class);
     private HL7DataFormat hl7;
 
     @Test
@@ -98,7 +101,7 @@ public class HL7ValidateTest extends CamelTestSupport {
         } catch (CamelExecutionException e) {
             assertIsInstanceOf(HL7Exception.class, e.getCause());
             assertIsInstanceOf(ValidationException.class, e.getCause().getCause());
-            System.out.println(e.getCause().getCause().getMessage());
+            LOG.error("Validation failed", e.getCause().getCause());
             assertTrue(e.getCause().getCause().getMessage().startsWith("Validation failed:"),
                     "Should be a validation error message");
         }
diff --git a/components/camel-iec60870/src/test/java/org/apache/camel/component/iec60870/ConnectionTest.java b/components/camel-iec60870/src/test/java/org/apache/camel/component/iec60870/ConnectionTest.java
index b6636e1fe0af..9f5315187c15 100644
--- a/components/camel-iec60870/src/test/java/org/apache/camel/component/iec60870/ConnectionTest.java
+++ b/components/camel-iec60870/src/test/java/org/apache/camel/component/iec60870/ConnectionTest.java
@@ -31,6 +31,8 @@ import org.apache.camel.test.junit5.CamelTestSupport;
 import org.eclipse.neoscada.protocol.iec60870.asdu.types.Value;
 import org.eclipse.neoscada.protocol.iec60870.server.data.model.WriteModel.Request;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -39,6 +41,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class ConnectionTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(ConnectionTest.class);
+
     private static final String DIRECT_SEND_S_1 = "direct:sendServer1";
 
     private static final String DIRECT_SEND_C_1 = "direct:sendClient1";
@@ -133,7 +137,7 @@ public class ConnectionTest extends CamelTestSupport {
         // assert
 
         MockEndpoint.assertIsSatisfied(context, 2_000, TimeUnit.MILLISECONDS);
-        System.out.println(testServer1Endpoint.getExchanges().get(0).getIn().getBody());
+        LOG.debug("Received body: {}", testServer1Endpoint.getExchanges().get(0).getIn().getBody());
 
     }
 
diff --git a/components/camel-ironmq/src/test/java/org/apache/camel/component/ironmq/integrationtest/ConcurrentConsumerLoadManualTest.java b/components/camel-ironmq/src/test/java/org/apache/camel/component/ironmq/integrationtest/ConcurrentConsumerLoadManualTest.java
index 015065613012..69cd9d6f6730 100644
--- a/components/camel-ironmq/src/test/java/org/apache/camel/component/ironmq/integrationtest/ConcurrentConsumerLoadManualTest.java
+++ b/components/camel-ironmq/src/test/java/org/apache/camel/component/ironmq/integrationtest/ConcurrentConsumerLoadManualTest.java
@@ -63,7 +63,7 @@ public class ConcurrentConsumerLoadManualTest extends CamelTestSupport {
             list.add(payloadToSend);
             if (i % 100 == 0) {
                 noOfBlocks++;
-                System.out.println("sending blok " + noOfBlocks);
+                LOGGER.info("sending block {}", noOfBlocks);
                 template.sendBody(sedaEndpoint, list.toArray(new String[0]));
                 list.clear();
             }
diff --git a/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/Main.java b/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/Main.java
index 85e7d39fbeed..ba5b9a627ea7 100644
--- a/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/Main.java
+++ b/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/Main.java
@@ -24,9 +24,13 @@ import java.util.List;
 import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
 import org.jasypt.iv.RandomIvGenerator;
 import org.jasypt.salt.RandomSaltGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class Main {
 
+    private static final Logger LOG = LoggerFactory.getLogger(Main.class);
+
     private final StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
     private final List<Option> options = new ArrayList<>();
     private String command;
@@ -85,7 +89,7 @@ public class Main {
         @Override
         protected void doProcess(String arg, LinkedList<String> remainingArgs) {
             if (remainingArgs.isEmpty()) {
-                System.err.println("Expected fileName for ");
+                LOG.error("Expected parameter for option: {}", arg);
                 showOptions();
             } else {
                 String parameter = remainingArgs.removeFirst();
@@ -157,13 +161,10 @@ public class Main {
     }
 
     private void showOptions() {
-        System.out.println("Apache Camel Jasypt takes the following options:");
-        System.out.println();
+        LOG.info("Apache Camel Jasypt takes the following options:");
         for (Option option : options) {
-            System.out.println(option.getInformation());
+            LOG.info(option.getInformation());
         }
-        System.out.println();
-        System.out.println();
     }
 
     private boolean parseArguments(String[] arguments) {
@@ -181,8 +182,7 @@ public class Main {
                 }
             }
             if (!handled) {
-                System.out.println("Error: Unknown option: " + arg);
-                System.out.println();
+                LOG.error("Error: Unknown option: {}", arg);
                 valid = false;
                 break;
             }
@@ -198,20 +198,17 @@ public class Main {
         }
 
         if (command == null) {
-            System.out.println("Error: Command is empty");
-            System.out.println();
+            LOG.error("Error: Command is empty");
             showOptions();
             return;
         }
         if (password == null) {
-            System.out.println("Error: Password is empty");
-            System.out.println();
+            LOG.error("Error: Password is empty");
             showOptions();
             return;
         }
         if (input == null) {
-            System.out.println("Error: Input is empty");
-            System.out.println();
+            LOG.error("Error: Input is empty");
             showOptions();
             return;
         }
diff --git a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/XmlFixture.java b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/XmlFixture.java
index 60d0d0631fca..a217ba8990f6 100644
--- a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/XmlFixture.java
+++ b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/XmlFixture.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.jmx;
 
 import java.io.File;
+import java.io.StringWriter;
 
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Source;
@@ -26,11 +27,15 @@ import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xmlunit.assertj3.XmlAssert;
 import org.xmlunit.builder.Input;
 
 public final class XmlFixture {
 
+    private static final Logger LOG = LoggerFactory.getLogger(XmlFixture.class);
+
     private XmlFixture() {
     }
 
@@ -54,7 +59,9 @@ public final class XmlFixture {
         TransformerFactory tf = TransformerFactory.newInstance();
         Transformer transformer = tf.newTransformer();
         transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-        transformer.transform(aActual, new StreamResult(System.out));
+        StringWriter sw = new StringWriter();
+        transformer.transform(aActual, new StreamResult(sw));
+        LOG.debug(sw.toString());
     }
 
     public static Source stripTimestamp(Source aSource) throws Exception {
diff --git a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakSecurityIT.java b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakSecurityIT.java
index ea315ba2e0d3..2c7fe42f9e50 100644
--- a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakSecurityIT.java
+++ b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakSecurityIT.java
@@ -40,6 +40,8 @@ import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
 import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.junit.jupiter.api.Assertions.*;
 
@@ -64,6 +66,8 @@ import static org.junit.jupiter.api.Assertions.*;
 })
 public class KeycloakSecurityIT extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(KeycloakSecurityIT.class);
+
     private static String keycloakUrl;
     private static String realm;
     private static String clientId;
@@ -355,7 +359,7 @@ public class KeycloakSecurityIT extends CamelTestSupport {
             java.util.Set<String> permissions = KeycloakSecurityHelper.extractPermissions(token);
 
             // Log the permissions found for debugging
-            System.out.println("Permissions found in token: " + permissions);
+            LOG.info("Permissions found in token: {}", permissions);
 
             // Permissions might be empty in a basic setup, which is expected
             assertNotNull(permissions);
diff --git a/components/camel-ldap/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java b/components/camel-ldap/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java
index fb226a2c62ec..c7fc656489cc 100644
--- a/components/camel-ldap/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java
+++ b/components/camel-ldap/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java
@@ -410,7 +410,7 @@ public final class DSAnnotationProcessor {
                 .getAnnotation(LoadSchema.class);
 
         if (loadSchema != null) {
-            System.out.println(loadSchema);
+            LOG.debug("Found LoadSchema annotation: {}", loadSchema);
         }
     }
 
diff --git a/components/camel-ldif/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java b/components/camel-ldif/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java
index fb226a2c62ec..c7fc656489cc 100644
--- a/components/camel-ldif/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java
+++ b/components/camel-ldif/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java
@@ -410,7 +410,7 @@ public final class DSAnnotationProcessor {
                 .getAnnotation(LoadSchema.class);
 
         if (loadSchema != null) {
-            System.out.println(loadSchema);
+            LOG.debug("Found LoadSchema annotation: {}", loadSchema);
         }
     }
 
diff --git a/components/camel-lra/src/test/java/org/apache/camel/service/lra/LRASagaRoutesTest.java b/components/camel-lra/src/test/java/org/apache/camel/service/lra/LRASagaRoutesTest.java
index ae9ecfd74160..c9762505cf6e 100644
--- a/components/camel-lra/src/test/java/org/apache/camel/service/lra/LRASagaRoutesTest.java
+++ b/components/camel-lra/src/test/java/org/apache/camel/service/lra/LRASagaRoutesTest.java
@@ -23,9 +23,13 @@ import java.util.Map;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.DisplayName;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class LRASagaRoutesTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(LRASagaRoutesTest.class);
+
     private Method getParseQueryMethod() throws NoSuchMethodException {
         Method method = LRASagaRoutes.class.getDeclaredMethod("parseQuery", String.class);
         method.setAccessible(true);
@@ -40,7 +44,7 @@ public class LRASagaRoutesTest {
                 .invoke(new LRASagaRoutes(null),
                         "Camel-Saga-Compensate=direct://saga1_participant1_compensate&Camel-Saga-Complete=direct://saga1_participant1_complete");
 
-        System.out.println(testResult.toString());
+        LOG.debug("Parsed query: {}", testResult);
 
         Assertions.assertNotNull(testResult, "pared query must not be null");
         Assertions.assertEquals(2, testResult.size(), "query parameter count must be two");
@@ -61,7 +65,7 @@ public class LRASagaRoutesTest {
         Map<String, String> testResult = (Map<String, String>) getParseQueryMethod()
                 .invoke(new LRASagaRoutes(null), "key1=value1&key2");
 
-        System.out.println(testResult.toString());
+        LOG.debug("Parsed query: {}", testResult);
 
         Assertions.assertNotNull(testResult, "pared query must not be null");
         Assertions.assertEquals(2, testResult.size(), "query parameter count must be two");
@@ -83,7 +87,7 @@ public class LRASagaRoutesTest {
                 .invoke(new LRASagaRoutes(null),
                         "Camel-Saga-Compensate=direct%3A%2F%2Fsaga1_participant1_compensate&Camel-Saga-Complete=direct%3A%2F%2Fsaga1_participant1_complete");
 
-        System.out.println(testResult.toString());
+        LOG.debug("Parsed query: {}", testResult);
 
         Assertions.assertNotNull(testResult, "pared query must not be null");
         Assertions.assertEquals(2, testResult.size(), "query parameter count must be two");
diff --git a/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpServerConsumerTransactionTest.java b/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpServerConsumerTransactionTest.java
index 46f474e99dd4..b8c79d538642 100644
--- a/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpServerConsumerTransactionTest.java
+++ b/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpServerConsumerTransactionTest.java
@@ -18,14 +18,11 @@ package org.apache.camel.component.mllp;
 
 import java.util.concurrent.TimeUnit;
 
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.camel.BindToRegistry;
 import org.apache.camel.CamelContext;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.sjms.SjmsComponent;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.infra.artemis.services.ArtemisService;
@@ -36,10 +33,14 @@ import org.apache.camel.test.mllp.Hl7TestMessageGenerator;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @Disabled("This test hangs")
 public class MllpTcpServerConsumerTransactionTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(MllpTcpServerConsumerTransactionTest.class);
+
     @RegisterExtension
     public static ArtemisService service = ArtemisServiceFactory.createVMService();
 
@@ -65,16 +66,7 @@ public class MllpTcpServerConsumerTransactionTest extends CamelTestSupport {
         return context;
     }
 
-    @BindToRegistry("target")
-    public SjmsComponent addTargetComponent() {
-
-        SjmsComponent target = new SjmsComponent();
-        target.setConnectionFactory(new ActiveMQConnectionFactory(service.serviceAddress()));
-
-        return target;
-    }
-
-    @Override
+	@Override
     protected RouteBuilder createRouteBuilder() {
 
         mllpClient.setMllpHost("localhost");
@@ -106,7 +98,7 @@ public class MllpTcpServerConsumerTransactionTest extends CamelTestSupport {
 
                 from("target://test-queue")
                         .routeId("jms-consumer")
-                        .process(exchange -> System.out.println(exchange.getIn().getBody()))
+                        .process(exchange -> LOG.info("Body: {}", exchange.getIn().getBody()))
                         .log(LoggingLevel.INFO, routeId, "Test JMS Consumer received message")
                         .to(result);
 
diff --git a/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/AbstractOAuthCodeFlowTest.java b/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/AbstractOAuthCodeFlowTest.java
index 96ea77f3813f..3100bee09df2 100644
--- a/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/AbstractOAuthCodeFlowTest.java
+++ b/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/AbstractOAuthCodeFlowTest.java
@@ -20,12 +20,16 @@ import org.apache.camel.CamelContext;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Assumptions;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Test OIDC CodeFlow for a simple WebApp deployed on platform-http
  */
 abstract class AbstractOAuthCodeFlowTest extends AbstractKeycloakTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractOAuthCodeFlowTest.class);
+
     @Test
     void testCodeFlowAuth() throws Exception {
 
@@ -42,8 +46,8 @@ abstract class AbstractOAuthCodeFlowTest extends AbstractKeycloakTest {
             Assertions.assertEquals(1, keycloak.realm(KEYCLOAK_REALM).clients().findByClientId(TEST_CLIENT_ID).size());
             Assertions.assertEquals(1, keycloak.realm(KEYCLOAK_REALM).users().search("alice").size());
 
-            System.out.println("✅ Keycloak realm, client, and user available!");
-            System.out.println("✅ Open: " + APP_BASE_URL);
+            LOG.info("✅ Keycloak realm, client, and user available!");
+            LOG.info("✅ Open: {}", APP_BASE_URL);
 
             // Open WebApp in Browser (works on macOS)
             // Runtime.getRuntime().exec("open " + APP_BASE_URL);
@@ -54,11 +58,11 @@ abstract class AbstractOAuthCodeFlowTest extends AbstractKeycloakTest {
             for (int i = maxLoopCount; i > 0; i--) {
                 var options = context.getGlobalOptions();
                 if ("ok".equals(options.get("OAuthLogout"))) {
-                    System.out.println("✅ OAuthLogout - ok");
+                    LOG.info("✅ OAuthLogout - ok");
                     i = 0;
                 }
                 if (i % 4 == 0) {
-                    System.out.printf("Waiting on logout: %d/%d - %s%n", maxLoopCount - i, maxLoopCount,
+                    LOG.info("Waiting on logout: {}/{} - {}", maxLoopCount - i, maxLoopCount,
                             APP_BASE_URL + "logout");
                 }
                 Thread.sleep(500L);
diff --git a/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/SSLCertTrustTest.java b/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/SSLCertTrustTest.java
index 0a401caab9a4..d2b00ca4768b 100644
--- a/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/SSLCertTrustTest.java
+++ b/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/SSLCertTrustTest.java
@@ -31,9 +31,13 @@ import javax.net.ssl.TrustManagerFactory;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Assumptions;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 class SSLCertTrustTest extends AbstractKeycloakTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(SSLCertTrustTest.class);
+
     @Test
     void testCheckClusterCertificateTrust() throws Exception {
 
@@ -57,11 +61,11 @@ class SSLCertTrustTest extends AbstractKeycloakTest {
                 xtm.checkServerTrusted(new X509Certificate[] { cert }, "RSA");
             }
         } catch (CertificateException ex) {
-            System.err.println("Untrusted, because of: " + ex);
+            LOG.error("Untrusted, because of: ", ex);
             return;
         }
 
-        System.out.println("Trusted");
+        LOG.info("Trusted");
     }
 
     @Test
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LoginConfigHelper.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LoginConfigHelper.java
index 97f0332e7402..cf148a1636e4 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LoginConfigHelper.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LoginConfigHelper.java
@@ -23,11 +23,14 @@ import java.util.ResourceBundle;
 
 import org.apache.camel.support.jsse.KeyStoreParameters;
 import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.camel.util.ObjectHelper.isNotEmpty;
 
 public final class LoginConfigHelper {
 
+    private static final Logger LOG = LoggerFactory.getLogger(LoginConfigHelper.class);
     private static final LoginConfigHelper INSTANCE = new LoginConfigHelper();
 
     private final Map<String, String> configuration;
@@ -85,59 +88,59 @@ public final class LoginConfigHelper {
         try {
             loginConfig.validate();
         } catch (final IllegalArgumentException e) {
-            System.out.println("To run integration tests Salesforce Authentication information is");
-            System.out.println("needed.");
-            System.out.println("You need to specify the configuration for running tests by either");
-            System.out.println("specifying environment variables, Maven properties or create a Java");
-            System.out.println("properties file at:");
-            System.out.println();
-            System.out.println("camel/components/camel-salesforce/test-salesforce-login.properties");
-            System.out.println();
-            System.out.println("With authentication information to access a Salesforce instance.");
-            System.out.println("You can use:");
-            System.out.println();
-            System.out.println("camel/components/camel-salesforce/test-salesforce-login.sample.properties");
-            System.out.println();
-            System.out.println("as reference. A free Salesforce developer account can be obtained at:");
-            System.out.println();
-            System.out.println("https://developer.salesforce.com");
-            System.out.println();
-            System.out.println("Properties that you need to set:");
-            System.out.println();
-            System.out.println("| Maven or properties file     | Environment variable         | Use    |");
-            System.out.println("|------------------------------+------------------------------+--------|");
-            System.out.println("| salesforce.client.id         | SALESFORCE_CLIENT_ID         | ALL    |");
-            System.out.println("| salesforce.client.secret     | SALESFORCE_CLIENT_SECRET     | UP, RT |");
-            System.out.println("| salesforce.username          | SALESFORCE_USERNAME          | UP, JWT|");
-            System.out.println("| salesforce.password          | SALESFORCE_PASSWORD          | UP     |");
-            System.out.println("| salesforce.refreshToken      | SALESFORCE_REFRESH_TOKEN     | RT     |");
-            System.out.println("| salesforce.keystore.path     | SALESFORCE_KEYSTORE_PATH     | JWT    |");
-            System.out.println("| salesforce.keystore.type     | SALESFORCE_KEYSTORE_TYPE     | JWT    |");
-            System.out.println("| salesforce.keystore.password | SALESFORCE_KEYSTORE_PASSWORD | JWT    |");
-            System.out.println("| salesforce.login.url         | SALESFORCE_LOGIN_URL         | ALL    |");
-            System.out.println();
-            System.out.println("* ALL - required always");
-            System.out.println("* UP  - when using username and password authentication");
-            System.out.println("* RT  - when using refresh token flow");
-            System.out.println("* JWT - when using JWT flow");
-            System.out.println();
-            System.out.println("You can force authentication type to be one of USERNAME_PASSWORD,");
-            System.out.println("REFRESH_TOKEN or JWT by setting `salesforce.auth.type` (or ");
-            System.out.println("`SALESFORCE_AUTH_TYPE` for environment variables).");
-            System.out.println();
-            System.out.println("Examples:");
-            System.out.println();
-            System.out.println("Using environment:");
-            System.out.println();
-            System.out.println("$ export SALESFORCE_CLIENT_ID=...");
-            System.out.println("$ export SALESFORCE_CLIENT_SECRET=...");
-            System.out.println("$ export ...others...");
-            System.out.println();
-            System.out.println("or using Maven properties:");
-            System.out.println();
-            System.out.println("$ mvn -Pintegration -Dsalesforce.client.id=... \\");
-            System.out.println("  -Dsalesforce.client.secret=... ...");
-            System.out.println();
+            LOG.info("To run integration tests Salesforce Authentication information is");
+            LOG.info("needed.");
+            LOG.info("You need to specify the configuration for running tests by either");
+            LOG.info("specifying environment variables, Maven properties or create a Java");
+            LOG.info("properties file at:");
+            LOG.info("");
+            LOG.info("camel/components/camel-salesforce/test-salesforce-login.properties");
+            LOG.info("");
+            LOG.info("With authentication information to access a Salesforce instance.");
+            LOG.info("You can use:");
+            LOG.info("");
+            LOG.info("camel/components/camel-salesforce/test-salesforce-login.sample.properties");
+            LOG.info("");
+            LOG.info("as reference. A free Salesforce developer account can be obtained at:");
+            LOG.info("");
+            LOG.info("https://developer.salesforce.com");
+            LOG.info("");
+            LOG.info("Properties that you need to set:");
+            LOG.info("");
+            LOG.info("| Maven or properties file     | Environment variable         | Use    |");
+            LOG.info("|------------------------------+------------------------------+--------|");
+            LOG.info("| salesforce.client.id         | SALESFORCE_CLIENT_ID         | ALL    |");
+            LOG.info("| salesforce.client.secret     | SALESFORCE_CLIENT_SECRET     | UP, RT |");
+            LOG.info("| salesforce.username          | SALESFORCE_USERNAME          | UP, JWT|");
+            LOG.info("| salesforce.password          | SALESFORCE_PASSWORD          | UP     |");
+            LOG.info("| salesforce.refreshToken      | SALESFORCE_REFRESH_TOKEN     | RT     |");
+            LOG.info("| salesforce.keystore.path     | SALESFORCE_KEYSTORE_PATH     | JWT    |");
+            LOG.info("| salesforce.keystore.type     | SALESFORCE_KEYSTORE_TYPE     | JWT    |");
+            LOG.info("| salesforce.keystore.password | SALESFORCE_KEYSTORE_PASSWORD | JWT    |");
+            LOG.info("| salesforce.login.url         | SALESFORCE_LOGIN_URL         | ALL    |");
+            LOG.info("");
+            LOG.info("* ALL - required always");
+            LOG.info("* UP  - when using username and password authentication");
+            LOG.info("* RT  - when using refresh token flow");
+            LOG.info("* JWT - when using JWT flow");
+            LOG.info("");
+            LOG.info("You can force authentication type to be one of USERNAME_PASSWORD,");
+            LOG.info("REFRESH_TOKEN or JWT by setting `salesforce.auth.type` (or ");
+            LOG.info("`SALESFORCE_AUTH_TYPE` for environment variables).");
+            LOG.info("");
+            LOG.info("Examples:");
+            LOG.info("");
+            LOG.info("Using environment:");
+            LOG.info("");
+            LOG.info("$ export SALESFORCE_CLIENT_ID=...");
+            LOG.info("$ export SALESFORCE_CLIENT_SECRET=...");
+            LOG.info("$ export ...others...");
+            LOG.info("");
+            LOG.info("or using Maven properties:");
+            LOG.info("");
+            LOG.info("$ mvn -Pintegration -Dsalesforce.client.id=... \\");
+            LOG.info("  -Dsalesforce.client.secret=... ...");
+            LOG.info("");
         }
     }
 
diff --git a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ProducerTest.java b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ProducerTest.java
index e49a029ce949..7903f5a272e9 100644
--- a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ProducerTest.java
+++ b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ProducerTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.splunk;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
 import com.splunk.Args;
@@ -70,6 +71,8 @@ public class ProducerTest extends SplunkMockTestSupport {
     @Mock
     private InputCollection inputCollection;
 
+    private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
     @BeforeEach
     public void setup() throws IOException {
         when(service.getIndexes()).thenReturn(indexColl);
@@ -79,7 +82,7 @@ public class ProducerTest extends SplunkMockTestSupport {
         when(inputCollection.get(anyString())).thenReturn(input);
         when(indexColl.get(anyString())).thenReturn(index);
         when(index.attach(isA(Args.class))).thenReturn(socket);
-        when(socket.getOutputStream()).thenReturn(System.out);
+        when(socket.getOutputStream()).thenReturn(baos);
     }
 
     @Test
diff --git a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/RawProducerTest.java b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/RawProducerTest.java
index 0be23ab82fbb..eea8290725c5 100644
--- a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/RawProducerTest.java
+++ b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/RawProducerTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.splunk;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
 import com.splunk.Args;
@@ -61,6 +62,8 @@ public class RawProducerTest extends SplunkMockTestSupport {
     @Mock
     private InputCollection inputCollection;
 
+    private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
     @BeforeEach
     public void setup() throws IOException {
         when(service.getIndexes()).thenReturn(indexColl);
@@ -70,7 +73,7 @@ public class RawProducerTest extends SplunkMockTestSupport {
         when(inputCollection.get(anyString())).thenReturn(input);
         when(indexColl.get(anyString())).thenReturn(index);
         when(index.attach(isA(Args.class))).thenReturn(socket);
-        when(socket.getOutputStream()).thenReturn(System.out);
+        when(socket.getOutputStream()).thenReturn(baos);
     }
 
     @Test
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 09fcdfb29ecc..7ec4c2630851 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
@@ -43,11 +43,14 @@ import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.core.JsonParser;
 import org.apache.commons.io.IOUtils;
 import org.skyscreamer.jsonassert.JSONAssert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xmlunit.assertj3.XmlAssert;
 import org.xmlunit.builder.Input;
 
 final class XJTestUtils {
 
+    private static final Logger LOG = LoggerFactory.getLogger(XJTestUtils.class);
     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();
@@ -118,7 +121,7 @@ final class XJTestUtils {
             transformer.transform(new StreamSource(inputFile), stAXResult);
         } catch (Exception e) {
             String result = byteArrayOutputStream.toString(StandardCharsets.UTF_8.name());
-            System.out.println(result);
+            LOG.error("Transformation failed, partial result: {}", result, e);
             throw e;
         }
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIncludeEncodingRouteTest.java b/core/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIncludeEncodingRouteTest.java
index 3aec71d2af91..1f74f72e2825 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIncludeEncodingRouteTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIncludeEncodingRouteTest.java
@@ -23,12 +23,16 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  *
  */
 public class ValidatorIncludeEncodingRouteTest extends ContextTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(ValidatorIncludeEncodingRouteTest.class);
+
     protected MockEndpoint validEndpoint;
     protected MockEndpoint finallyEndpoint;
     protected MockEndpoint invalidEndpoint;
@@ -66,7 +70,7 @@ public class ValidatorIncludeEncodingRouteTest extends ContextTestSupport {
                         .process(new Processor() {
                             @Override
                             public void process(Exchange exchange) {
-                                System.err.println("helo " + exchange.getException());
+                                LOG.error("helo", exchange.getException());
                             }
                         }).to("mock:invalid").doFinally().to("mock:finally").end();
             }
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java
index 104dc0d17040..15462e4daccc 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java
@@ -29,12 +29,15 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.spi.LoadablePropertiesSource;
 import org.apache.camel.spi.PropertiesComponent;
 import org.apache.camel.util.OrderedProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Support for command line arguments to Camel main.
  */
 public abstract class MainCommandLineSupport extends MainSupport {
 
+    protected static final Logger LOG = LoggerFactory.getLogger(MainCommandLineSupport.class);
     protected final List<Option> options = new ArrayList<>();
     protected Properties argumentProperties;
     private volatile boolean initOptionsDone;
@@ -188,7 +191,7 @@ public abstract class MainCommandLineSupport extends MainSupport {
         showOptionsHeader();
 
         for (Option option : options) {
-            System.out.println(option.getInformation());
+            LOG.info(option.getInformation());
         }
     }
 
@@ -211,8 +214,7 @@ public abstract class MainCommandLineSupport extends MainSupport {
                 }
             }
             if (!handled) {
-                System.out.println("Unknown option: " + arg);
-                System.out.println();
+                LOG.error("Unknown option: {}", arg);
                 valid = false;
                 break;
             }
@@ -295,8 +297,7 @@ public abstract class MainCommandLineSupport extends MainSupport {
      * Displays the header message for the command line options.
      */
     public void showOptionsHeader() {
-        System.out.println("Apache Camel Runner takes the following options");
-        System.out.println();
+        LOG.info("Apache Camel Runner takes the following options");
     }
 
     public abstract static class Option {
@@ -348,7 +349,7 @@ public abstract class MainCommandLineSupport extends MainSupport {
         @Override
         protected void doProcess(String arg, LinkedList<String> remainingArgs) {
             if (remainingArgs.isEmpty()) {
-                System.err.println("Expected fileName for ");
+                LOG.error("Expected parameter for option: {}", arg);
                 showOptions();
                 completed();
             } else {
diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/MXParser.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/MXParser.java
index f19457d9ae88..da4bab61bc5d 100644
--- a/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/MXParser.java
+++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/MXParser.java
@@ -33,6 +33,8 @@ import java.io.InputStreamReader;
 import java.io.Reader;
 
 import org.apache.camel.xml.io.util.XmlStreamReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 // https://github.com/codelibs/xpp3/blob/master/src/main/java/org/xmlpull/mxp1/MXParser.java
 
@@ -49,6 +51,7 @@ import org.apache.camel.xml.io.util.XmlStreamReader;
  * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
  */
 public class MXParser implements XmlPullParser {
+    private static final Logger LOG = LoggerFactory.getLogger(MXParser.class);
     // NOTE: no interning of those strings --> by Java lang spec they MUST be
     // already interned
     protected static final String XML_URI = "http://www.w3.org/XML/1998/namespace";
@@ -73,7 +76,7 @@ public class MXParser implements XmlPullParser {
     protected boolean allStringsInterned;
 
     protected void resetStringCache() {
-        // System.out.println("resetStringCache() minimum called");
+        // LOG.trace("resetStringCache() minimum called");
     }
 
     protected String newString(char[] cbuf, int off, int len) {
@@ -84,8 +87,6 @@ public class MXParser implements XmlPullParser {
         return (new String(cbuf, off, len)).intern();
     }
 
-    private static final boolean TRACE_SIZING = false;
-
     // NOTE: features are not resettable and typically defaults to false ...
     protected boolean processNamespaces;
     protected boolean roundtripSupported;
@@ -121,9 +122,7 @@ public class MXParser implements XmlPullParser {
             // we add at least one extra slot ...
             final int newSize = (depth >= 7 ? 2 * depth : 8) + 2; // = lucky 7 +
                                                                  // 1 //25
-            if (TRACE_SIZING) {
-                System.err.println("TRACE_SIZING elStackSize " + elStackSize + " ==> " + newSize);
-            }
+            LOG.trace("elStackSize {} ==> {}", elStackSize, newSize);
             final boolean needsCopying = elStackSize > 0;
             String[] arr;
             // reuse arr local variable slot
@@ -167,23 +166,6 @@ public class MXParser implements XmlPullParser {
                 System.arraycopy(elRawName, 0, carr, 0, elStackSize);
             }
             elRawName = carr;
-            // arr = new String[newSize];
-            // if(needsCopying) System.arraycopy(elLocalName, 0, arr, 0,
-            // elStackSize);
-            // elLocalName = arr;
-            // arr = new String[newSize];
-            // if(needsCopying) System.arraycopy(elDefaultNs, 0, arr, 0,
-            // elStackSize);
-            // elDefaultNs = arr;
-            // int[] iarr = new int[newSize];
-            // if(needsCopying) System.arraycopy(elNsStackPos, 0, iarr, 0,
-            // elStackSize);
-            // for (int i = elStackSize; i < iarr.length; i++)
-            // {
-            // iarr[i] = (i > 0) ? -1 : 0;
-            // }
-            // elNsStackPos = iarr;
-            // assert depth < elName.length;
         }
     }
 
@@ -206,9 +188,7 @@ public class MXParser implements XmlPullParser {
         final int attrPosSize = attributeName != null ? attributeName.length : 0;
         if (size >= attrPosSize) {
             final int newSize = size > 7 ? 2 * size : 8; // = lucky 7 + 1 //25
-            if (TRACE_SIZING) {
-                System.err.println("TRACE_SIZING attrPosSize " + attrPosSize + " ==> " + newSize);
-            }
+            LOG.trace("attrPosSize {} ==> {}", attrPosSize, newSize);
             final boolean needsCopying = attrPosSize > 0;
             String[] arr;
 
@@ -238,7 +218,6 @@ public class MXParser implements XmlPullParser {
                     System.arraycopy(attributeNameHash, 0, iarr, 0, attrPosSize);
                 attributeNameHash = iarr;
             }
-            // //assert attrUri.length > size
         }
     }
 
@@ -252,9 +231,7 @@ public class MXParser implements XmlPullParser {
         final int namespaceSize = namespacePrefix != null ? namespacePrefix.length : 0;
         if (size >= namespaceSize) {
             final int newSize = size > 7 ? 2 * size : 8; // = lucky 7 + 1 //25
-            if (TRACE_SIZING) {
-                System.err.println("TRACE_SIZING namespaceSize " + namespaceSize + " ==> " + newSize);
-            }
+            LOG.trace("namespaceSize {} ==> {}", namespaceSize, newSize);
             final String[] newNamespacePrefix = new String[newSize];
             final String[] newNamespaceUri = new String[newSize];
             if (namespacePrefix != null) {
@@ -271,8 +248,6 @@ public class MXParser implements XmlPullParser {
                 }
                 namespacePrefixHash = newNamespacePrefixHash;
             }
-            // prefixesSize = newSize;
-            // //assert nsPrefixes.length > size && nsPrefixes.length == newSize
         }
     }
 
@@ -283,23 +258,12 @@ public class MXParser implements XmlPullParser {
     protected static int fastHash(char[] ch, int off, int len) {
         if (len == 0)
             return 0;
-        // assert len >0
         int hash = ch[off]; // hash at beginning
-        // try {
         hash = (hash << 7) + ch[off + len - 1]; // hash at the end
-        // } catch(ArrayIndexOutOfBoundsException aie) {
-        // aie.printStackTrace(); //should never happen ...
-        // throw new RuntimeException("this is violation of pre-condition");
-        // }
         if (len > 16)
             hash = (hash << 7) + ch[off + (len / 4)]; // 1/4 from beginning
         if (len > 8)
             hash = (hash << 7) + ch[off + (len / 2)]; // 1/2 of string size ...
-        // notice that hash is at most done 3 times <<7 so shifted by 21 bits 8
-        // bit value
-        // so max result == 29 bits so it is quite just below 31 bits for long
-        // (2^32) ...
-        // assert hash >= 0;
         return hash;
     }
 
@@ -317,10 +281,7 @@ public class MXParser implements XmlPullParser {
         final int entitySize = entityReplacementBuf != null ? entityReplacementBuf.length : 0;
         if (entityEnd >= entitySize) {
             final int newSize = entityEnd > 7 ? 2 * entityEnd : 8; // = lucky 7
-                                                                  // + 1 //25
-            if (TRACE_SIZING) {
-                System.err.println("TRACE_SIZING entitySize " + entitySize + " ==> " + newSize);
-            }
+            LOG.trace("entitySize {} ==> {}", entitySize, newSize);
             final String[] newEntityName = new String[newSize];
             final char[][] newEntityNameBuf = new char[newSize][];
             final String[] newEntityReplacement = new String[newSize];
@@ -353,12 +314,9 @@ public class MXParser implements XmlPullParser {
     protected String inputEncoding;
 
     protected int bufLoadFactor = 95; // 99%
-    // protected int bufHardLimit; // only matters when expanding
 
     protected char[] buf = new char[Runtime.getRuntime().freeMemory() > 1000000L ? READ_CHUNK_SIZE : 256];
     protected int bufSoftLimit = (bufLoadFactor * buf.length) / 100; // desirable
-                                                                    // size of
-                                                                    // buffer
     protected boolean preventBufferCompaction;
 
     protected int bufAbsoluteStart; // this is buf
@@ -372,9 +330,6 @@ public class MXParser implements XmlPullParser {
     protected int pcStart;
     protected int pcEnd;
 
-    // parsing state
-    // protected boolean needsMore;
-    // protected boolean seenMarkup;
     protected boolean usePC;
 
     protected boolean seenStartTag;
@@ -384,7 +339,6 @@ public class MXParser implements XmlPullParser {
     protected boolean seenMarkup;
     protected boolean seenDocdecl;
 
-    // transient variable set during each call to next/Token()
     protected boolean tokenize;
     protected String text;
     protected String entityRefName;
@@ -394,7 +348,6 @@ public class MXParser implements XmlPullParser {
     protected String xmlDeclContent;
 
     protected void reset() {
-        // System.out.println("reset() called");
         location = null;
         startLineNumber = 1;
         lineNumber = 1;
@@ -441,13 +394,6 @@ public class MXParser implements XmlPullParser {
     public MXParser() {
     }
 
-    /**
-     * Method setFeature
-     *
-     * @param  name                   a String
-     * @param  state                  a boolean
-     * @throws XmlPullParserException
-     */
     public void setFeature(String name, boolean state) throws XmlPullParserException {
         if (name == null)
             throw new IllegalArgumentException("feature name should not be null");
@@ -455,11 +401,6 @@ public class MXParser implements XmlPullParser {
             if (eventType != START_DOCUMENT)
                 throw new XmlPullParserException("namespace processing feature can only be changed before parsing", this, null);
             processNamespaces = state;
-            // } else if(FEATURE_REPORT_NAMESPACE_ATTRIBUTES.equals(name)) {
-            // if(type != START_DOCUMENT) throw new XmlPullParserException(
-            // "namespace reporting feature can only be changed before parsing",
-            // this, null);
-            // reportNsAttribs = state;
         } else if (FEATURE_NAMES_INTERNED.equals(name)) {
             if (state) {
                 throw new XmlPullParserException("interning names in this implementation is not supported");
@@ -468,37 +409,23 @@ public class MXParser implements XmlPullParser {
             if (state) {
                 throw new XmlPullParserException("processing DOCDECL is not supported");
             }
-            // } else if(REPORT_DOCDECL.equals(name)) {
-            // paramNotifyDoctype = state;
         } else if (FEATURE_XML_ROUNDTRIP.equals(name)) {
-            // if(state == false) {
-            // throw new XmlPullParserException(
-            // "roundtrip feature can not be switched off");
-            // }
             roundtripSupported = state;
         } else {
             throw new XmlPullParserException("unsupported feature " + name);
         }
     }
 
-    /**
-     * Unknown properties are <strong>always</strong> returned as false
-     */
     public boolean getFeature(String name) {
         if (name == null)
             throw new IllegalArgumentException("feature name should not be null");
         if (FEATURE_PROCESS_NAMESPACES.equals(name)) {
             return processNamespaces;
-            // } else if(FEATURE_REPORT_NAMESPACE_ATTRIBUTES.equals(name)) {
-            // return reportNsAttribs;
         } else if (FEATURE_NAMES_INTERNED.equals(name)) {
             return false;
         } else if (FEATURE_PROCESS_DOCDECL.equals(name)) {
             return false;
-            // } else if(REPORT_DOCDECL.equals(name)) {
-            // return paramNotifyDoctype;
         } else if (FEATURE_XML_ROUNDTRIP.equals(name)) {
-            // return true;
             return roundtripSupported;
         }
         return false;
@@ -559,13 +486,7 @@ public class MXParser implements XmlPullParser {
     }
 
     public void defineEntityReplacementText(String entityName, String replacementText) throws XmlPullParserException {
-        // throw new XmlPullParserException("not allowed");
-
-        // protected char[] entityReplacement[];
         ensureEntityCapacity();
-
-        // this is to make sure that if interning works we will take advantage
-        // of it ...
         this.entityName[entityEnd] = newString(entityName.toCharArray(), 0, entityName.length());
         entityNameBuf[entityEnd] = entityName.toCharArray();
 
@@ -575,26 +496,18 @@ public class MXParser implements XmlPullParser {
             entityNameHash[entityEnd] = fastHash(entityNameBuf[entityEnd], 0, entityNameBuf[entityEnd].length);
         }
         ++entityEnd;
-        // TODO disallow < or & in entity replacement text (or ]]>???)
-        // TOOD keepEntityNormalizedForAttributeValue cached as well ...
     }
 
     public int getNamespaceCount(int depth) throws XmlPullParserException {
         if (!processNamespaces || depth == 0) {
             return 0;
         }
-        // int maxDepth = eventType == END_TAG ? this.depth + 1 : this.depth;
-        // if(depth < 0 || depth > maxDepth) throw new IllegalArgumentException(
         if (depth < 0 || depth > this.depth)
             throw new IllegalArgumentException("allowed namespace depth 0.." + this.depth + " not " + depth);
         return elNamespaceCount[depth];
     }
 
     public String getNamespacePrefix(int pos) throws XmlPullParserException {
-
-        // int end = eventType == END_TAG ? elNamespaceCount[ depth + 1 ] :
-        // namespaceEnd;
-        // if(pos < end) {
         if (pos < namespaceEnd) {
             return namespacePrefix[pos];
         } else {
@@ -603,9 +516,6 @@ public class MXParser implements XmlPullParser {
     }
 
     public String getNamespaceUri(int pos) throws XmlPullParserException {
-        // int end = eventType == END_TAG ? elNamespaceCount[ depth + 1 ] :
-        // namespaceEnd;
-        // if(pos < end) {
         if (pos < namespaceEnd) {
             return namespaceUri[pos];
         } else {
@@ -613,10 +523,7 @@ public class MXParser implements XmlPullParser {
         }
     }
 
-    public String getNamespace(String prefix)
-    // throws XmlPullParserException
-    {
-        // int count = namespaceCount[ depth ];
+    public String getNamespace(String prefix) {
         if (prefix != null) {
             for (int i = namespaceEnd - 1; i >= 0; i--) {
                 if (prefix.equals(namespacePrefix[i])) {
@@ -630,8 +537,7 @@ public class MXParser implements XmlPullParser {
             }
         } else {
             for (int i = namespaceEnd - 1; i >= 0; i--) {
-                if (namespacePrefix[i] == null) { // "") { //null ) { //TODO
-                                                 // check FIXME Alek
+                if (namespacePrefix[i] == null) {
                     return namespaceUri[i];
                 }
             }
@@ -645,8 +551,6 @@ public class MXParser implements XmlPullParser {
     }
 
     private static int findFragment(int bufMinPos, char[] b, int start, int end) {
-        // System.err.println("bufStart="+bufStart+" b="+printable(new String(b,
-        // start, end - start))+" start="+start+" end="+end);
         if (start < bufMinPos) {
             start = bufMinPos;
             if (start > end)
@@ -667,23 +571,16 @@ public class MXParser implements XmlPullParser {
         return i;
     }
 
-    /**
-     * Return string describing current position of parsers as text 'STATE [seen %s...] @line:column'.
-     */
     public String getPositionDescription() {
         String fragment = null;
         if (posStart <= pos) {
             final int start = findFragment(0, buf, posStart, pos);
-            // System.err.println("start="+start);
             if (start < pos) {
                 fragment = new String(buf, start, pos - start);
             }
             if (bufAbsoluteStart > 0 || start > 0)
                 fragment = "..." + fragment;
         }
-        // return " at line "+tokenizerPosRow
-        // +" and column "+(tokenizerPosCol-1)
-        // +(fragment != null ? " seen "+printable(fragment)+"..." : "");
         return " " + TYPES[eventType] + (fragment != null ? " seen " + printable(fragment) + "..." : "") + " "
                + (location != null ? location : "") + "@" + getLineNumber() + ":"
                + getColumnNumber();
@@ -724,12 +621,7 @@ public class MXParser implements XmlPullParser {
 
     public String getText() {
         if (eventType == START_DOCUMENT || eventType == END_DOCUMENT) {
-            // throw new XmlPullParserException("no content available to read");
-            // if(roundtripSupported) {
-            // text = new String(buf, posStart, posEnd - posStart);
-            // } else {
             return null;
-            // }
         } else if (eventType == ENTITY_REF) {
             return text;
         }
@@ -762,52 +654,24 @@ public class MXParser implements XmlPullParser {
             holderForStartAndLength[1] = posEnd - posStart;
             return buf;
         } else if (eventType == START_DOCUMENT || eventType == END_DOCUMENT) {
-            // throw new XmlPullParserException("no content available to read");
             holderForStartAndLength[0] = holderForStartAndLength[1] = -1;
             return null;
         } else {
             throw new IllegalArgumentException("unknown text eventType: " + eventType);
         }
-        // String s = getText();
-        // char[] cb = null;
-        // if(s!= null) {
-        // cb = s.toCharArray();
-        // holderForStartAndLength[0] = 0;
-        // holderForStartAndLength[1] = s.length();
-        // } else {
-        // }
-        // return cb;
     }
 
     public String getNamespace() {
         if (eventType == START_TAG) {
-            // return processNamespaces ? elUri[ depth - 1 ] : NO_NAMESPACE;
             return processNamespaces ? elUri[depth] : NO_NAMESPACE;
         } else if (eventType == END_TAG) {
             return processNamespaces ? elUri[depth] : NO_NAMESPACE;
         }
         return null;
-        // String prefix = elPrefix[ maxDepth ];
-        // if(prefix != null) {
-        // for( int i = namespaceEnd -1; i >= 0; i--) {
-        // if( prefix.equals( namespacePrefix[ i ] ) ) {
-        // return namespaceUri[ i ];
-        // }
-        // }
-        // } else {
-        // for( int i = namespaceEnd -1; i >= 0; i--) {
-        // if( namespacePrefix[ i ] == null ) {
-        // return namespaceUri[ i ];
-        // }
-        // }
-        //
-        // }
-        // return "";
     }
 
     public String getName() {
         if (eventType == START_TAG) {
-            // return elName[ depth - 1 ] ;
             return elName[depth];
         } else if (eventType == END_TAG) {
             return elName[depth];
@@ -828,15 +692,11 @@ public class MXParser implements XmlPullParser {
 
     public String getPrefix() {
         if (eventType == START_TAG) {
-            // return elPrefix[ depth - 1 ] ;
             return elPrefix[depth];
         } else if (eventType == END_TAG) {
             return elPrefix[depth];
         }
         return null;
-        // if(eventType != START_TAG && eventType != END_TAG) return null;
-        // int maxDepth = eventType == END_TAG ? depth : depth - 1;
-        // return elPrefix[ maxDepth ];
     }
 
     public boolean isEmptyElementTag() throws XmlPullParserException {
@@ -909,7 +769,6 @@ public class MXParser implements XmlPullParser {
         if (name == null) {
             throw new IllegalArgumentException("attribute name can not be null");
         }
-        // TODO make check if namespace is interned!!! etc. for names!!!
         if (processNamespaces) {
             if (namespace == null) {
                 namespace = "";
@@ -917,9 +776,6 @@ public class MXParser implements XmlPullParser {
 
             for (int i = 0; i < attributeCount; ++i) {
                 if ((namespace == attributeUri[i] || namespace.equals(attributeUri[i]))
-                        // (namespace != null && namespace.equals(attributeUri[ i
-                        // ]))
-                        // taking advantage of String.intern()
                         && name.equals(attributeName[i])) {
                     return attributeValue[i];
                 }
@@ -968,10 +824,6 @@ public class MXParser implements XmlPullParser {
         }
     }
 
-    /**
-     * Skip sub tree that is currently parser positioned on. <br>
-     * NOTE: parser must be on START_TAG and when function returns parser will be positioned on corresponding END_TAG
-     */
     public void skipSubTree() throws XmlPullParserException, IOException {
         require(START_TAG, null, null);
         int level = 1;
@@ -985,35 +837,7 @@ public class MXParser implements XmlPullParser {
         }
     }
 
-    // public String readText() throws XmlPullParserException, IOException
-    // {
-    // if (getEventType() != TEXT) return "";
-    // String result = getText();
-    // next();
-    // return result;
-    // }
-
     public String nextText() throws XmlPullParserException, IOException {
-        // String result = null;
-        // boolean onStartTag = false;
-        // if(eventType == START_TAG) {
-        // onStartTag = true;
-        // next();
-        // }
-        // if(eventType == TEXT) {
-        // result = getText();
-        // next();
-        // } else if(onStartTag && eventType == END_TAG) {
-        // result = "";
-        // } else {
-        // throw new XmlPullParserException(
-        // "parser must be on START_TAG or TEXT to read text", this, null);
-        // }
-        // if(eventType != END_TAG) {
-        // throw new XmlPullParserException(
-        // "event TEXT it must be immediately followed by END_TAG", this, null);
-        // }
-        // return result;
         if (getEventType() != START_TAG) {
             throw new XmlPullParserException("parser must be on START_TAG to read next text", this, null);
         }
@@ -1070,7 +894,6 @@ public class MXParser implements XmlPullParser {
             return eventType = END_TAG;
         }
 
-        // [1] document ::= prolog element Misc*
         if (depth > 0) {
 
             if (seenStartTag) {
@@ -1082,9 +905,6 @@ public class MXParser implements XmlPullParser {
                 return eventType = parseEndTag();
             }
 
-            // ASSUMPTION: we are _on_ first character of content or markup!!!!
-            // [43] content ::= CharData? ((element | Reference | CDSect | PI |
-            // Comment) CharData?)*
             char ch;
             if (seenMarkup) { // we have read ahead ...
                 seenMarkup = false;
@@ -1095,22 +915,15 @@ public class MXParser implements XmlPullParser {
             } else {
                 ch = more();
             }
-            posStart = pos - 1; // VERY IMPORTANT: this is correct start of
-                               // event!!!
+            posStart = pos - 1;
 
-            // when true there is some potential event TEXT to return - keep
-            // gathering
             boolean hadCharData = false;
 
-            // when true TEXT data is not continual (like <![CDATA[text]]>) and
-            // requires PC merging
             boolean needsMerging = false;
 
             MAIN_LOOP: while (true) {
-                // work on MARKUP
                 if (ch == '<') {
                     if (hadCharData) {
-                        // posEnd = pos - 1;
                         if (tokenize) {
                             seenMarkup = true;
                             return eventType = TEXT;
@@ -1120,15 +933,12 @@ public class MXParser implements XmlPullParser {
                     if (ch == '/') {
                         if (!tokenize && hadCharData) {
                             seenEndTag = true;
-                            // posEnd = pos - 2;
                             return eventType = TEXT;
                         }
                         return eventType = parseEndTag();
                     } else if (ch == '!') {
                         ch = more();
                         if (ch == '-') {
-                            // note: if(tokenize == false) posStart/End is NOT
-                            // changed!!!!
                             parseComment();
                             if (tokenize)
                                 return eventType = COMMENT;
@@ -1138,11 +948,6 @@ public class MXParser implements XmlPullParser {
                                 posStart = pos; // completely ignore comment
                             }
                         } else if (ch == '[') {
-                            // posEnd = pos - 3;
-                            // must remember previous posStart/End as it merges
-                            // with content of CDATA
-                            // int oldStart = posStart + bufAbsoluteStart;
-                            // int oldEnd = posEnd + bufAbsoluteStart;
                             parseCDSect(hadCharData);
                             if (tokenize)
                                 return eventType = CDSECT;
@@ -1150,54 +955,12 @@ public class MXParser implements XmlPullParser {
                             final int cdEnd = posEnd;
                             final int cdLen = cdEnd - cdStart;
 
-                            if (cdLen > 0) { // was there anything inside CDATA
-                                            // section?
+                            if (cdLen > 0) {
                                 hadCharData = true;
                                 if (!usePC) {
                                     needsMerging = true;
                                 }
                             }
-
-                            // posStart = oldStart;
-                            // posEnd = oldEnd;
-                            // if(cdLen > 0) { // was there anything inside
-                            // CDATA section?
-                            // if(hadCharData) {
-                            // // do merging if there was anything in CDSect!!!!
-                            // // if(!usePC) {
-                            // // // posEnd is correct already!!!
-                            // // if(posEnd > posStart) {
-                            // // joinPC();
-                            // // } else {
-                            // // usePC = true;
-                            // // pcStart = pcEnd = 0;
-                            // // }
-                            // // }
-                            // // if(pcEnd + cdLen >= pc.length) ensurePC(pcEnd
-                            // + cdLen);
-                            // // // copy [cdStart..cdEnd) into PC
-                            // // System.arraycopy(buf, cdStart, pc, pcEnd,
-                            // cdLen);
-                            // // pcEnd += cdLen;
-                            // if(!usePC) {
-                            // needsMerging = true;
-                            // posStart = cdStart;
-                            // posEnd = cdEnd;
-                            // }
-                            // } else {
-                            // if(!usePC) {
-                            // needsMerging = true;
-                            // posStart = cdStart;
-                            // posEnd = cdEnd;
-                            // hadCharData = true;
-                            // }
-                            // }
-                            // //hadCharData = true;
-                            // } else {
-                            // if( !usePC && hadCharData ) {
-                            // needsMerging = true;
-                            // }
-                            // }
                         } else {
                             throw new XmlPullParserException("unexpected character in markup " + printable(ch), this, null);
                         }
@@ -1214,18 +977,13 @@ public class MXParser implements XmlPullParser {
                     } else if (isNameStartChar(ch)) {
                         if (!tokenize && hadCharData) {
                             seenStartTag = true;
-                            // posEnd = pos - 2;
                             return eventType = TEXT;
                         }
                         return eventType = parseStartTag();
                     } else {
                         throw new XmlPullParserException("unexpected character in markup " + printable(ch), this, null);
                     }
-                    // do content compaction if it makes sense!!!!
-
                 } else if (ch == '&') {
-                    // work on ENTITTY
-                    // posEnd = pos - 1;
                     if (tokenize && hadCharData) {
                         seenAmpersand = true;
                         return eventType = TEXT;
@@ -1235,7 +993,6 @@ public class MXParser implements XmlPullParser {
                     final char[] resolvedEntity = parseEntityRef();
                     if (tokenize)
                         return eventType = ENTITY_REF;
-                    // check if replacement text can be resolved !!!
                     if (resolvedEntity == null) {
                         if (entityRefName == null) {
                             entityRefName = newString(buf, posStart, posEnd - posStart);
@@ -1243,8 +1000,6 @@ public class MXParser implements XmlPullParser {
                         throw new XmlPullParserException(
                                 "could not resolve entity named '" + printable(entityRefName) + "'", this, null);
                     }
-                    // int entStart = posStart;
-                    // int entEnd = posEnd;
                     posStart = oldStart - bufAbsoluteStart;
                     posEnd = oldEnd - bufAbsoluteStart;
                     if (!usePC) {
@@ -1256,9 +1011,6 @@ public class MXParser implements XmlPullParser {
                             pcStart = pcEnd = 0;
                         }
                     }
-                    // assert usePC == true;
-                    // write into PC replacement text - do merge for replacement
-                    // text!!!!
                     for (int i = 0; i < resolvedEntity.length; i++) {
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
@@ -1266,30 +1018,21 @@ public class MXParser implements XmlPullParser {
 
                     }
                     hadCharData = true;
-                    // assert needsMerging == false;
                 } else {
 
                     if (needsMerging) {
-                        // assert usePC == false;
-                        joinPC(); // posEnd is already set correctly!!!
-                        // posStart = pos - 1;
+                        joinPC();
                         needsMerging = false;
                     }
 
-                    // no MARKUP not ENTITIES so work on character data ...
-
-                    // [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
-
                     hadCharData = true;
 
                     boolean normalizedCR = false;
                     final boolean normalizeInput = !tokenize || !roundtripSupported;
-                    // use loop locality here!!!!
                     boolean seenBracket = false;
                     boolean seenBracketBracket = false;
                     do {
 
-                        // check that ]]> does not show in
                         if (ch == ']') {
                             if (seenBracket) {
                                 seenBracketBracket = true;
@@ -1302,14 +1045,11 @@ public class MXParser implements XmlPullParser {
                             if (seenBracket) {
                                 seenBracketBracket = seenBracket = false;
                             }
-                            // assert seenTwoBrackets == seenBracket == false;
                         }
                         if (normalizeInput) {
-                            // deal with normalization issues ...
                             if (ch == '\r') {
                                 normalizedCR = true;
                                 posEnd = pos - 1;
-                                // posEnd is already is set
                                 if (!usePC) {
                                     if (posEnd > posStart) {
                                         joinPC();
@@ -1318,13 +1058,10 @@ public class MXParser implements XmlPullParser {
                                         pcStart = pcEnd = 0;
                                     }
                                 }
-                                // assert usePC == true;
                                 if (pcEnd >= pc.length)
                                     ensurePC(pcEnd);
                                 pc[pcEnd++] = '\n';
                             } else if (ch == '\n') {
-                                // if(!usePC) { joinPC(); } else { if(pcEnd >=
-                                // pc.length) ensurePC(); }
                                 if (!normalizedCR && usePC) {
                                     if (pcEnd >= pc.length)
                                         ensurePC(pcEnd);
@@ -1344,11 +1081,10 @@ public class MXParser implements XmlPullParser {
                         ch = more();
                     } while (ch != '<' && ch != '&');
                     posEnd = pos - 1;
-                    continue MAIN_LOOP; // skip ch = more() from below - we are
-                                       // alreayd ahead ...
+                    continue MAIN_LOOP;
                 }
                 ch = more();
-            } // endless while(true)
+            }
         } else {
             if (seenRoot) {
                 return parseEpilog();
@@ -1359,9 +1095,6 @@ public class MXParser implements XmlPullParser {
     }
 
     protected int parseProlog() throws XmlPullParserException, IOException {
-        // [2] prolog: ::= XMLDecl? Misc* (doctypedecl Misc*)? and look for [39]
-        // element
-
         char ch;
         if (seenMarkup) {
             ch = buf[pos - 1];
@@ -1370,16 +1103,12 @@ public class MXParser implements XmlPullParser {
         }
 
         if (eventType == START_DOCUMENT) {
-            // bootstrap parsing with getting first character input!
-            // deal with BOM
-            // detect BOM and drop it (Unicode int Order Mark)
             if (ch == '\uFFFE') {
                 throw new XmlPullParserException(
                         "first character in input was UNICODE noncharacter (0xFFFE)" + "- input requires int swapping", this,
                         null);
             }
             if (ch == '\uFEFF') {
-                // skipping UNICODE int Order Mark (so called BOM)
                 ch = more();
             }
         }
@@ -1389,10 +1118,6 @@ public class MXParser implements XmlPullParser {
         final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
         while (true) {
-            // deal with Misc
-            // [27] Misc ::= Comment | PI | S
-            // deal with docdecl --> mark it!
-            // else parseStartTag seen <[^/]
             if (ch == '<') {
                 if (gotS && tokenize) {
                     posEnd = pos - 1;
@@ -1401,14 +1126,11 @@ public class MXParser implements XmlPullParser {
                 }
                 ch = more();
                 if (ch == '?') {
-                    // check if it is 'xml'
-                    // deal with XMLDecl
-                    if (parsePI()) { // make sure to skip XMLDecl
+                    if (parsePI()) {
                         if (tokenize) {
                             return eventType = PROCESSING_INSTRUCTION;
                         }
                     } else {
-                        // skip over - continue tokenizing
                         posStart = pos;
                         gotS = false;
                     }
@@ -1443,9 +1165,6 @@ public class MXParser implements XmlPullParser {
                 if (normalizeIgnorableWS) {
                     if (ch == '\r') {
                         normalizedCR = true;
-                        // posEnd = pos -1;
-                        // joinPC();
-                        // posEnd is already is set
                         if (!usePC) {
                             posEnd = pos - 1;
                             if (posEnd > posStart) {
@@ -1455,7 +1174,6 @@ public class MXParser implements XmlPullParser {
                                 pcStart = pcEnd = 0;
                             }
                         }
-                        // assert usePC == true;
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
                         pc[pcEnd++] = '\n';
@@ -1494,7 +1212,6 @@ public class MXParser implements XmlPullParser {
         final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
         try {
-            // epilog: Misc*
             char ch;
             if (seenMarkup) {
                 ch = buf[pos - 1];
@@ -1505,8 +1222,6 @@ public class MXParser implements XmlPullParser {
             posStart = pos - 1;
             if (!reachedEnd) {
                 while (true) {
-                    // deal with Misc
-                    // [27] Misc ::= Comment | PI | S
                     if (ch == '<') {
                         if (gotS && tokenize) {
                             posEnd = pos - 1;
@@ -1518,8 +1233,6 @@ public class MXParser implements XmlPullParser {
                             break;
                         }
                         if (ch == '?') {
-                            // check if it is 'xml'
-                            // deal with XMLDecl
                             parsePI();
                             if (tokenize)
                                 return eventType = PROCESSING_INSTRUCTION;
@@ -1555,9 +1268,6 @@ public class MXParser implements XmlPullParser {
                         if (normalizeIgnorableWS) {
                             if (ch == '\r') {
                                 normalizedCR = true;
-                                // posEnd = pos -1;
-                                // joinPC();
-                                // posEnd is alreadys set
                                 if (!usePC) {
                                     posEnd = pos - 1;
                                     if (posEnd > posStart) {
@@ -1567,7 +1277,6 @@ public class MXParser implements XmlPullParser {
                                         pcStart = pcEnd = 0;
                                     }
                                 }
-                                // assert usePC == true;
                                 if (pcEnd >= pc.length)
                                     ensurePC(pcEnd);
                                 pc[pcEnd++] = '\n';
@@ -1599,9 +1308,6 @@ public class MXParser implements XmlPullParser {
                 }
             }
 
-            // throw Exception("unexpected content in epilog
-            // catch EOFException return END_DOCUEMENT
-            // try {
         } catch (EOFException ex) {
             reachedEnd = true;
         }
@@ -1613,8 +1319,6 @@ public class MXParser implements XmlPullParser {
     }
 
     public int parseEndTag() throws XmlPullParserException, IOException {
-        // ASSUMPTION ch is past "</"
-        // [42] ETag ::= '</' Name S? '>'
         char ch = more();
         if (!isNameStartChar(ch)) {
             throw new XmlPullParserException("expected name start and not " + printable(ch), this, null);
@@ -1625,19 +1329,10 @@ public class MXParser implements XmlPullParser {
             ch = more();
         } while (isNameChar(ch));
 
-        // now we go one level down -- do checks
-        // --depth; //FIXME
-
-        // check that end tag name is the same as start tag
-        // String name = new String(buf, nameStart - bufAbsoluteStart,
-        // (pos - 1) - (nameStart - bufAbsoluteStart));
-        // int last = pos - 1;
         int off = nameStart - bufAbsoluteStart;
-        // final int len = last - off;
         final int len = (pos - 1) - off;
         final char[] cbuf = elRawName[depth];
         if (elRawNameEnd[depth] != len) {
-            // construct strings for exception
             final String startname = new String(cbuf, 0, elRawNameEnd[depth]);
             final String endname = new String(buf, off, len);
             throw new XmlPullParserException(
@@ -1647,7 +1342,6 @@ public class MXParser implements XmlPullParser {
         }
         for (int i = 0; i < len; i++) {
             if (buf[off++] != cbuf[i]) {
-                // construct strings for exception
                 final String startname = new String(cbuf, 0, len);
                 final String endname = new String(buf, off - i - 1, len);
                 throw new XmlPullParserException(
@@ -1666,27 +1360,20 @@ public class MXParser implements XmlPullParser {
                     "expected > to finish end tag not " + printable(ch) + " from line " + elRawNameLine[depth], this, null);
         }
 
-        // namespaceEnd = elNamespaceCount[ depth ]; //FIXME
-
         posEnd = pos;
         pastEndTag = true;
         return eventType = END_TAG;
     }
 
     public int parseStartTag() throws XmlPullParserException, IOException {
-        // remember starting line number
         startLineNumber = lineNumber;
 
-        // ASSUMPTION ch is past <T
-        // [40] STag ::= '<' Name (S Attribute)* S? '>'
-        // [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
         ++depth; // FIXME
 
         posStart = pos - 2;
 
         emptyElementTag = false;
         attributeCount = 0;
-        // retrieve name
         final int nameStart = pos - 1 + bufAbsoluteStart;
         int colonPos = -1;
         char ch = buf[pos - 1];
@@ -1705,11 +1392,8 @@ public class MXParser implements XmlPullParser {
             }
         }
 
-        // retrieve name
         ensureElementsCapacity();
 
-        // TODO check for efficient interning and then use elRawNameInterned!!!!
-
         int elLen = (pos - 1) - (nameStart - bufAbsoluteStart);
         if (elRawName[depth] == null || elRawName[depth].length < elLen) {
             elRawName[depth] = new char[2 * elLen];
@@ -1718,13 +1402,11 @@ public class MXParser implements XmlPullParser {
         elRawNameEnd[depth] = elLen;
         elRawNameLine[depth] = lineNumber;
 
-        // work on prefixes and namespace URI
         String prefix = null;
         if (processNamespaces) {
             if (colonPos != -1) {
                 prefix = elPrefix[depth] = newString(buf, nameStart - bufAbsoluteStart, colonPos - nameStart);
                 elName[depth] = newString(buf, colonPos + 1 - bufAbsoluteStart,
-                        // (pos -1) - (colonPos + 1));
                         pos - 2 - (colonPos - bufAbsoluteStart));
             } else {
                 elPrefix[depth] = null;
@@ -1757,10 +1439,8 @@ public class MXParser implements XmlPullParser {
             } else {
                 throw new XmlPullParserException("start tag unexpected character " + printable(ch), this, null);
             }
-            // ch = more(); // skip space
         }
 
-        // now when namespaces were declared we can resolve them
         if (processNamespaces) {
             String uri = getNamespace(prefix);
             if (uri == null) {
@@ -1775,12 +1455,6 @@ public class MXParser implements XmlPullParser {
             }
             elUri[depth] = uri;
 
-            // String uri = getNamespace(prefix);
-            // if(uri == null && prefix == null) { // no prefix and no uri =>
-            // use default namespace
-            // uri = "";
-            // }
-            // resolve attribute namespaces
             for (int i = 0; i < attributeCount; i++) {
                 final String attrPrefix = attributePrefix[i];
                 if (attrPrefix != null) {
@@ -1796,11 +1470,6 @@ public class MXParser implements XmlPullParser {
                 }
             }
 
-            // TODO
-            // [ WFC: Unique Att Spec ]
-            // check attribute uniqueness constraint for attributes that has
-            // namespace!!!
-
             for (int i = 1; i < attributeCount; i++) {
                 for (int j = 0; j < i; j++) {
                     if (attributeUri[j] == attributeUri[i]
@@ -1809,7 +1478,6 @@ public class MXParser implements XmlPullParser {
                                             && attributeName[j].equals(attributeName[i])))
 
                     ) {
-                        // prepare data for nice error message?
                         String attr1 = attributeName[j];
                         if (attributeUri[j] != null)
                             attr1 = attributeUri[j] + ":" + attr1;
@@ -1823,8 +1491,6 @@ public class MXParser implements XmlPullParser {
 
         } else { // ! processNamespaces
 
-            // [ WFC: Unique Att Spec ]
-            // check raw attribute uniqueness constraint!!!
             for (int i = 1; i < attributeCount; i++) {
                 for (int j = 0; j < i; j++) {
                     if ((allStringsInterned && attributeName[j].equals(attributeName[i])
@@ -1832,7 +1498,6 @@ public class MXParser implements XmlPullParser {
                                     && attributeName[j].equals(attributeName[i])))
 
                     ) {
-                        // prepare data for nice error message?
                         final String attr1 = attributeName[j];
                         final String attr2 = attributeName[i];
                         throw new XmlPullParserException("duplicated attributes " + attr1 + " and " + attr2, this, null);
@@ -1847,10 +1512,6 @@ public class MXParser implements XmlPullParser {
     }
 
     protected char parseAttribute() throws XmlPullParserException, IOException {
-        // parse attribute
-        // [41] Attribute ::= Name Eq AttValue
-        // [WFC: No External Entity References]
-        // [WFC: No < in Attribute Values]
         final int prevPosStart = posStart + bufAbsoluteStart;
         final int nameStart = pos - 1 + bufAbsoluteStart;
         int colonPos = -1;
@@ -1883,7 +1544,6 @@ public class MXParser implements XmlPullParser {
                         if (ch != ':')
                             throw new XmlPullParserException(
                                     "after xmlns in attribute name must be colon" + " when namespaces are enabled", this, null);
-                        // colonPos = pos - 1 + bufAbsoluteStart;
                     }
                 }
                 if (ch == ':') {
@@ -1898,35 +1558,26 @@ public class MXParser implements XmlPullParser {
 
         ensureAttributesCapacity(attributeCount);
 
-        // --- start processing attributes
         String name = null;
         String prefix = null;
-        // work on prefixes and namespace URI
         if (processNamespaces) {
             if (xmlnsPos < 4)
                 startsWithXmlns = false;
             if (startsWithXmlns) {
                 if (colonPos != -1) {
-                    // prefix = attributePrefix[ attributeCount ] = null;
                     final int nameLen = pos - 2 - (colonPos - bufAbsoluteStart);
                     if (nameLen == 0) {
                         throw new XmlPullParserException(
                                 "namespace prefix is required after xmlns: " + " when namespaces are enabled", this, null);
                     }
-                    name = // attributeName[ attributeCount ] =
-                            newString(buf, colonPos - bufAbsoluteStart + 1, nameLen);
-                    // pos - 1 - (colonPos + 1 - bufAbsoluteStart)
+                    name = newString(buf, colonPos - bufAbsoluteStart + 1, nameLen);
                 }
             } else {
                 if (colonPos != -1) {
                     int prefixLen = colonPos - nameStart;
                     prefix = attributePrefix[attributeCount] = newString(buf, nameStart - bufAbsoluteStart, prefixLen);
-                    // colonPos - (nameStart - bufAbsoluteStart));
                     int nameLen = pos - 2 - (colonPos - bufAbsoluteStart);
                     name = attributeName[attributeCount] = newString(buf, colonPos - bufAbsoluteStart + 1, nameLen);
-                    // pos - 1 - (colonPos + 1 - bufAbsoluteStart));
-
-                    // name.substring(0, colonPos-nameStart);
                 } else {
                     prefix = attributePrefix[attributeCount] = null;
                     name = attributeName[attributeCount]
@@ -1938,35 +1589,27 @@ public class MXParser implements XmlPullParser {
             }
 
         } else {
-            // retrieve name
             name = attributeName[attributeCount]
                     = newString(buf, nameStart - bufAbsoluteStart, pos - 1 - (nameStart - bufAbsoluteStart));
-            //// assert name != null;
             if (!allStringsInterned) {
                 attributeNameHash[attributeCount] = name.hashCode();
             }
         }
 
-        // [25] Eq ::= S? '=' S?
         while (isS(ch)) {
             ch = more();
-        } // skip additional spaces
+        }
         if (ch != '=')
             throw new XmlPullParserException("expected = after attribute name", this, null);
         ch = more();
         while (isS(ch)) {
             ch = more();
-        } // skip additional spaces
+        }
 
-        // [10] AttValue ::= '"' ([^<&"] | Reference)* '"'
-        // | "'" ([^<&'] | Reference)* "'"
         final char delimit = ch;
         if (delimit != '"' && delimit != '\'')
             throw new XmlPullParserException(
                     "attribute value must start with quotation or apostrophe not " + printable(delimit), this, null);
-        // parse until delimit or < and resolve Reference
-        // [67] Reference ::= EntityRef | CharRef
-        // int valueStart = pos + bufAbsoluteStart;
 
         boolean normalizedCR = false;
         usePC = false;
@@ -1982,22 +1625,18 @@ public class MXParser implements XmlPullParser {
                 throw new XmlPullParserException("markup not allowed inside attribute value - illegal < ", this, null);
             }
             if (ch == '&') {
-                // extractEntityRef
                 posEnd = pos - 1;
                 if (!usePC) {
                     final boolean hadCharData = posEnd > posStart;
                     if (hadCharData) {
-                        // posEnd is already set correctly!!!
                         joinPC();
                     } else {
                         usePC = true;
                         pcStart = pcEnd = 0;
                     }
                 }
-                // assert usePC == true;
 
                 final char[] resolvedEntity = parseEntityRef();
-                // check if replacement text can be resolved !!!
                 if (resolvedEntity == null) {
                     if (entityRefName == null) {
                         entityRefName = newString(buf, posStart, posEnd - posStart);
@@ -2005,18 +1644,12 @@ public class MXParser implements XmlPullParser {
                     throw new XmlPullParserException(
                             "could not resolve entity named '" + printable(entityRefName) + "'", this, null);
                 }
-                // write into PC replacement text - do merge for replacement
-                // text!!!!
                 for (int i = 0; i < resolvedEntity.length; i++) {
                     if (pcEnd >= pc.length)
                         ensurePC(pcEnd);
                     pc[pcEnd++] = resolvedEntity[i];
                 }
             } else if (ch == '\t' || ch == '\n' || ch == '\r') {
-                // do attribute value normalization
-                // as described in http://www.w3.org/TR/REC-xml#AVNormalize
-                // TODO add test for it form spec ...
-                // handle EOL normalization ...
                 if (!usePC) {
                     posEnd = pos - 1;
                     if (posEnd > posStart) {
@@ -2026,7 +1659,6 @@ public class MXParser implements XmlPullParser {
                         pcEnd = pcStart = 0;
                     }
                 }
-                // assert usePC == true;
                 if (pcEnd >= pc.length)
                     ensurePC(pcEnd);
                 if (ch != '\n' || !normalizedCR) {
@@ -2057,22 +1689,18 @@ public class MXParser implements XmlPullParser {
                     throw new XmlPullParserException(
                             "non-default namespace can not be declared to be empty string", this, null);
                 }
-                // declare new namespace
                 namespacePrefix[namespaceEnd] = name;
                 if (!allStringsInterned) {
                     prefixHash = namespacePrefixHash[namespaceEnd] = name.hashCode();
                 }
             } else {
-                // declare new default namespace ...
-                namespacePrefix[namespaceEnd] = null; // ""; //null; //TODO
-                                                     // check FIXME Alek
+                namespacePrefix[namespaceEnd] = null;
                 if (!allStringsInterned) {
                     prefixHash = namespacePrefixHash[namespaceEnd] = -1;
                 }
             }
             namespaceUri[namespaceEnd] = ns;
 
-            // detect duplicate namespace declarations!!!
             final int startNs = elNamespaceCount[depth - 1];
             for (int i = namespaceEnd - 1; i >= startNs; --i) {
                 if (((allStringsInterned || name == null) && namespacePrefix[i] == name)
@@ -2100,20 +1728,13 @@ public class MXParser implements XmlPullParser {
     protected char[] charRefOneCharBuf = new char[1];
 
     protected char[] parseEntityRef() throws XmlPullParserException, IOException {
-        // entity reference
-        // http://www.w3.org/TR/2000/REC-xml-20001006#NT-Reference
-        // [67] Reference ::= EntityRef | CharRef
-
-        // ASSUMPTION just after &
         entityRefName = null;
         posStart = pos;
         char ch = more();
         if (ch == '#') {
-            // parse character reference
             char charRef = 0;
             ch = more();
             if (ch == 'x') {
-                // encoded in hex
                 while (true) {
                     ch = more();
                     if (ch >= '0' && ch <= '9') {
@@ -2130,7 +1751,6 @@ public class MXParser implements XmlPullParser {
                     }
                 }
             } else {
-                // encoded in decimal
                 while (true) {
                     if (ch >= '0' && ch <= '9') {
                         charRef = (char) (charRef * 10 + (ch - '0'));
@@ -2150,8 +1770,6 @@ public class MXParser implements XmlPullParser {
             }
             return charRefOneCharBuf;
         } else {
-            // [68] EntityRef ::= '&' Name ';'
-            // scan name until ;
             if (!isNameStartChar(ch)) {
                 throw new XmlPullParserException(
                         "entity reference names can not start with character '" + printable(ch) + "'", this, null);
@@ -2167,7 +1785,6 @@ public class MXParser implements XmlPullParser {
                 }
             }
             posEnd = pos - 1;
-            // determine what name maps to
             final int len = posEnd - posStart;
             if (len == 2 && buf[posStart] == 'l' && buf[posStart + 1] == 't') {
                 if (tokenize) {
@@ -2175,10 +1792,6 @@ public class MXParser implements XmlPullParser {
                 }
                 charRefOneCharBuf[0] = '<';
                 return charRefOneCharBuf;
-                // if(paramPC || isParserTokenizing) {
-                // if(pcEnd >= pc.length) ensurePC();
-                // pc[pcEnd++] = '<';
-                // }
             } else if (len == 3 && buf[posStart] == 'a' && buf[posStart + 1] == 'm' && buf[posStart + 2] == 'p') {
                 if (tokenize) {
                     text = "&";
@@ -2235,7 +1848,6 @@ public class MXParser implements XmlPullParser {
         } else {
             entityRefName = newString(buf, posStart, posEnd - posStart);
             for (int i = entityEnd - 1; i >= 0; --i) {
-                // take advantage that interning for newStirng is enforced
                 if (entityRefName == entityName[i]) {
                     if (tokenize)
                         text = entityReplacement[i];
@@ -2247,9 +1859,6 @@ public class MXParser implements XmlPullParser {
     }
 
     protected void parseComment() throws XmlPullParserException, IOException {
-        // implements XML 1.0 Section 2.5 Comments
-
-        // ASSUMPTION: seen <!-
         char ch = more();
         if (ch != '-')
             throw new XmlPullParserException("expected <!-- for comment start", this, null);
@@ -2265,7 +1874,6 @@ public class MXParser implements XmlPullParser {
             boolean seenDash = false;
             boolean seenDashDash = false;
             while (true) {
-                // scan until it hits -->
                 ch = more();
                 if (seenDashDash && ch != '>') {
                     throw new XmlPullParserException(
@@ -2291,9 +1899,6 @@ public class MXParser implements XmlPullParser {
                 if (normalizeIgnorableWS) {
                     if (ch == '\r') {
                         normalizedCR = true;
-                        // posEnd = pos -1;
-                        // joinPC();
-                        // posEnd is already set
                         if (!usePC) {
                             posEnd = pos - 1;
                             if (posEnd > posStart) {
@@ -2303,7 +1908,6 @@ public class MXParser implements XmlPullParser {
                                 pcStart = pcEnd = 0;
                             }
                         }
-                        // assert usePC == true;
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
                         pc[pcEnd++] = '\n';
@@ -2326,7 +1930,6 @@ public class MXParser implements XmlPullParser {
             }
 
         } catch (EOFException ex) {
-            // detect EOF and create meaningful error ...
             throw new XmlPullParserException(
                     "comment started on line " + curLine + " and column " + curColumn + " was not closed", this, ex);
         }
@@ -2339,11 +1942,6 @@ public class MXParser implements XmlPullParser {
     }
 
     protected boolean parsePI() throws XmlPullParserException, IOException {
-        // implements XML 1.0 Section 2.6 Processing Instructions
-
-        // [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
-        // [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
-        // ASSUMPTION: seen <?
         if (tokenize)
             posStart = pos;
         final int curLine = lineNumber;
@@ -2361,9 +1959,6 @@ public class MXParser implements XmlPullParser {
                         "processing instruction PITarget must be exactly after <? and not white space character", this, null);
             }
             while (true) {
-                // scan until it hits ?>
-                // ch = more();
-
                 if (ch == '?') {
                     seenQ = true;
                 } else if (ch == '>') {
@@ -2375,15 +1970,11 @@ public class MXParser implements XmlPullParser {
                     if (piTargetEnd == -1 && isS(ch)) {
                         piTargetEnd = pos - 1 + bufAbsoluteStart;
 
-                        // [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm')
-                        // ('L' | 'l'))
                         if ((piTargetEnd - piTargetStart) == 3) {
                             if ((buf[piTargetStart] == 'x' || buf[piTargetStart] == 'X')
                                     && (buf[piTargetStart + 1] == 'm' || buf[piTargetStart + 1] == 'M')
                                     && (buf[piTargetStart + 2] == 'l' || buf[piTargetStart + 2] == 'L')) {
-                                if (piTargetStart > 3) { // <?xml is allowed as
-                                                        // first characters in
-                                                        // input ...
+                                if (piTargetStart > 3) {
                                     throw new XmlPullParserException(
                                             "processing instruction can not have PITarget with reserveld xml name", this, null);
                                 } else {
@@ -2407,9 +1998,6 @@ public class MXParser implements XmlPullParser {
                 if (normalizeIgnorableWS) {
                     if (ch == '\r') {
                         normalizedCR = true;
-                        // posEnd = pos -1;
-                        // joinPC();
-                        // posEnd is already set
                         if (!usePC) {
                             posEnd = pos - 1;
                             if (posEnd > posStart) {
@@ -2419,7 +2007,6 @@ public class MXParser implements XmlPullParser {
                                 pcStart = pcEnd = 0;
                             }
                         }
-                        // assert usePC == true;
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
                         pc[pcEnd++] = '\n';
@@ -2442,15 +2029,12 @@ public class MXParser implements XmlPullParser {
                 ch = more();
             }
         } catch (EOFException ex) {
-            // detect EOF and create meaningful error ...
             throw new XmlPullParserException(
                     "processing instruction started on line " + curLine + " and column " + curColumn + " was not closed", this,
                     ex);
         }
         if (piTargetEnd == -1) {
             piTargetEnd = pos - 2 + bufAbsoluteStart;
-            // throw new XmlPullParserException(
-            // "processing instruction must have PITarget name", this, null);
         }
         piTargetStart -= bufAbsoluteStart;
         piTargetEnd -= bufAbsoluteStart;
@@ -2463,13 +2047,6 @@ public class MXParser implements XmlPullParser {
         return true;
     }
 
-    // protected final static char[] VERSION = {'v','e','r','s','i','o','n'};
-    // protected final static char[] NCODING = {'n','c','o','d','i','n','g'};
-    // protected final static char[] TANDALONE =
-    // {'t','a','n','d','a','l','o','n','e'};
-    // protected final static char[] YES = {'y','e','s'};
-    // protected final static char[] NO = {'n','o'};
-
     protected static final char[] VERSION = "version".toCharArray();
     protected static final char[] NCODING = "ncoding".toCharArray();
     protected static final char[] TANDALONE = "tandalone".toCharArray();
@@ -2477,20 +2054,11 @@ public class MXParser implements XmlPullParser {
     protected static final char[] NO = "no".toCharArray();
 
     protected void parseXmlDecl(char ch) throws XmlPullParserException, IOException {
-        // [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
-
-        // first make sure that relative positions will stay OK
         preventBufferCompaction = true;
-        bufStart = 0; // necessary to keep pos unchanged during expansion!
-
-        // --- parse VersionInfo
+        bufStart = 0;
 
-        // [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"'
-        // VersionNum '"')
-        // parse is positioned just on first S past <?xml
         ch = skipS(ch);
         ch = requireInput(ch, VERSION);
-        // [25] Eq ::= S? '=' S?
         ch = skipS(ch);
         if (ch != '=') {
             throw new XmlPullParserException("expected equals sign (=) after version and not " + printable(ch), this, null);
@@ -2502,11 +2070,8 @@ public class MXParser implements XmlPullParser {
                     "expected apostrophe (') or quotation mark (\") after version and not " + printable(ch), this, null);
         }
         final char quotChar = ch;
-        // int versionStart = pos + bufAbsoluteStart; // required if
-        // preventBufferCompaction==false
         final int versionStart = pos;
         ch = more();
-        // [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+
         while (ch != quotChar) {
             if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') && (ch < '0' || ch > '9') && ch != '_' && ch != '.'
                     && ch != ':' && ch != '-') {
@@ -2517,13 +2082,10 @@ public class MXParser implements XmlPullParser {
         }
         final int versionEnd = pos - 1;
         parseXmlDeclWithVersion(versionStart, versionEnd);
-        preventBufferCompaction = false; // alow again buffer commpaction - pos
-                                        // MAY chnage
+        preventBufferCompaction = false;
     }
-    // protected String xmlDeclVersion;
 
     protected void parseXmlDeclWithVersion(int versionStart, int versionEnd) throws XmlPullParserException, IOException {
-        // check version is "1.0"
         if ((versionEnd - versionStart != 3) || buf[versionStart] != '1' || buf[versionStart + 1] != '.'
                 || buf[versionStart + 2] != '0') {
             throw new XmlPullParserException(
@@ -2534,8 +2096,6 @@ public class MXParser implements XmlPullParser {
         }
         xmlDeclVersion = newString(buf, versionStart, versionEnd - versionStart);
 
-        // [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName
-        // "'" )
         char ch = more();
         ch = skipS(ch);
         if (ch == 'e') {
@@ -2555,7 +2115,6 @@ public class MXParser implements XmlPullParser {
             final char quotChar = ch;
             final int encodingStart = pos;
             ch = more();
-            // [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
             if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z')) {
                 throw new XmlPullParserException(
                         "<?xml encoding name expected to start with [A-Za-z]" + " not " + printable(ch), this, null);
@@ -2572,14 +2131,11 @@ public class MXParser implements XmlPullParser {
             }
             final int encodingEnd = pos - 1;
 
-            // TODO reconcile with setInput encodingName
             inputEncoding = newString(buf, encodingStart, encodingEnd - encodingStart);
             ch = more();
         }
 
         ch = skipS(ch);
-        // [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"'
-        // ('yes' | 'no') '"'))
         if (ch == 's') {
             ch = more();
             ch = requireInput(ch, TANDALONE);
@@ -2599,11 +2155,9 @@ public class MXParser implements XmlPullParser {
             ch = more();
             if (ch == 'y') {
                 ch = requireInput(ch, YES);
-                // Boolean standalone = new Boolean(true);
                 xmlDeclStandalone = Boolean.TRUE;
             } else if (ch == 'n') {
                 ch = requireInput(ch, NO);
-                // Boolean standalone = new Boolean(false);
                 xmlDeclStandalone = Boolean.FALSE;
             } else {
                 throw new XmlPullParserException(
@@ -2624,29 +2178,9 @@ public class MXParser implements XmlPullParser {
         if (ch != '>') {
             throw new XmlPullParserException("expected ?> as last part of <?xml not " + printable(ch), this, null);
         }
-
-        // NOTE: this code is broken as for some types of input streams (URLConnection ...)
-        // it is not possible to do more than once new InputStreamReader(inputStream)
-        // as it somehow detects it and closes undelrying inout stram (b.....d!)
-        // In future one will need better low level byte-by-byte reading of prolog and then doing InputStream ...
-        // for more details see http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=135
-        // //reset input stream
-        //        if ((this.inputEncoding != oldEncoding) && (this.inputStream != null)) {
-        //            if ((this.inputEncoding != null) && (!this.inputEncoding.equalsIgnoreCase(oldEncoding))) {
-        //                //              //there is need to reparse input to set location OK
-        //                //              reset();
-        //                this.reader = new InputStreamReader(this.inputStream, this.inputEncoding);
-        //                //              //skip <?xml
-        //                //              for (int i = 0; i < 5; i++){
-        //                //                  ch=more();
-        //                //              }
-        //                //              parseXmlDecl(ch);
-        //            }
-        //        }
     }
 
     protected void parseDocdecl() throws XmlPullParserException, IOException {
-        // ASSUMPTION: seen <!D
         char ch = more();
         if (ch != 'O')
             throw new XmlPullParserException("expected <!DOCTYPE", this, null);
@@ -2666,10 +2200,7 @@ public class MXParser implements XmlPullParser {
         if (ch != 'E')
             throw new XmlPullParserException("expected <!DOCTYPE", this, null);
         posStart = pos;
-        // do simple and crude scanning for end of doctype
 
-        // [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('['
-        // (markupdecl | DeclSep)* ']' S?)? '>'
         int bracketLevel = 0;
         final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
@@ -2684,9 +2215,6 @@ public class MXParser implements XmlPullParser {
             if (normalizeIgnorableWS) {
                 if (ch == '\r') {
                     normalizedCR = true;
-                    // posEnd = pos -1;
-                    // joinPC();
-                    // posEnd is alreadys set
                     if (!usePC) {
                         posEnd = pos - 1;
                         if (posEnd > posStart) {
@@ -2696,7 +2224,6 @@ public class MXParser implements XmlPullParser {
                             pcStart = pcEnd = 0;
                         }
                     }
-                    // assert usePC == true;
                     if (pcEnd >= pc.length)
                         ensurePC(pcEnd);
                     pc[pcEnd++] = '\n';
@@ -2722,14 +2249,6 @@ public class MXParser implements XmlPullParser {
     }
 
     protected void parseCDSect(boolean hadCharData) throws XmlPullParserException, IOException {
-        // implements XML 1.0 Section 2.7 CDATA Sections
-
-        // [18] CDSect ::= CDStart CData CDEnd
-        // [19] CDStart ::= '<![CDATA['
-        // [20] CData ::= (Char* - (Char* ']]>' Char*))
-        // [21] CDEnd ::= ']]>'
-
-        // ASSUMPTION: seen <![
         char ch = more();
         if (ch != 'C')
             throw new XmlPullParserException("expected <[CDATA[ for comment start", this, null);
@@ -2749,7 +2268,6 @@ public class MXParser implements XmlPullParser {
         if (ch != '[')
             throw new XmlPullParserException("expected <![CDATA[ for comment start", this, null);
 
-        // if(tokenize) {
         final int cdStart = pos + bufAbsoluteStart;
         final int curLine = lineNumber;
         final int curColumn = columnNumber;
@@ -2758,7 +2276,6 @@ public class MXParser implements XmlPullParser {
             if (normalizeInput) {
                 if (hadCharData) {
                     if (!usePC) {
-                        // posEnd is correct already!!!
                         if (posEnd > posStart) {
                             joinPC();
                         } else {
@@ -2772,14 +2289,12 @@ public class MXParser implements XmlPullParser {
             boolean seenBracketBracket = false;
             boolean normalizedCR = false;
             while (true) {
-                // scan until it hits "]]>"
                 ch = more();
                 if (ch == ']') {
                     if (!seenBracket) {
                         seenBracket = true;
                     } else {
                         seenBracketBracket = true;
-                        // seenBracket = false;
                     }
                 } else if (ch == '>') {
                     if (seenBracket && seenBracketBracket) {
@@ -2794,11 +2309,10 @@ public class MXParser implements XmlPullParser {
                     }
                 }
                 if (normalizeInput) {
-                    // deal with normalization issues ...
                     if (ch == '\r') {
                         normalizedCR = true;
                         posStart = cdStart - bufAbsoluteStart;
-                        posEnd = pos - 1; // posEnd is alreadys set
+                        posEnd = pos - 1;
                         if (!usePC) {
                             if (posEnd > posStart) {
                                 joinPC();
@@ -2807,7 +2321,6 @@ public class MXParser implements XmlPullParser {
                                 pcStart = pcEnd = 0;
                             }
                         }
-                        // assert usePC == true;
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
                         pc[pcEnd++] = '\n';
@@ -2829,7 +2342,6 @@ public class MXParser implements XmlPullParser {
                 }
             }
         } catch (EOFException ex) {
-            // detect EOF and create meaningful error ...
             throw new XmlPullParserException(
                     "CDATA section started on line " + curLine + " and column " + curColumn + " was not closed", this, ex);
         }
@@ -2846,45 +2358,32 @@ public class MXParser implements XmlPullParser {
         if (reader == null)
             throw new XmlPullParserException("reader must be set before parsing is started");
 
-        // see if we are in compaction area
         if (bufEnd > bufSoftLimit) {
 
-            // expand buffer it makes sense!!!!
             boolean compact;
             if (preventBufferCompaction) {
                 compact = false;
             } else {
                 compact = bufStart > bufSoftLimit;
                 if (!compact) {
-                    // freeSpace
-                    // if at least half of buffer can be reclaimed --> worthwhile effort!!!
-                    // else less than half buffer available for compacting --> expand instead!!!
                     if (bufStart >= buf.length / 2) {
                         compact = true;
                     }
                 }
             }
 
-            // if buffer almost full then compact it
             if (compact) {
-                // TODO: look on trashing
-                // //assert bufStart > 0
                 System.arraycopy(buf, bufStart, buf, 0, bufEnd - bufStart);
-                if (TRACE_SIZING)
-                    System.out.println("TRACE_SIZING fillBuf() compacting " + bufStart + " bufEnd=" + bufEnd + " pos=" + pos
-                                       + " posStart=" + posStart + " posEnd=" + posEnd
-                                       + " buf first 100 chars:"
-                                       + new String(buf, bufStart, Math.min(bufEnd - bufStart, 100)));
+                LOG.trace("fillBuf() compacting {} bufEnd={} pos={} posStart={} posEnd={} buf first 100 chars:{}",
+                        bufStart, bufEnd, pos, posStart, posEnd, new String(buf, bufStart, Math.min(bufEnd - bufStart, 100)));
 
             } else {
                 final int newSize = 2 * buf.length;
                 final char[] newBuf = new char[newSize];
-                if (TRACE_SIZING)
-                    System.out.println("TRACE_SIZING fillBuf() " + buf.length + " => " + newSize);
+                LOG.trace("fillBuf() {} => {}", buf.length, newSize);
                 System.arraycopy(buf, bufStart, newBuf, 0, bufEnd - bufStart);
                 buf = newBuf;
                 if (bufLoadFactor > 0) {
-                    // bufSoftLimit = ( bufLoadFactor * buf.length ) /100;
                     bufSoftLimit = (int) ((((long) bufLoadFactor) * buf.length) / 100);
                 }
 
@@ -2895,19 +2394,15 @@ public class MXParser implements XmlPullParser {
             posEnd -= bufStart;
             bufAbsoluteStart += bufStart;
             bufStart = 0;
-            if (TRACE_SIZING)
-                System.out.println("TRACE_SIZING fillBuf() after bufEnd=" + bufEnd + " pos=" + pos + " posStart=" + posStart
-                                   + " posEnd=" + posEnd + " buf first 100 chars:"
-                                   + new String(buf, 0, bufEnd < 100 ? bufEnd : 100));
+            LOG.trace("fillBuf() after bufEnd={} pos={} posStart={} posEnd={} buf first 100 chars:{}",
+                    bufEnd, pos, posStart, posEnd, new String(buf, 0, bufEnd < 100 ? bufEnd : 100));
         }
-        // at least one character must be read or error
         final int len = buf.length - bufEnd > READ_CHUNK_SIZE ? READ_CHUNK_SIZE : buf.length - bufEnd;
         final int ret = reader.read(buf, bufEnd, len);
         if (ret > 0) {
             bufEnd += ret;
-            if (TRACE_SIZING)
-                System.out.println("TRACE_SIZING fillBuf() after filling in buffer" + " buf first 100 chars:"
-                                   + new String(buf, 0, bufEnd < 100 ? bufEnd : 100));
+            LOG.trace("fillBuf() after filling in buffer buf first 100 chars:{}",
+                    new String(buf, 0, bufEnd < 100 ? bufEnd : 100));
 
             return;
         }
@@ -2915,19 +2410,15 @@ public class MXParser implements XmlPullParser {
             if (bufAbsoluteStart == 0 && pos == 0) {
                 throw new EOFException("input contained no data");
             } else {
-                if (seenRoot && depth == 0) { // inside parsing epilog!!!
+                if (seenRoot && depth == 0) {
                     reachedEnd = true;
                     return;
                 } else {
                     StringBuilder expectedTagStack = new StringBuilder();
                     if (depth > 0) {
-                        // final char[] cbuf = elRawName[depth];
-                        // final String startname = new String(cbuf, 0,
-                        // elRawNameEnd[depth]);
                         expectedTagStack.append(" - expected end tag");
                         if (depth > 1) {
-                            expectedTagStack.append("s"); // more than one end
-                                                         // tag
+                            expectedTagStack.append("s");
                         }
                         expectedTagStack.append(" ");
                         for (int i = depth; i > 0; i--) {
@@ -2937,8 +2428,7 @@ public class MXParser implements XmlPullParser {
                         expectedTagStack.append(" to close");
                         for (int i = depth; i > 0; i--) {
                             if (i != depth) {
-                                expectedTagStack.append(" and"); // more than
-                                                                // one end tag
+                                expectedTagStack.append(" and");
                             }
                             String tagName = new String(elRawName[i], 0, elRawNameEnd[i]);
                             expectedTagStack.append(" start tag <").append(tagName).append('>');
@@ -2957,52 +2447,32 @@ public class MXParser implements XmlPullParser {
     protected char more() throws IOException, XmlPullParserException {
         if (pos >= bufEnd) {
             fillBuf();
-            // this return value should be ignonored as it is used in epilog
-            // parsing ...
             if (reachedEnd)
                 return (char) -1;
         }
         final char ch = buf[pos++];
-        // line/columnNumber
         if (ch == '\n') {
             ++lineNumber;
             columnNumber = 1;
         } else {
             ++columnNumber;
         }
-        // System.out.print(ch);
         return ch;
     }
 
-    // /**
-    // * This function returns position of parser in XML input stream
-    // * (how many <b>characters</b> were processed.
-    // * <p><b>NOTE:</b> this logical position and not byte offset as encodings
-    // * such as UTF8 may use more than one byte to encode one character.
-    // */
-    // public int getCurrentInputPosition() {
-    // return pos + bufAbsoluteStart;
-    // }
-
     protected void ensurePC(int end) {
-        // assert end >= pc.length;
         final int newSize = end > READ_CHUNK_SIZE ? 2 * end : 2 * READ_CHUNK_SIZE;
         final char[] newPC = new char[newSize];
-        if (TRACE_SIZING)
-            System.out.println("TRACE_SIZING ensurePC() " + pc.length + " ==> " + newSize + " end=" + end);
+        LOG.trace("ensurePC() {} ==> {} end={}", pc.length, newSize, end);
         System.arraycopy(pc, 0, newPC, 0, pcEnd);
         pc = newPC;
-        // assert end < pc.length;
     }
 
     protected void joinPC() {
-        // assert usePC == false;
-        // assert posEnd > posStart;
         final int len = posEnd - posStart;
         final int newEnd = pcEnd + len + 1;
         if (newEnd >= pc.length)
             ensurePC(newEnd); // add 1 for extra space for one char
-        // assert newEnd < pc.length;
         System.arraycopy(buf, posStart, pc, pcEnd, len);
         pcEnd += len;
         usePC = true;
@@ -3036,25 +2506,16 @@ public class MXParser implements XmlPullParser {
         return ch;
     }
 
-    // nameStart / name lookup tables based on XML 1.1
-    // http://www.w3.org/TR/2001/WD-xml11-20011213/
     protected static final int LOOKUP_MAX = 0x400;
     protected static final char LOOKUP_MAX_CHAR = (char) LOOKUP_MAX;
-    // protected static int lookupNameStartChar[] = new int[ LOOKUP_MAX_CHAR /
-    // 32 ];
-    // protected static int lookupNameChar[] = new int[ LOOKUP_MAX_CHAR / 32 ];
     protected static boolean[] lookupNameStartChar = new boolean[LOOKUP_MAX];
     protected static boolean[] lookupNameChar = new boolean[LOOKUP_MAX];
 
-    private static void setName(char ch)
-    // { lookupNameChar[ (int)ch / 32 ] |= (1 << (ch % 32)); }
-    {
+    private static void setName(char ch) {
         lookupNameChar[ch] = true;
     }
 
-    private static void setNameStart(char ch)
-    // { lookupNameStartChar[ (int)ch / 32 ] |= (1 << (ch % 32)); setName(ch); }
-    {
+    private static void setNameStart(char ch) {
         lookupNameStartChar[ch] = true;
         setName(ch);
     }
@@ -3082,76 +2543,22 @@ public class MXParser implements XmlPullParser {
             setName(ch);
     }
 
-    // private final static boolean isNameStartChar(char ch) {
     protected boolean isNameStartChar(char ch) {
         return (ch < LOOKUP_MAX_CHAR && lookupNameStartChar[ch]) || (ch >= LOOKUP_MAX_CHAR && ch <= '\u2027')
                 || (ch >= '\u202A' && ch <= '\u218F')
                 || (ch >= '\u2800' && ch <= '\uFFEF');
+    }
 
-        // if(ch < LOOKUP_MAX_CHAR) return lookupNameStartChar[ ch ];
-        // else return ch <= '\u2027'
-        // || (ch >= '\u202A' && ch <= '\u218F')
-        // || (ch >= '\u2800' && ch <= '\uFFEF')
-        // ;
-        // return false;
-        // return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch ==
-        // ':'
-        // || (ch >= '0' && ch <= '9');
-        // if(ch < LOOKUP_MAX_CHAR) return (lookupNameStartChar[ (int)ch / 32 ]
-        // & (1 << (ch % 32))) != 0;
-        // if(ch <= '\u2027') return true;
-        // //[#x202A-#x218F]
-        // if(ch < '\u202A') return false;
-        // if(ch <= '\u218F') return true;
-        // // added pairts [#x2800-#xD7FF] | [#xE000-#xFDCF] | [#xFDE0-#xFFEF] |
-        // [#x10000-#x10FFFF]
-        // if(ch < '\u2800') return false;
-        // if(ch <= '\uFFEF') return true;
-        // return false;
-
-        // else return (supportXml11 && ( (ch < '\u2027') || (ch > '\u2029' &&
-        // ch < '\u2200') ...
-    }
-
-    // private final static boolean isNameChar(char ch) {
     protected boolean isNameChar(char ch) {
-        // return isNameStartChar(ch);
-
-        // if(ch < LOOKUP_MAX_CHAR) return (lookupNameChar[ (int)ch / 32 ] & (1
-        // << (ch % 32))) != 0;
-
         return (ch < LOOKUP_MAX_CHAR && lookupNameChar[ch]) || (ch >= LOOKUP_MAX_CHAR && ch <= '\u2027')
                 || (ch >= '\u202A' && ch <= '\u218F')
                 || (ch >= '\u2800' && ch <= '\uFFEF');
-        // return false;
-        // return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch ==
-        // ':'
-        // || (ch >= '0' && ch <= '9');
-        // if(ch < LOOKUP_MAX_CHAR) return (lookupNameStartChar[ (int)ch / 32 ]
-        // & (1 << (ch % 32))) != 0;
-
-        // else return
-        // else if(ch <= '\u2027') return true;
-        // //[#x202A-#x218F]
-        // else if(ch < '\u202A') return false;
-        // else if(ch <= '\u218F') return true;
-        // // added pairts [#x2800-#xD7FF] | [#xE000-#xFDCF] | [#xFDE0-#xFFEF] |
-        // [#x10000-#x10FFFF]
-        // else if(ch < '\u2800') return false;
-        // else if(ch <= '\uFFEF') return true;
-        // else return false;
     }
 
     protected boolean isS(char ch) {
         return (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t');
-        // || (supportXml11 && (ch == '\u0085' || ch == '\u2028');
     }
 
-    // protected boolean isChar(char ch) { return (ch < '\uD800' || ch >
-    // '\uDFFF')
-    // ch != '\u0000' ch < '\uFFFE'
-
-    // protected char printable(char ch) { return ch; }
     protected String printable(char ch) {
         if (ch == '\n') {
             return "\\n";
diff --git a/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ParserTest.java b/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ParserTest.java
index cc058311aee3..3e1d10fd83d1 100644
--- a/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ParserTest.java
+++ b/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ParserTest.java
@@ -23,12 +23,16 @@ import org.apache.camel.xml.io.MXParser;
 import org.apache.camel.xml.io.XmlPullParserException;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 @Disabled("Run manually to check how the MX parser works")
 public class ParserTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(ParserTest.class);
+
     @Test
     public void justParse() throws XmlPullParserException, IOException {
         final MXParser xpp = getMxParser();
@@ -49,26 +53,25 @@ public class ParserTest {
             xpp.getTextCharacters(new int[2]); // check handling for non START/END_TAG
             switch (eventType) {
                 case MXParser.START_DOCUMENT -> {
-                    System.out.println("START_DOCUMENT");
+                    LOG.debug("START_DOCUMENT");
                 }
                 case MXParser.START_TAG -> {
                     xpp.getText(); // never uses org.apache.camel.xml.io.MXParser#pc
                     xpp.getTextCharacters(new int[2]);
                     xpp.isEmptyElementTag();
-                    System.out.println("START_TAG" + (xpp.isEmptyElementTag() ? " (empty tag)" : ""));
-                    System.out.println(" - name: " + xpp.getName());
-                    System.out.println(" - ns: " + xpp.getNamespace());
-                    System.out.println(" - prefix: " + xpp.getPrefix());
+                    LOG.debug("START_TAG" + (xpp.isEmptyElementTag() ? " (empty tag)" : ""));
+                    LOG.debug(" - name: " + xpp.getName());
+                    LOG.debug(" - ns: " + xpp.getNamespace());
+                    LOG.debug(" - prefix: " + xpp.getPrefix());
                     int ac = xpp.getAttributeCount();
                     if (ac > 0) {
-                        System.out.println(" - attributes:");
+                        LOG.debug(" - attributes:");
                         for (int i = 0; i < ac; i++) {
-                            System.out.print("    - " + xpp.getAttributeName(i)
-                                             + (xpp.getAttributePrefix(i) == null
-                                                     ? "" : " (prefix: " + xpp.getAttributePrefix(i) + ")"));
-                            System.out.print(": " + xpp.getAttributeValue(i));
-                            System.out.print(", ns: " + xpp.getAttributeNamespace(i));
-                            System.out.println();
+                            LOG.debug("    - " + xpp.getAttributeName(i)
+                                      + (xpp.getAttributePrefix(i) == null
+                                              ? "" : " (prefix: " + xpp.getAttributePrefix(i) + ")")
+                                      + ": " + xpp.getAttributeValue(i)
+                                      + ", ns: " + xpp.getAttributeNamespace(i));
                         }
                     }
                     if ("e1".equals(xpp.getName())) {
@@ -82,15 +85,15 @@ public class ParserTest {
                 case MXParser.END_TAG -> {
                     xpp.getText(); // never uses org.apache.camel.xml.io.MXParser#pc
                     xpp.getTextCharacters(new int[2]);
-                    System.out.println("END_TAG");
-                    System.out.println(" - name: " + xpp.getName());
-                    System.out.println(" - ns: " + xpp.getNamespace());
-                    System.out.println(" - prefix: " + xpp.getPrefix());
+                    LOG.debug("END_TAG");
+                    LOG.debug(" - name: " + xpp.getName());
+                    LOG.debug(" - ns: " + xpp.getNamespace());
+                    LOG.debug(" - prefix: " + xpp.getPrefix());
                 }
                 case MXParser.TEXT -> {
-                    System.out.println("TEXT");
-                    System.out.println(" - name: " + xpp.getName());
-                    System.out.println(" - text: '" + xpp.getText() + (xpp.isWhitespace() ? "' (whitespace)" : "'"));
+                    LOG.debug("TEXT");
+                    LOG.debug(" - name: " + xpp.getName());
+                    LOG.debug(" - text: '" + xpp.getText() + (xpp.isWhitespace() ? "' (whitespace)" : "'"));
                 }
                 case MXParser.CDSECT -> {
                     xpp.isWhitespace();
@@ -98,9 +101,9 @@ public class ParserTest {
                 case MXParser.ENTITY_REF -> {
                     xpp.getName();
                     xpp.getText(); // always returns text - even if null
-                    System.out.println("ENTITY_REF");
-                    System.out.println(" - name: " + xpp.getName());
-                    System.out.println(" - text: " + xpp.getText());
+                    LOG.debug("ENTITY_REF");
+                    LOG.debug(" - name: " + xpp.getName());
+                    LOG.debug(" - text: " + xpp.getText());
                 }
                 case MXParser.IGNORABLE_WHITESPACE -> {
                     xpp.isWhitespace(); // always true
@@ -148,7 +151,7 @@ public class ParserTest {
         while (eventType != MXParser.END_DOCUMENT) {
             eventType = xpp.next();
             if (eventType == MXParser.START_TAG) {
-                System.out.println(xpp.getName());
+                LOG.debug(xpp.getName());
             }
         }
     }
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/PipeProvider.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/PipeProvider.java
index 26cd72bcb9d8..9a3f4e115f9f 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/PipeProvider.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/PipeProvider.java
@@ -30,6 +30,8 @@ import org.apache.camel.spi.Resource;
 import org.apache.camel.spi.ResourceResolver;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.snakeyaml.engine.v2.api.LoadSettings;
 import org.snakeyaml.engine.v2.api.YamlUnicodeReader;
 import org.snakeyaml.engine.v2.composer.Composer;
@@ -48,6 +50,7 @@ import static org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.nodeAt;
  */
 public class PipeProvider extends ObjectReferenceBindingProvider {
 
+    private static final Logger LOG = LoggerFactory.getLogger(PipeProvider.class);
     private static final String prefix = "kamelet:";
 
     public PipeProvider() {
@@ -144,10 +147,10 @@ public class PipeProvider extends ObjectReferenceBindingProvider {
                 }
                 IOHelper.close(is);
             } catch (Exception e) {
-                System.err.println("Error parsing Kamelet: " + loc + " due to: " + e.getMessage());
+                LOG.error("Error parsing Kamelet: {} due to: {}", loc, e.getMessage(), e);
             }
         } else {
-            System.err.println("Kamelet not found on github: " + kamelet);
+            LOG.error("Kamelet not found on github: {}", kamelet);
         }
 
         endpointProperties.putAll(userProperties);
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
index d61cc198c890..d49bf05f8f2f 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
@@ -19,6 +19,8 @@ package org.apache.camel.dsl.jbang.core.common;
 import java.util.StringJoiner;
 
 import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Printer interface used by commands to write output to given print stream. By default, uses System out print stream,
@@ -52,25 +54,29 @@ public interface Printer {
     }
 
     /**
-     * Default printer uses System out print stream.
+     * Default printer uses a logger.
      */
     class SystemOutPrinter implements Printer {
+
+        private static final Logger LOG = LoggerFactory.getLogger(SystemOutPrinter.class);
+
         public void println() {
+            // print empty line is not really logging
             System.out.println();
             System.out.flush();
         }
 
         public void println(String line) {
-            System.out.println(line);
-            System.out.flush();
+            LOG.info(line);
         }
 
         public void print(String output) {
+            // printing without a newline is not really logging
             System.out.print(output);
         }
 
         public void printf(String format, Object... args) {
-            System.out.printf(format, args);
+            LOG.info(String.format(format, args));
         }
     }
 
diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesHelper.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesHelper.java
index edc4cf28bc04..97819de5f3dc 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesHelper.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesHelper.java
@@ -45,6 +45,8 @@ import io.fabric8.kubernetes.client.dsl.base.ResourceDefinitionContext;
 import org.apache.camel.dsl.jbang.core.common.YamlHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.yaml.snakeyaml.Yaml;
 
 /**
@@ -52,6 +54,7 @@ import org.yaml.snakeyaml.Yaml;
  */
 public final class KubernetesHelper {
 
+    private static final Logger LOG = LoggerFactory.getLogger(KubernetesHelper.class);
     private static KubernetesClient kubernetesClient;
 
     /** Clients with custom config */
@@ -157,7 +160,7 @@ public final class KubernetesHelper {
             APIGroup apiGroup = getKubernetesClient().getApiGroup("route.openshift.io");
             ocp = apiGroup != null;
         } catch (RuntimeException e) {
-            System.out.println("Failed to detect cluster: " + e.getMessage() + ", default to kubernetes.");
+            LOG.warn("Failed to detect cluster, defaulting to kubernetes: {}", e.getMessage());
         }
         return ocp;
     }
@@ -180,8 +183,8 @@ public final class KubernetesHelper {
             minikubeEnv = System.getenv("MINIKUBE_ACTIVE_DOCKERD") != null
                     && System.getenv("DOCKER_TLS_VERIFY") != null;
             if (minikube && !minikubeEnv) {
-                System.out.println(
-                        "It seems you have minikube running but forgot to run \"eval $(minikube docker-env)\", default cluster to kubernetes.");
+                LOG.warn(
+                        "It seems you have minikube running but forgot to run \"eval $(minikube docker-env)\", defaulting cluster to kubernetes.");
             }
         } catch (Exception e) {
             // ignore it, since we try to discover the cluster and don't want the caller to handle any error
diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index caff3eb0128d..cac9db19c3e8 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -112,12 +112,15 @@ import org.apache.camel.support.RouteOnDemandReloadStrategy;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.support.startup.BacklogStartupStepRecorder;
 import org.apache.camel.tooling.maven.MavenGav;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * A Main class for booting up Camel with Kamelet in standalone mode.
  */
 public class KameletMain extends MainCommandLineSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(KameletMain.class);
     public static final String DEFAULT_KAMELETS_LOCATION = "classpath:kamelets,github:apache:camel-kamelets/kamelets";
 
     private final String instanceType;
@@ -354,8 +357,7 @@ public class KameletMain extends MainCommandLineSupport {
 
     @Override
     public void showOptionsHeader() {
-        System.out.println("Apache Camel (KameletMain) takes the following options");
-        System.out.println();
+        LOG.info("Apache Camel (KameletMain) takes the following options");
     }
 
     @Override
diff --git a/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/services/ContainerTestService.java b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/services/ContainerTestService.java
index 3b537e3c74f5..29b219ee582a 100644
--- a/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/services/ContainerTestService.java
+++ b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/services/ContainerTestService.java
@@ -34,7 +34,7 @@ public interface ContainerTestService extends ExecutionCondition {
         Logger logger = LoggerFactory.getLogger(ContainerService.class);
         logger.warn("Test {} is disabled because docker is not available", extensionContext.getElement().orElse(null));
 
-        System.err.println(
+        logger.warn(
                 "Container-based tests were disabled because Docker is NOT available. Check the log files on target/failsafe-reports");
         return ConditionEvaluationResult.disabled("Docker is NOT available");
     }
diff --git a/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi/RestDslYamlGenerator.java b/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi/RestDslYamlGenerator.java
index 6bafb924496f..a93b1d8699bf 100644
--- a/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi/RestDslYamlGenerator.java
+++ b/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi/RestDslYamlGenerator.java
@@ -173,7 +173,11 @@ public class RestDslYamlGenerator extends RestDslGenerator<RestDslYamlGenerator>
             }
         }
 
-        ObjectMapper mapper = new ObjectMapper(new YAMLFactory().disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER));
+        YAMLFactory yamlFactory = new YAMLFactory()
+                .disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER)
+                .enable(YAMLGenerator.Feature.MINIMIZE_QUOTES)
+                .enable(YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR);
+        ObjectMapper mapper = new ObjectMapper(yamlFactory);
         return mapper.writeValueAsString(node);
     }
 


(camel) 02/07: CAMEL-22502: Undo some unnecessary changes regarding System.out and slf4j

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 35164df399bde6b4ec737b1c64f6d42160f39ca9
Author: Mikołaj Diakowski <mi...@interia.pl>
AuthorDate: Fri Oct 10 09:27:03 2025 +0200

    CAMEL-22502: Undo some unnecessary changes regarding System.out and slf4j
---
 .../htmlxlsx/process/CoverageResultsProcessor.java |  11 +-
 .../org/apache/camel/component/jasypt/Main.java    |  25 +-
 .../org/apache/camel/component/jmx/XmlFixture.java |  16 -
 .../mllp/MllpTcpServerConsumerTransactionTest.java |  20 +-
 .../test/oauth/AbstractOAuthCodeFlowTest.java      |   6 +-
 .../camel/component/splunk/ProducerTest.java       |   5 +-
 .../camel/component/splunk/RawProducerTest.java    |   5 +-
 .../apache/camel/main/MainCommandLineSupport.java  |  13 +-
 .../java/org/apache/camel/xml/io/MXParser.java     | 669 +++++++++++++++++++--
 .../dsl/jbang/core/commands/bind/PipeProvider.java |   7 +-
 .../camel/dsl/jbang/core/common/Printer.java       |  14 +-
 .../core/commands/kubernetes/KubernetesHelper.java |   9 +-
 .../java/org/apache/camel/main/KameletMain.java    |   6 +-
 .../generator/openapi/RestDslYamlGenerator.java    |   6 +-
 14 files changed, 686 insertions(+), 126 deletions(-)

diff --git a/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessor.java b/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessor.java
index e6a922840e3a..4273ba7b674e 100644
--- a/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessor.java
+++ b/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessor.java
@@ -39,13 +39,9 @@ import org.apache.camel.maven.htmlxlsx.model.RouteStatistic;
 import org.apache.camel.maven.htmlxlsx.model.RouteTotalsStatistic;
 import org.apache.camel.maven.htmlxlsx.model.TestResult;
 import org.apache.maven.project.MavenProject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class CoverageResultsProcessor {
 
-    private static final Logger LOG = LoggerFactory.getLogger(CoverageResultsProcessor.class);
-
     private static final String DETAILS_FILE = "/details.html";
 
     private static final String INDEX_FILE = "/index.html";
@@ -228,9 +224,10 @@ public class CoverageResultsProcessor {
                     }
                 } catch (Exception t) {
                     // this is an edge case that needs to be identified. Log some useful debugging information.
-                    LOG.error("Error processing route coverage for routeId: {}", routeId, t);
-                    LOG.error("Route: {}", route);
-                    LOG.error("MappedRoute: {}", mappedRoute != null ? mappedRoute.toString() : "null");
+                    System.out.println(t.getClass().toString());
+                    System.out.printf("routeID: %s%n", routeId);
+                    System.out.printf("route: %s%n", route);
+                    System.out.printf("mappedRoute: %s%n", mappedRoute != null ? mappedRoute.toString() : "null");
                 }
             });
         });
diff --git a/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/Main.java b/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/Main.java
index ba5b9a627ea7..85e7d39fbeed 100644
--- a/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/Main.java
+++ b/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/Main.java
@@ -24,13 +24,9 @@ import java.util.List;
 import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
 import org.jasypt.iv.RandomIvGenerator;
 import org.jasypt.salt.RandomSaltGenerator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class Main {
 
-    private static final Logger LOG = LoggerFactory.getLogger(Main.class);
-
     private final StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
     private final List<Option> options = new ArrayList<>();
     private String command;
@@ -89,7 +85,7 @@ public class Main {
         @Override
         protected void doProcess(String arg, LinkedList<String> remainingArgs) {
             if (remainingArgs.isEmpty()) {
-                LOG.error("Expected parameter for option: {}", arg);
+                System.err.println("Expected fileName for ");
                 showOptions();
             } else {
                 String parameter = remainingArgs.removeFirst();
@@ -161,10 +157,13 @@ public class Main {
     }
 
     private void showOptions() {
-        LOG.info("Apache Camel Jasypt takes the following options:");
+        System.out.println("Apache Camel Jasypt takes the following options:");
+        System.out.println();
         for (Option option : options) {
-            LOG.info(option.getInformation());
+            System.out.println(option.getInformation());
         }
+        System.out.println();
+        System.out.println();
     }
 
     private boolean parseArguments(String[] arguments) {
@@ -182,7 +181,8 @@ public class Main {
                 }
             }
             if (!handled) {
-                LOG.error("Error: Unknown option: {}", arg);
+                System.out.println("Error: Unknown option: " + arg);
+                System.out.println();
                 valid = false;
                 break;
             }
@@ -198,17 +198,20 @@ public class Main {
         }
 
         if (command == null) {
-            LOG.error("Error: Command is empty");
+            System.out.println("Error: Command is empty");
+            System.out.println();
             showOptions();
             return;
         }
         if (password == null) {
-            LOG.error("Error: Password is empty");
+            System.out.println("Error: Password is empty");
+            System.out.println();
             showOptions();
             return;
         }
         if (input == null) {
-            LOG.error("Error: Input is empty");
+            System.out.println("Error: Input is empty");
+            System.out.println();
             showOptions();
             return;
         }
diff --git a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/XmlFixture.java b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/XmlFixture.java
index a217ba8990f6..b0a39c7d32e4 100644
--- a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/XmlFixture.java
+++ b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/XmlFixture.java
@@ -17,14 +17,8 @@
 package org.apache.camel.component.jmx;
 
 import java.io.File;
-import java.io.StringWriter;
 
-import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
 import org.slf4j.Logger;
@@ -54,16 +48,6 @@ public final class XmlFixture {
                 .areSimilar();
     }
 
-    public static void dump(Source aActual)
-            throws TransformerException {
-        TransformerFactory tf = TransformerFactory.newInstance();
-        Transformer transformer = tf.newTransformer();
-        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-        StringWriter sw = new StringWriter();
-        transformer.transform(aActual, new StreamResult(sw));
-        LOG.debug(sw.toString());
-    }
-
     public static Source stripTimestamp(Source aSource) throws Exception {
         String resourcePath = "/stripTimestamp.xsl";
         return transform(aSource, resourcePath);
diff --git a/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpServerConsumerTransactionTest.java b/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpServerConsumerTransactionTest.java
index b8c79d538642..46f474e99dd4 100644
--- a/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpServerConsumerTransactionTest.java
+++ b/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpServerConsumerTransactionTest.java
@@ -18,11 +18,14 @@ package org.apache.camel.component.mllp;
 
 import java.util.concurrent.TimeUnit;
 
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.CamelContext;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.sjms.SjmsComponent;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.infra.artemis.services.ArtemisService;
@@ -33,14 +36,10 @@ import org.apache.camel.test.mllp.Hl7TestMessageGenerator;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @Disabled("This test hangs")
 public class MllpTcpServerConsumerTransactionTest extends CamelTestSupport {
 
-    private static final Logger LOG = LoggerFactory.getLogger(MllpTcpServerConsumerTransactionTest.class);
-
     @RegisterExtension
     public static ArtemisService service = ArtemisServiceFactory.createVMService();
 
@@ -66,7 +65,16 @@ public class MllpTcpServerConsumerTransactionTest extends CamelTestSupport {
         return context;
     }
 
-	@Override
+    @BindToRegistry("target")
+    public SjmsComponent addTargetComponent() {
+
+        SjmsComponent target = new SjmsComponent();
+        target.setConnectionFactory(new ActiveMQConnectionFactory(service.serviceAddress()));
+
+        return target;
+    }
+
+    @Override
     protected RouteBuilder createRouteBuilder() {
 
         mllpClient.setMllpHost("localhost");
@@ -98,7 +106,7 @@ public class MllpTcpServerConsumerTransactionTest extends CamelTestSupport {
 
                 from("target://test-queue")
                         .routeId("jms-consumer")
-                        .process(exchange -> LOG.info("Body: {}", exchange.getIn().getBody()))
+                        .process(exchange -> System.out.println(exchange.getIn().getBody()))
                         .log(LoggingLevel.INFO, routeId, "Test JMS Consumer received message")
                         .to(result);
 
diff --git a/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/AbstractOAuthCodeFlowTest.java b/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/AbstractOAuthCodeFlowTest.java
index 3100bee09df2..c02d6d4e790e 100644
--- a/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/AbstractOAuthCodeFlowTest.java
+++ b/components/camel-oauth/src/test/java/org/apache/camel/test/oauth/AbstractOAuthCodeFlowTest.java
@@ -46,8 +46,8 @@ abstract class AbstractOAuthCodeFlowTest extends AbstractKeycloakTest {
             Assertions.assertEquals(1, keycloak.realm(KEYCLOAK_REALM).clients().findByClientId(TEST_CLIENT_ID).size());
             Assertions.assertEquals(1, keycloak.realm(KEYCLOAK_REALM).users().search("alice").size());
 
-            LOG.info("✅ Keycloak realm, client, and user available!");
-            LOG.info("✅ Open: {}", APP_BASE_URL);
+            LOG.info("Keycloak realm, client, and user available!");
+            LOG.info("Open: {}", APP_BASE_URL);
 
             // Open WebApp in Browser (works on macOS)
             // Runtime.getRuntime().exec("open " + APP_BASE_URL);
@@ -58,7 +58,7 @@ abstract class AbstractOAuthCodeFlowTest extends AbstractKeycloakTest {
             for (int i = maxLoopCount; i > 0; i--) {
                 var options = context.getGlobalOptions();
                 if ("ok".equals(options.get("OAuthLogout"))) {
-                    LOG.info("✅ OAuthLogout - ok");
+                    LOG.info("OAuthLogout - ok");
                     i = 0;
                 }
                 if (i % 4 == 0) {
diff --git a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ProducerTest.java b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ProducerTest.java
index 7903f5a272e9..e49a029ce949 100644
--- a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ProducerTest.java
+++ b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ProducerTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.splunk;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
 import com.splunk.Args;
@@ -71,8 +70,6 @@ public class ProducerTest extends SplunkMockTestSupport {
     @Mock
     private InputCollection inputCollection;
 
-    private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
     @BeforeEach
     public void setup() throws IOException {
         when(service.getIndexes()).thenReturn(indexColl);
@@ -82,7 +79,7 @@ public class ProducerTest extends SplunkMockTestSupport {
         when(inputCollection.get(anyString())).thenReturn(input);
         when(indexColl.get(anyString())).thenReturn(index);
         when(index.attach(isA(Args.class))).thenReturn(socket);
-        when(socket.getOutputStream()).thenReturn(baos);
+        when(socket.getOutputStream()).thenReturn(System.out);
     }
 
     @Test
diff --git a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/RawProducerTest.java b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/RawProducerTest.java
index eea8290725c5..0be23ab82fbb 100644
--- a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/RawProducerTest.java
+++ b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/RawProducerTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.splunk;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
 import com.splunk.Args;
@@ -62,8 +61,6 @@ public class RawProducerTest extends SplunkMockTestSupport {
     @Mock
     private InputCollection inputCollection;
 
-    private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
     @BeforeEach
     public void setup() throws IOException {
         when(service.getIndexes()).thenReturn(indexColl);
@@ -73,7 +70,7 @@ public class RawProducerTest extends SplunkMockTestSupport {
         when(inputCollection.get(anyString())).thenReturn(input);
         when(indexColl.get(anyString())).thenReturn(index);
         when(index.attach(isA(Args.class))).thenReturn(socket);
-        when(socket.getOutputStream()).thenReturn(baos);
+        when(socket.getOutputStream()).thenReturn(System.out);
     }
 
     @Test
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java
index 15462e4daccc..104dc0d17040 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java
@@ -29,15 +29,12 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.spi.LoadablePropertiesSource;
 import org.apache.camel.spi.PropertiesComponent;
 import org.apache.camel.util.OrderedProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Support for command line arguments to Camel main.
  */
 public abstract class MainCommandLineSupport extends MainSupport {
 
-    protected static final Logger LOG = LoggerFactory.getLogger(MainCommandLineSupport.class);
     protected final List<Option> options = new ArrayList<>();
     protected Properties argumentProperties;
     private volatile boolean initOptionsDone;
@@ -191,7 +188,7 @@ public abstract class MainCommandLineSupport extends MainSupport {
         showOptionsHeader();
 
         for (Option option : options) {
-            LOG.info(option.getInformation());
+            System.out.println(option.getInformation());
         }
     }
 
@@ -214,7 +211,8 @@ public abstract class MainCommandLineSupport extends MainSupport {
                 }
             }
             if (!handled) {
-                LOG.error("Unknown option: {}", arg);
+                System.out.println("Unknown option: " + arg);
+                System.out.println();
                 valid = false;
                 break;
             }
@@ -297,7 +295,8 @@ public abstract class MainCommandLineSupport extends MainSupport {
      * Displays the header message for the command line options.
      */
     public void showOptionsHeader() {
-        LOG.info("Apache Camel Runner takes the following options");
+        System.out.println("Apache Camel Runner takes the following options");
+        System.out.println();
     }
 
     public abstract static class Option {
@@ -349,7 +348,7 @@ public abstract class MainCommandLineSupport extends MainSupport {
         @Override
         protected void doProcess(String arg, LinkedList<String> remainingArgs) {
             if (remainingArgs.isEmpty()) {
-                LOG.error("Expected parameter for option: {}", arg);
+                System.err.println("Expected fileName for ");
                 showOptions();
                 completed();
             } else {
diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/MXParser.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/MXParser.java
index da4bab61bc5d..f19457d9ae88 100644
--- a/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/MXParser.java
+++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/MXParser.java
@@ -33,8 +33,6 @@ import java.io.InputStreamReader;
 import java.io.Reader;
 
 import org.apache.camel.xml.io.util.XmlStreamReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 // https://github.com/codelibs/xpp3/blob/master/src/main/java/org/xmlpull/mxp1/MXParser.java
 
@@ -51,7 +49,6 @@ import org.slf4j.LoggerFactory;
  * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
  */
 public class MXParser implements XmlPullParser {
-    private static final Logger LOG = LoggerFactory.getLogger(MXParser.class);
     // NOTE: no interning of those strings --> by Java lang spec they MUST be
     // already interned
     protected static final String XML_URI = "http://www.w3.org/XML/1998/namespace";
@@ -76,7 +73,7 @@ public class MXParser implements XmlPullParser {
     protected boolean allStringsInterned;
 
     protected void resetStringCache() {
-        // LOG.trace("resetStringCache() minimum called");
+        // System.out.println("resetStringCache() minimum called");
     }
 
     protected String newString(char[] cbuf, int off, int len) {
@@ -87,6 +84,8 @@ public class MXParser implements XmlPullParser {
         return (new String(cbuf, off, len)).intern();
     }
 
+    private static final boolean TRACE_SIZING = false;
+
     // NOTE: features are not resettable and typically defaults to false ...
     protected boolean processNamespaces;
     protected boolean roundtripSupported;
@@ -122,7 +121,9 @@ public class MXParser implements XmlPullParser {
             // we add at least one extra slot ...
             final int newSize = (depth >= 7 ? 2 * depth : 8) + 2; // = lucky 7 +
                                                                  // 1 //25
-            LOG.trace("elStackSize {} ==> {}", elStackSize, newSize);
+            if (TRACE_SIZING) {
+                System.err.println("TRACE_SIZING elStackSize " + elStackSize + " ==> " + newSize);
+            }
             final boolean needsCopying = elStackSize > 0;
             String[] arr;
             // reuse arr local variable slot
@@ -166,6 +167,23 @@ public class MXParser implements XmlPullParser {
                 System.arraycopy(elRawName, 0, carr, 0, elStackSize);
             }
             elRawName = carr;
+            // arr = new String[newSize];
+            // if(needsCopying) System.arraycopy(elLocalName, 0, arr, 0,
+            // elStackSize);
+            // elLocalName = arr;
+            // arr = new String[newSize];
+            // if(needsCopying) System.arraycopy(elDefaultNs, 0, arr, 0,
+            // elStackSize);
+            // elDefaultNs = arr;
+            // int[] iarr = new int[newSize];
+            // if(needsCopying) System.arraycopy(elNsStackPos, 0, iarr, 0,
+            // elStackSize);
+            // for (int i = elStackSize; i < iarr.length; i++)
+            // {
+            // iarr[i] = (i > 0) ? -1 : 0;
+            // }
+            // elNsStackPos = iarr;
+            // assert depth < elName.length;
         }
     }
 
@@ -188,7 +206,9 @@ public class MXParser implements XmlPullParser {
         final int attrPosSize = attributeName != null ? attributeName.length : 0;
         if (size >= attrPosSize) {
             final int newSize = size > 7 ? 2 * size : 8; // = lucky 7 + 1 //25
-            LOG.trace("attrPosSize {} ==> {}", attrPosSize, newSize);
+            if (TRACE_SIZING) {
+                System.err.println("TRACE_SIZING attrPosSize " + attrPosSize + " ==> " + newSize);
+            }
             final boolean needsCopying = attrPosSize > 0;
             String[] arr;
 
@@ -218,6 +238,7 @@ public class MXParser implements XmlPullParser {
                     System.arraycopy(attributeNameHash, 0, iarr, 0, attrPosSize);
                 attributeNameHash = iarr;
             }
+            // //assert attrUri.length > size
         }
     }
 
@@ -231,7 +252,9 @@ public class MXParser implements XmlPullParser {
         final int namespaceSize = namespacePrefix != null ? namespacePrefix.length : 0;
         if (size >= namespaceSize) {
             final int newSize = size > 7 ? 2 * size : 8; // = lucky 7 + 1 //25
-            LOG.trace("namespaceSize {} ==> {}", namespaceSize, newSize);
+            if (TRACE_SIZING) {
+                System.err.println("TRACE_SIZING namespaceSize " + namespaceSize + " ==> " + newSize);
+            }
             final String[] newNamespacePrefix = new String[newSize];
             final String[] newNamespaceUri = new String[newSize];
             if (namespacePrefix != null) {
@@ -248,6 +271,8 @@ public class MXParser implements XmlPullParser {
                 }
                 namespacePrefixHash = newNamespacePrefixHash;
             }
+            // prefixesSize = newSize;
+            // //assert nsPrefixes.length > size && nsPrefixes.length == newSize
         }
     }
 
@@ -258,12 +283,23 @@ public class MXParser implements XmlPullParser {
     protected static int fastHash(char[] ch, int off, int len) {
         if (len == 0)
             return 0;
+        // assert len >0
         int hash = ch[off]; // hash at beginning
+        // try {
         hash = (hash << 7) + ch[off + len - 1]; // hash at the end
+        // } catch(ArrayIndexOutOfBoundsException aie) {
+        // aie.printStackTrace(); //should never happen ...
+        // throw new RuntimeException("this is violation of pre-condition");
+        // }
         if (len > 16)
             hash = (hash << 7) + ch[off + (len / 4)]; // 1/4 from beginning
         if (len > 8)
             hash = (hash << 7) + ch[off + (len / 2)]; // 1/2 of string size ...
+        // notice that hash is at most done 3 times <<7 so shifted by 21 bits 8
+        // bit value
+        // so max result == 29 bits so it is quite just below 31 bits for long
+        // (2^32) ...
+        // assert hash >= 0;
         return hash;
     }
 
@@ -281,7 +317,10 @@ public class MXParser implements XmlPullParser {
         final int entitySize = entityReplacementBuf != null ? entityReplacementBuf.length : 0;
         if (entityEnd >= entitySize) {
             final int newSize = entityEnd > 7 ? 2 * entityEnd : 8; // = lucky 7
-            LOG.trace("entitySize {} ==> {}", entitySize, newSize);
+                                                                  // + 1 //25
+            if (TRACE_SIZING) {
+                System.err.println("TRACE_SIZING entitySize " + entitySize + " ==> " + newSize);
+            }
             final String[] newEntityName = new String[newSize];
             final char[][] newEntityNameBuf = new char[newSize][];
             final String[] newEntityReplacement = new String[newSize];
@@ -314,9 +353,12 @@ public class MXParser implements XmlPullParser {
     protected String inputEncoding;
 
     protected int bufLoadFactor = 95; // 99%
+    // protected int bufHardLimit; // only matters when expanding
 
     protected char[] buf = new char[Runtime.getRuntime().freeMemory() > 1000000L ? READ_CHUNK_SIZE : 256];
     protected int bufSoftLimit = (bufLoadFactor * buf.length) / 100; // desirable
+                                                                    // size of
+                                                                    // buffer
     protected boolean preventBufferCompaction;
 
     protected int bufAbsoluteStart; // this is buf
@@ -330,6 +372,9 @@ public class MXParser implements XmlPullParser {
     protected int pcStart;
     protected int pcEnd;
 
+    // parsing state
+    // protected boolean needsMore;
+    // protected boolean seenMarkup;
     protected boolean usePC;
 
     protected boolean seenStartTag;
@@ -339,6 +384,7 @@ public class MXParser implements XmlPullParser {
     protected boolean seenMarkup;
     protected boolean seenDocdecl;
 
+    // transient variable set during each call to next/Token()
     protected boolean tokenize;
     protected String text;
     protected String entityRefName;
@@ -348,6 +394,7 @@ public class MXParser implements XmlPullParser {
     protected String xmlDeclContent;
 
     protected void reset() {
+        // System.out.println("reset() called");
         location = null;
         startLineNumber = 1;
         lineNumber = 1;
@@ -394,6 +441,13 @@ public class MXParser implements XmlPullParser {
     public MXParser() {
     }
 
+    /**
+     * Method setFeature
+     *
+     * @param  name                   a String
+     * @param  state                  a boolean
+     * @throws XmlPullParserException
+     */
     public void setFeature(String name, boolean state) throws XmlPullParserException {
         if (name == null)
             throw new IllegalArgumentException("feature name should not be null");
@@ -401,6 +455,11 @@ public class MXParser implements XmlPullParser {
             if (eventType != START_DOCUMENT)
                 throw new XmlPullParserException("namespace processing feature can only be changed before parsing", this, null);
             processNamespaces = state;
+            // } else if(FEATURE_REPORT_NAMESPACE_ATTRIBUTES.equals(name)) {
+            // if(type != START_DOCUMENT) throw new XmlPullParserException(
+            // "namespace reporting feature can only be changed before parsing",
+            // this, null);
+            // reportNsAttribs = state;
         } else if (FEATURE_NAMES_INTERNED.equals(name)) {
             if (state) {
                 throw new XmlPullParserException("interning names in this implementation is not supported");
@@ -409,23 +468,37 @@ public class MXParser implements XmlPullParser {
             if (state) {
                 throw new XmlPullParserException("processing DOCDECL is not supported");
             }
+            // } else if(REPORT_DOCDECL.equals(name)) {
+            // paramNotifyDoctype = state;
         } else if (FEATURE_XML_ROUNDTRIP.equals(name)) {
+            // if(state == false) {
+            // throw new XmlPullParserException(
+            // "roundtrip feature can not be switched off");
+            // }
             roundtripSupported = state;
         } else {
             throw new XmlPullParserException("unsupported feature " + name);
         }
     }
 
+    /**
+     * Unknown properties are <strong>always</strong> returned as false
+     */
     public boolean getFeature(String name) {
         if (name == null)
             throw new IllegalArgumentException("feature name should not be null");
         if (FEATURE_PROCESS_NAMESPACES.equals(name)) {
             return processNamespaces;
+            // } else if(FEATURE_REPORT_NAMESPACE_ATTRIBUTES.equals(name)) {
+            // return reportNsAttribs;
         } else if (FEATURE_NAMES_INTERNED.equals(name)) {
             return false;
         } else if (FEATURE_PROCESS_DOCDECL.equals(name)) {
             return false;
+            // } else if(REPORT_DOCDECL.equals(name)) {
+            // return paramNotifyDoctype;
         } else if (FEATURE_XML_ROUNDTRIP.equals(name)) {
+            // return true;
             return roundtripSupported;
         }
         return false;
@@ -486,7 +559,13 @@ public class MXParser implements XmlPullParser {
     }
 
     public void defineEntityReplacementText(String entityName, String replacementText) throws XmlPullParserException {
+        // throw new XmlPullParserException("not allowed");
+
+        // protected char[] entityReplacement[];
         ensureEntityCapacity();
+
+        // this is to make sure that if interning works we will take advantage
+        // of it ...
         this.entityName[entityEnd] = newString(entityName.toCharArray(), 0, entityName.length());
         entityNameBuf[entityEnd] = entityName.toCharArray();
 
@@ -496,18 +575,26 @@ public class MXParser implements XmlPullParser {
             entityNameHash[entityEnd] = fastHash(entityNameBuf[entityEnd], 0, entityNameBuf[entityEnd].length);
         }
         ++entityEnd;
+        // TODO disallow < or & in entity replacement text (or ]]>???)
+        // TOOD keepEntityNormalizedForAttributeValue cached as well ...
     }
 
     public int getNamespaceCount(int depth) throws XmlPullParserException {
         if (!processNamespaces || depth == 0) {
             return 0;
         }
+        // int maxDepth = eventType == END_TAG ? this.depth + 1 : this.depth;
+        // if(depth < 0 || depth > maxDepth) throw new IllegalArgumentException(
         if (depth < 0 || depth > this.depth)
             throw new IllegalArgumentException("allowed namespace depth 0.." + this.depth + " not " + depth);
         return elNamespaceCount[depth];
     }
 
     public String getNamespacePrefix(int pos) throws XmlPullParserException {
+
+        // int end = eventType == END_TAG ? elNamespaceCount[ depth + 1 ] :
+        // namespaceEnd;
+        // if(pos < end) {
         if (pos < namespaceEnd) {
             return namespacePrefix[pos];
         } else {
@@ -516,6 +603,9 @@ public class MXParser implements XmlPullParser {
     }
 
     public String getNamespaceUri(int pos) throws XmlPullParserException {
+        // int end = eventType == END_TAG ? elNamespaceCount[ depth + 1 ] :
+        // namespaceEnd;
+        // if(pos < end) {
         if (pos < namespaceEnd) {
             return namespaceUri[pos];
         } else {
@@ -523,7 +613,10 @@ public class MXParser implements XmlPullParser {
         }
     }
 
-    public String getNamespace(String prefix) {
+    public String getNamespace(String prefix)
+    // throws XmlPullParserException
+    {
+        // int count = namespaceCount[ depth ];
         if (prefix != null) {
             for (int i = namespaceEnd - 1; i >= 0; i--) {
                 if (prefix.equals(namespacePrefix[i])) {
@@ -537,7 +630,8 @@ public class MXParser implements XmlPullParser {
             }
         } else {
             for (int i = namespaceEnd - 1; i >= 0; i--) {
-                if (namespacePrefix[i] == null) {
+                if (namespacePrefix[i] == null) { // "") { //null ) { //TODO
+                                                 // check FIXME Alek
                     return namespaceUri[i];
                 }
             }
@@ -551,6 +645,8 @@ public class MXParser implements XmlPullParser {
     }
 
     private static int findFragment(int bufMinPos, char[] b, int start, int end) {
+        // System.err.println("bufStart="+bufStart+" b="+printable(new String(b,
+        // start, end - start))+" start="+start+" end="+end);
         if (start < bufMinPos) {
             start = bufMinPos;
             if (start > end)
@@ -571,16 +667,23 @@ public class MXParser implements XmlPullParser {
         return i;
     }
 
+    /**
+     * Return string describing current position of parsers as text 'STATE [seen %s...] @line:column'.
+     */
     public String getPositionDescription() {
         String fragment = null;
         if (posStart <= pos) {
             final int start = findFragment(0, buf, posStart, pos);
+            // System.err.println("start="+start);
             if (start < pos) {
                 fragment = new String(buf, start, pos - start);
             }
             if (bufAbsoluteStart > 0 || start > 0)
                 fragment = "..." + fragment;
         }
+        // return " at line "+tokenizerPosRow
+        // +" and column "+(tokenizerPosCol-1)
+        // +(fragment != null ? " seen "+printable(fragment)+"..." : "");
         return " " + TYPES[eventType] + (fragment != null ? " seen " + printable(fragment) + "..." : "") + " "
                + (location != null ? location : "") + "@" + getLineNumber() + ":"
                + getColumnNumber();
@@ -621,7 +724,12 @@ public class MXParser implements XmlPullParser {
 
     public String getText() {
         if (eventType == START_DOCUMENT || eventType == END_DOCUMENT) {
+            // throw new XmlPullParserException("no content available to read");
+            // if(roundtripSupported) {
+            // text = new String(buf, posStart, posEnd - posStart);
+            // } else {
             return null;
+            // }
         } else if (eventType == ENTITY_REF) {
             return text;
         }
@@ -654,24 +762,52 @@ public class MXParser implements XmlPullParser {
             holderForStartAndLength[1] = posEnd - posStart;
             return buf;
         } else if (eventType == START_DOCUMENT || eventType == END_DOCUMENT) {
+            // throw new XmlPullParserException("no content available to read");
             holderForStartAndLength[0] = holderForStartAndLength[1] = -1;
             return null;
         } else {
             throw new IllegalArgumentException("unknown text eventType: " + eventType);
         }
+        // String s = getText();
+        // char[] cb = null;
+        // if(s!= null) {
+        // cb = s.toCharArray();
+        // holderForStartAndLength[0] = 0;
+        // holderForStartAndLength[1] = s.length();
+        // } else {
+        // }
+        // return cb;
     }
 
     public String getNamespace() {
         if (eventType == START_TAG) {
+            // return processNamespaces ? elUri[ depth - 1 ] : NO_NAMESPACE;
             return processNamespaces ? elUri[depth] : NO_NAMESPACE;
         } else if (eventType == END_TAG) {
             return processNamespaces ? elUri[depth] : NO_NAMESPACE;
         }
         return null;
+        // String prefix = elPrefix[ maxDepth ];
+        // if(prefix != null) {
+        // for( int i = namespaceEnd -1; i >= 0; i--) {
+        // if( prefix.equals( namespacePrefix[ i ] ) ) {
+        // return namespaceUri[ i ];
+        // }
+        // }
+        // } else {
+        // for( int i = namespaceEnd -1; i >= 0; i--) {
+        // if( namespacePrefix[ i ] == null ) {
+        // return namespaceUri[ i ];
+        // }
+        // }
+        //
+        // }
+        // return "";
     }
 
     public String getName() {
         if (eventType == START_TAG) {
+            // return elName[ depth - 1 ] ;
             return elName[depth];
         } else if (eventType == END_TAG) {
             return elName[depth];
@@ -692,11 +828,15 @@ public class MXParser implements XmlPullParser {
 
     public String getPrefix() {
         if (eventType == START_TAG) {
+            // return elPrefix[ depth - 1 ] ;
             return elPrefix[depth];
         } else if (eventType == END_TAG) {
             return elPrefix[depth];
         }
         return null;
+        // if(eventType != START_TAG && eventType != END_TAG) return null;
+        // int maxDepth = eventType == END_TAG ? depth : depth - 1;
+        // return elPrefix[ maxDepth ];
     }
 
     public boolean isEmptyElementTag() throws XmlPullParserException {
@@ -769,6 +909,7 @@ public class MXParser implements XmlPullParser {
         if (name == null) {
             throw new IllegalArgumentException("attribute name can not be null");
         }
+        // TODO make check if namespace is interned!!! etc. for names!!!
         if (processNamespaces) {
             if (namespace == null) {
                 namespace = "";
@@ -776,6 +917,9 @@ public class MXParser implements XmlPullParser {
 
             for (int i = 0; i < attributeCount; ++i) {
                 if ((namespace == attributeUri[i] || namespace.equals(attributeUri[i]))
+                        // (namespace != null && namespace.equals(attributeUri[ i
+                        // ]))
+                        // taking advantage of String.intern()
                         && name.equals(attributeName[i])) {
                     return attributeValue[i];
                 }
@@ -824,6 +968,10 @@ public class MXParser implements XmlPullParser {
         }
     }
 
+    /**
+     * Skip sub tree that is currently parser positioned on. <br>
+     * NOTE: parser must be on START_TAG and when function returns parser will be positioned on corresponding END_TAG
+     */
     public void skipSubTree() throws XmlPullParserException, IOException {
         require(START_TAG, null, null);
         int level = 1;
@@ -837,7 +985,35 @@ public class MXParser implements XmlPullParser {
         }
     }
 
+    // public String readText() throws XmlPullParserException, IOException
+    // {
+    // if (getEventType() != TEXT) return "";
+    // String result = getText();
+    // next();
+    // return result;
+    // }
+
     public String nextText() throws XmlPullParserException, IOException {
+        // String result = null;
+        // boolean onStartTag = false;
+        // if(eventType == START_TAG) {
+        // onStartTag = true;
+        // next();
+        // }
+        // if(eventType == TEXT) {
+        // result = getText();
+        // next();
+        // } else if(onStartTag && eventType == END_TAG) {
+        // result = "";
+        // } else {
+        // throw new XmlPullParserException(
+        // "parser must be on START_TAG or TEXT to read text", this, null);
+        // }
+        // if(eventType != END_TAG) {
+        // throw new XmlPullParserException(
+        // "event TEXT it must be immediately followed by END_TAG", this, null);
+        // }
+        // return result;
         if (getEventType() != START_TAG) {
             throw new XmlPullParserException("parser must be on START_TAG to read next text", this, null);
         }
@@ -894,6 +1070,7 @@ public class MXParser implements XmlPullParser {
             return eventType = END_TAG;
         }
 
+        // [1] document ::= prolog element Misc*
         if (depth > 0) {
 
             if (seenStartTag) {
@@ -905,6 +1082,9 @@ public class MXParser implements XmlPullParser {
                 return eventType = parseEndTag();
             }
 
+            // ASSUMPTION: we are _on_ first character of content or markup!!!!
+            // [43] content ::= CharData? ((element | Reference | CDSect | PI |
+            // Comment) CharData?)*
             char ch;
             if (seenMarkup) { // we have read ahead ...
                 seenMarkup = false;
@@ -915,15 +1095,22 @@ public class MXParser implements XmlPullParser {
             } else {
                 ch = more();
             }
-            posStart = pos - 1;
+            posStart = pos - 1; // VERY IMPORTANT: this is correct start of
+                               // event!!!
 
+            // when true there is some potential event TEXT to return - keep
+            // gathering
             boolean hadCharData = false;
 
+            // when true TEXT data is not continual (like <![CDATA[text]]>) and
+            // requires PC merging
             boolean needsMerging = false;
 
             MAIN_LOOP: while (true) {
+                // work on MARKUP
                 if (ch == '<') {
                     if (hadCharData) {
+                        // posEnd = pos - 1;
                         if (tokenize) {
                             seenMarkup = true;
                             return eventType = TEXT;
@@ -933,12 +1120,15 @@ public class MXParser implements XmlPullParser {
                     if (ch == '/') {
                         if (!tokenize && hadCharData) {
                             seenEndTag = true;
+                            // posEnd = pos - 2;
                             return eventType = TEXT;
                         }
                         return eventType = parseEndTag();
                     } else if (ch == '!') {
                         ch = more();
                         if (ch == '-') {
+                            // note: if(tokenize == false) posStart/End is NOT
+                            // changed!!!!
                             parseComment();
                             if (tokenize)
                                 return eventType = COMMENT;
@@ -948,6 +1138,11 @@ public class MXParser implements XmlPullParser {
                                 posStart = pos; // completely ignore comment
                             }
                         } else if (ch == '[') {
+                            // posEnd = pos - 3;
+                            // must remember previous posStart/End as it merges
+                            // with content of CDATA
+                            // int oldStart = posStart + bufAbsoluteStart;
+                            // int oldEnd = posEnd + bufAbsoluteStart;
                             parseCDSect(hadCharData);
                             if (tokenize)
                                 return eventType = CDSECT;
@@ -955,12 +1150,54 @@ public class MXParser implements XmlPullParser {
                             final int cdEnd = posEnd;
                             final int cdLen = cdEnd - cdStart;
 
-                            if (cdLen > 0) {
+                            if (cdLen > 0) { // was there anything inside CDATA
+                                            // section?
                                 hadCharData = true;
                                 if (!usePC) {
                                     needsMerging = true;
                                 }
                             }
+
+                            // posStart = oldStart;
+                            // posEnd = oldEnd;
+                            // if(cdLen > 0) { // was there anything inside
+                            // CDATA section?
+                            // if(hadCharData) {
+                            // // do merging if there was anything in CDSect!!!!
+                            // // if(!usePC) {
+                            // // // posEnd is correct already!!!
+                            // // if(posEnd > posStart) {
+                            // // joinPC();
+                            // // } else {
+                            // // usePC = true;
+                            // // pcStart = pcEnd = 0;
+                            // // }
+                            // // }
+                            // // if(pcEnd + cdLen >= pc.length) ensurePC(pcEnd
+                            // + cdLen);
+                            // // // copy [cdStart..cdEnd) into PC
+                            // // System.arraycopy(buf, cdStart, pc, pcEnd,
+                            // cdLen);
+                            // // pcEnd += cdLen;
+                            // if(!usePC) {
+                            // needsMerging = true;
+                            // posStart = cdStart;
+                            // posEnd = cdEnd;
+                            // }
+                            // } else {
+                            // if(!usePC) {
+                            // needsMerging = true;
+                            // posStart = cdStart;
+                            // posEnd = cdEnd;
+                            // hadCharData = true;
+                            // }
+                            // }
+                            // //hadCharData = true;
+                            // } else {
+                            // if( !usePC && hadCharData ) {
+                            // needsMerging = true;
+                            // }
+                            // }
                         } else {
                             throw new XmlPullParserException("unexpected character in markup " + printable(ch), this, null);
                         }
@@ -977,13 +1214,18 @@ public class MXParser implements XmlPullParser {
                     } else if (isNameStartChar(ch)) {
                         if (!tokenize && hadCharData) {
                             seenStartTag = true;
+                            // posEnd = pos - 2;
                             return eventType = TEXT;
                         }
                         return eventType = parseStartTag();
                     } else {
                         throw new XmlPullParserException("unexpected character in markup " + printable(ch), this, null);
                     }
+                    // do content compaction if it makes sense!!!!
+
                 } else if (ch == '&') {
+                    // work on ENTITTY
+                    // posEnd = pos - 1;
                     if (tokenize && hadCharData) {
                         seenAmpersand = true;
                         return eventType = TEXT;
@@ -993,6 +1235,7 @@ public class MXParser implements XmlPullParser {
                     final char[] resolvedEntity = parseEntityRef();
                     if (tokenize)
                         return eventType = ENTITY_REF;
+                    // check if replacement text can be resolved !!!
                     if (resolvedEntity == null) {
                         if (entityRefName == null) {
                             entityRefName = newString(buf, posStart, posEnd - posStart);
@@ -1000,6 +1243,8 @@ public class MXParser implements XmlPullParser {
                         throw new XmlPullParserException(
                                 "could not resolve entity named '" + printable(entityRefName) + "'", this, null);
                     }
+                    // int entStart = posStart;
+                    // int entEnd = posEnd;
                     posStart = oldStart - bufAbsoluteStart;
                     posEnd = oldEnd - bufAbsoluteStart;
                     if (!usePC) {
@@ -1011,6 +1256,9 @@ public class MXParser implements XmlPullParser {
                             pcStart = pcEnd = 0;
                         }
                     }
+                    // assert usePC == true;
+                    // write into PC replacement text - do merge for replacement
+                    // text!!!!
                     for (int i = 0; i < resolvedEntity.length; i++) {
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
@@ -1018,21 +1266,30 @@ public class MXParser implements XmlPullParser {
 
                     }
                     hadCharData = true;
+                    // assert needsMerging == false;
                 } else {
 
                     if (needsMerging) {
-                        joinPC();
+                        // assert usePC == false;
+                        joinPC(); // posEnd is already set correctly!!!
+                        // posStart = pos - 1;
                         needsMerging = false;
                     }
 
+                    // no MARKUP not ENTITIES so work on character data ...
+
+                    // [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
+
                     hadCharData = true;
 
                     boolean normalizedCR = false;
                     final boolean normalizeInput = !tokenize || !roundtripSupported;
+                    // use loop locality here!!!!
                     boolean seenBracket = false;
                     boolean seenBracketBracket = false;
                     do {
 
+                        // check that ]]> does not show in
                         if (ch == ']') {
                             if (seenBracket) {
                                 seenBracketBracket = true;
@@ -1045,11 +1302,14 @@ public class MXParser implements XmlPullParser {
                             if (seenBracket) {
                                 seenBracketBracket = seenBracket = false;
                             }
+                            // assert seenTwoBrackets == seenBracket == false;
                         }
                         if (normalizeInput) {
+                            // deal with normalization issues ...
                             if (ch == '\r') {
                                 normalizedCR = true;
                                 posEnd = pos - 1;
+                                // posEnd is already is set
                                 if (!usePC) {
                                     if (posEnd > posStart) {
                                         joinPC();
@@ -1058,10 +1318,13 @@ public class MXParser implements XmlPullParser {
                                         pcStart = pcEnd = 0;
                                     }
                                 }
+                                // assert usePC == true;
                                 if (pcEnd >= pc.length)
                                     ensurePC(pcEnd);
                                 pc[pcEnd++] = '\n';
                             } else if (ch == '\n') {
+                                // if(!usePC) { joinPC(); } else { if(pcEnd >=
+                                // pc.length) ensurePC(); }
                                 if (!normalizedCR && usePC) {
                                     if (pcEnd >= pc.length)
                                         ensurePC(pcEnd);
@@ -1081,10 +1344,11 @@ public class MXParser implements XmlPullParser {
                         ch = more();
                     } while (ch != '<' && ch != '&');
                     posEnd = pos - 1;
-                    continue MAIN_LOOP;
+                    continue MAIN_LOOP; // skip ch = more() from below - we are
+                                       // alreayd ahead ...
                 }
                 ch = more();
-            }
+            } // endless while(true)
         } else {
             if (seenRoot) {
                 return parseEpilog();
@@ -1095,6 +1359,9 @@ public class MXParser implements XmlPullParser {
     }
 
     protected int parseProlog() throws XmlPullParserException, IOException {
+        // [2] prolog: ::= XMLDecl? Misc* (doctypedecl Misc*)? and look for [39]
+        // element
+
         char ch;
         if (seenMarkup) {
             ch = buf[pos - 1];
@@ -1103,12 +1370,16 @@ public class MXParser implements XmlPullParser {
         }
 
         if (eventType == START_DOCUMENT) {
+            // bootstrap parsing with getting first character input!
+            // deal with BOM
+            // detect BOM and drop it (Unicode int Order Mark)
             if (ch == '\uFFFE') {
                 throw new XmlPullParserException(
                         "first character in input was UNICODE noncharacter (0xFFFE)" + "- input requires int swapping", this,
                         null);
             }
             if (ch == '\uFEFF') {
+                // skipping UNICODE int Order Mark (so called BOM)
                 ch = more();
             }
         }
@@ -1118,6 +1389,10 @@ public class MXParser implements XmlPullParser {
         final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
         while (true) {
+            // deal with Misc
+            // [27] Misc ::= Comment | PI | S
+            // deal with docdecl --> mark it!
+            // else parseStartTag seen <[^/]
             if (ch == '<') {
                 if (gotS && tokenize) {
                     posEnd = pos - 1;
@@ -1126,11 +1401,14 @@ public class MXParser implements XmlPullParser {
                 }
                 ch = more();
                 if (ch == '?') {
-                    if (parsePI()) {
+                    // check if it is 'xml'
+                    // deal with XMLDecl
+                    if (parsePI()) { // make sure to skip XMLDecl
                         if (tokenize) {
                             return eventType = PROCESSING_INSTRUCTION;
                         }
                     } else {
+                        // skip over - continue tokenizing
                         posStart = pos;
                         gotS = false;
                     }
@@ -1165,6 +1443,9 @@ public class MXParser implements XmlPullParser {
                 if (normalizeIgnorableWS) {
                     if (ch == '\r') {
                         normalizedCR = true;
+                        // posEnd = pos -1;
+                        // joinPC();
+                        // posEnd is already is set
                         if (!usePC) {
                             posEnd = pos - 1;
                             if (posEnd > posStart) {
@@ -1174,6 +1455,7 @@ public class MXParser implements XmlPullParser {
                                 pcStart = pcEnd = 0;
                             }
                         }
+                        // assert usePC == true;
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
                         pc[pcEnd++] = '\n';
@@ -1212,6 +1494,7 @@ public class MXParser implements XmlPullParser {
         final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
         try {
+            // epilog: Misc*
             char ch;
             if (seenMarkup) {
                 ch = buf[pos - 1];
@@ -1222,6 +1505,8 @@ public class MXParser implements XmlPullParser {
             posStart = pos - 1;
             if (!reachedEnd) {
                 while (true) {
+                    // deal with Misc
+                    // [27] Misc ::= Comment | PI | S
                     if (ch == '<') {
                         if (gotS && tokenize) {
                             posEnd = pos - 1;
@@ -1233,6 +1518,8 @@ public class MXParser implements XmlPullParser {
                             break;
                         }
                         if (ch == '?') {
+                            // check if it is 'xml'
+                            // deal with XMLDecl
                             parsePI();
                             if (tokenize)
                                 return eventType = PROCESSING_INSTRUCTION;
@@ -1268,6 +1555,9 @@ public class MXParser implements XmlPullParser {
                         if (normalizeIgnorableWS) {
                             if (ch == '\r') {
                                 normalizedCR = true;
+                                // posEnd = pos -1;
+                                // joinPC();
+                                // posEnd is alreadys set
                                 if (!usePC) {
                                     posEnd = pos - 1;
                                     if (posEnd > posStart) {
@@ -1277,6 +1567,7 @@ public class MXParser implements XmlPullParser {
                                         pcStart = pcEnd = 0;
                                     }
                                 }
+                                // assert usePC == true;
                                 if (pcEnd >= pc.length)
                                     ensurePC(pcEnd);
                                 pc[pcEnd++] = '\n';
@@ -1308,6 +1599,9 @@ public class MXParser implements XmlPullParser {
                 }
             }
 
+            // throw Exception("unexpected content in epilog
+            // catch EOFException return END_DOCUEMENT
+            // try {
         } catch (EOFException ex) {
             reachedEnd = true;
         }
@@ -1319,6 +1613,8 @@ public class MXParser implements XmlPullParser {
     }
 
     public int parseEndTag() throws XmlPullParserException, IOException {
+        // ASSUMPTION ch is past "</"
+        // [42] ETag ::= '</' Name S? '>'
         char ch = more();
         if (!isNameStartChar(ch)) {
             throw new XmlPullParserException("expected name start and not " + printable(ch), this, null);
@@ -1329,10 +1625,19 @@ public class MXParser implements XmlPullParser {
             ch = more();
         } while (isNameChar(ch));
 
+        // now we go one level down -- do checks
+        // --depth; //FIXME
+
+        // check that end tag name is the same as start tag
+        // String name = new String(buf, nameStart - bufAbsoluteStart,
+        // (pos - 1) - (nameStart - bufAbsoluteStart));
+        // int last = pos - 1;
         int off = nameStart - bufAbsoluteStart;
+        // final int len = last - off;
         final int len = (pos - 1) - off;
         final char[] cbuf = elRawName[depth];
         if (elRawNameEnd[depth] != len) {
+            // construct strings for exception
             final String startname = new String(cbuf, 0, elRawNameEnd[depth]);
             final String endname = new String(buf, off, len);
             throw new XmlPullParserException(
@@ -1342,6 +1647,7 @@ public class MXParser implements XmlPullParser {
         }
         for (int i = 0; i < len; i++) {
             if (buf[off++] != cbuf[i]) {
+                // construct strings for exception
                 final String startname = new String(cbuf, 0, len);
                 final String endname = new String(buf, off - i - 1, len);
                 throw new XmlPullParserException(
@@ -1360,20 +1666,27 @@ public class MXParser implements XmlPullParser {
                     "expected > to finish end tag not " + printable(ch) + " from line " + elRawNameLine[depth], this, null);
         }
 
+        // namespaceEnd = elNamespaceCount[ depth ]; //FIXME
+
         posEnd = pos;
         pastEndTag = true;
         return eventType = END_TAG;
     }
 
     public int parseStartTag() throws XmlPullParserException, IOException {
+        // remember starting line number
         startLineNumber = lineNumber;
 
+        // ASSUMPTION ch is past <T
+        // [40] STag ::= '<' Name (S Attribute)* S? '>'
+        // [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
         ++depth; // FIXME
 
         posStart = pos - 2;
 
         emptyElementTag = false;
         attributeCount = 0;
+        // retrieve name
         final int nameStart = pos - 1 + bufAbsoluteStart;
         int colonPos = -1;
         char ch = buf[pos - 1];
@@ -1392,8 +1705,11 @@ public class MXParser implements XmlPullParser {
             }
         }
 
+        // retrieve name
         ensureElementsCapacity();
 
+        // TODO check for efficient interning and then use elRawNameInterned!!!!
+
         int elLen = (pos - 1) - (nameStart - bufAbsoluteStart);
         if (elRawName[depth] == null || elRawName[depth].length < elLen) {
             elRawName[depth] = new char[2 * elLen];
@@ -1402,11 +1718,13 @@ public class MXParser implements XmlPullParser {
         elRawNameEnd[depth] = elLen;
         elRawNameLine[depth] = lineNumber;
 
+        // work on prefixes and namespace URI
         String prefix = null;
         if (processNamespaces) {
             if (colonPos != -1) {
                 prefix = elPrefix[depth] = newString(buf, nameStart - bufAbsoluteStart, colonPos - nameStart);
                 elName[depth] = newString(buf, colonPos + 1 - bufAbsoluteStart,
+                        // (pos -1) - (colonPos + 1));
                         pos - 2 - (colonPos - bufAbsoluteStart));
             } else {
                 elPrefix[depth] = null;
@@ -1439,8 +1757,10 @@ public class MXParser implements XmlPullParser {
             } else {
                 throw new XmlPullParserException("start tag unexpected character " + printable(ch), this, null);
             }
+            // ch = more(); // skip space
         }
 
+        // now when namespaces were declared we can resolve them
         if (processNamespaces) {
             String uri = getNamespace(prefix);
             if (uri == null) {
@@ -1455,6 +1775,12 @@ public class MXParser implements XmlPullParser {
             }
             elUri[depth] = uri;
 
+            // String uri = getNamespace(prefix);
+            // if(uri == null && prefix == null) { // no prefix and no uri =>
+            // use default namespace
+            // uri = "";
+            // }
+            // resolve attribute namespaces
             for (int i = 0; i < attributeCount; i++) {
                 final String attrPrefix = attributePrefix[i];
                 if (attrPrefix != null) {
@@ -1470,6 +1796,11 @@ public class MXParser implements XmlPullParser {
                 }
             }
 
+            // TODO
+            // [ WFC: Unique Att Spec ]
+            // check attribute uniqueness constraint for attributes that has
+            // namespace!!!
+
             for (int i = 1; i < attributeCount; i++) {
                 for (int j = 0; j < i; j++) {
                     if (attributeUri[j] == attributeUri[i]
@@ -1478,6 +1809,7 @@ public class MXParser implements XmlPullParser {
                                             && attributeName[j].equals(attributeName[i])))
 
                     ) {
+                        // prepare data for nice error message?
                         String attr1 = attributeName[j];
                         if (attributeUri[j] != null)
                             attr1 = attributeUri[j] + ":" + attr1;
@@ -1491,6 +1823,8 @@ public class MXParser implements XmlPullParser {
 
         } else { // ! processNamespaces
 
+            // [ WFC: Unique Att Spec ]
+            // check raw attribute uniqueness constraint!!!
             for (int i = 1; i < attributeCount; i++) {
                 for (int j = 0; j < i; j++) {
                     if ((allStringsInterned && attributeName[j].equals(attributeName[i])
@@ -1498,6 +1832,7 @@ public class MXParser implements XmlPullParser {
                                     && attributeName[j].equals(attributeName[i])))
 
                     ) {
+                        // prepare data for nice error message?
                         final String attr1 = attributeName[j];
                         final String attr2 = attributeName[i];
                         throw new XmlPullParserException("duplicated attributes " + attr1 + " and " + attr2, this, null);
@@ -1512,6 +1847,10 @@ public class MXParser implements XmlPullParser {
     }
 
     protected char parseAttribute() throws XmlPullParserException, IOException {
+        // parse attribute
+        // [41] Attribute ::= Name Eq AttValue
+        // [WFC: No External Entity References]
+        // [WFC: No < in Attribute Values]
         final int prevPosStart = posStart + bufAbsoluteStart;
         final int nameStart = pos - 1 + bufAbsoluteStart;
         int colonPos = -1;
@@ -1544,6 +1883,7 @@ public class MXParser implements XmlPullParser {
                         if (ch != ':')
                             throw new XmlPullParserException(
                                     "after xmlns in attribute name must be colon" + " when namespaces are enabled", this, null);
+                        // colonPos = pos - 1 + bufAbsoluteStart;
                     }
                 }
                 if (ch == ':') {
@@ -1558,26 +1898,35 @@ public class MXParser implements XmlPullParser {
 
         ensureAttributesCapacity(attributeCount);
 
+        // --- start processing attributes
         String name = null;
         String prefix = null;
+        // work on prefixes and namespace URI
         if (processNamespaces) {
             if (xmlnsPos < 4)
                 startsWithXmlns = false;
             if (startsWithXmlns) {
                 if (colonPos != -1) {
+                    // prefix = attributePrefix[ attributeCount ] = null;
                     final int nameLen = pos - 2 - (colonPos - bufAbsoluteStart);
                     if (nameLen == 0) {
                         throw new XmlPullParserException(
                                 "namespace prefix is required after xmlns: " + " when namespaces are enabled", this, null);
                     }
-                    name = newString(buf, colonPos - bufAbsoluteStart + 1, nameLen);
+                    name = // attributeName[ attributeCount ] =
+                            newString(buf, colonPos - bufAbsoluteStart + 1, nameLen);
+                    // pos - 1 - (colonPos + 1 - bufAbsoluteStart)
                 }
             } else {
                 if (colonPos != -1) {
                     int prefixLen = colonPos - nameStart;
                     prefix = attributePrefix[attributeCount] = newString(buf, nameStart - bufAbsoluteStart, prefixLen);
+                    // colonPos - (nameStart - bufAbsoluteStart));
                     int nameLen = pos - 2 - (colonPos - bufAbsoluteStart);
                     name = attributeName[attributeCount] = newString(buf, colonPos - bufAbsoluteStart + 1, nameLen);
+                    // pos - 1 - (colonPos + 1 - bufAbsoluteStart));
+
+                    // name.substring(0, colonPos-nameStart);
                 } else {
                     prefix = attributePrefix[attributeCount] = null;
                     name = attributeName[attributeCount]
@@ -1589,27 +1938,35 @@ public class MXParser implements XmlPullParser {
             }
 
         } else {
+            // retrieve name
             name = attributeName[attributeCount]
                     = newString(buf, nameStart - bufAbsoluteStart, pos - 1 - (nameStart - bufAbsoluteStart));
+            //// assert name != null;
             if (!allStringsInterned) {
                 attributeNameHash[attributeCount] = name.hashCode();
             }
         }
 
+        // [25] Eq ::= S? '=' S?
         while (isS(ch)) {
             ch = more();
-        }
+        } // skip additional spaces
         if (ch != '=')
             throw new XmlPullParserException("expected = after attribute name", this, null);
         ch = more();
         while (isS(ch)) {
             ch = more();
-        }
+        } // skip additional spaces
 
+        // [10] AttValue ::= '"' ([^<&"] | Reference)* '"'
+        // | "'" ([^<&'] | Reference)* "'"
         final char delimit = ch;
         if (delimit != '"' && delimit != '\'')
             throw new XmlPullParserException(
                     "attribute value must start with quotation or apostrophe not " + printable(delimit), this, null);
+        // parse until delimit or < and resolve Reference
+        // [67] Reference ::= EntityRef | CharRef
+        // int valueStart = pos + bufAbsoluteStart;
 
         boolean normalizedCR = false;
         usePC = false;
@@ -1625,18 +1982,22 @@ public class MXParser implements XmlPullParser {
                 throw new XmlPullParserException("markup not allowed inside attribute value - illegal < ", this, null);
             }
             if (ch == '&') {
+                // extractEntityRef
                 posEnd = pos - 1;
                 if (!usePC) {
                     final boolean hadCharData = posEnd > posStart;
                     if (hadCharData) {
+                        // posEnd is already set correctly!!!
                         joinPC();
                     } else {
                         usePC = true;
                         pcStart = pcEnd = 0;
                     }
                 }
+                // assert usePC == true;
 
                 final char[] resolvedEntity = parseEntityRef();
+                // check if replacement text can be resolved !!!
                 if (resolvedEntity == null) {
                     if (entityRefName == null) {
                         entityRefName = newString(buf, posStart, posEnd - posStart);
@@ -1644,12 +2005,18 @@ public class MXParser implements XmlPullParser {
                     throw new XmlPullParserException(
                             "could not resolve entity named '" + printable(entityRefName) + "'", this, null);
                 }
+                // write into PC replacement text - do merge for replacement
+                // text!!!!
                 for (int i = 0; i < resolvedEntity.length; i++) {
                     if (pcEnd >= pc.length)
                         ensurePC(pcEnd);
                     pc[pcEnd++] = resolvedEntity[i];
                 }
             } else if (ch == '\t' || ch == '\n' || ch == '\r') {
+                // do attribute value normalization
+                // as described in http://www.w3.org/TR/REC-xml#AVNormalize
+                // TODO add test for it form spec ...
+                // handle EOL normalization ...
                 if (!usePC) {
                     posEnd = pos - 1;
                     if (posEnd > posStart) {
@@ -1659,6 +2026,7 @@ public class MXParser implements XmlPullParser {
                         pcEnd = pcStart = 0;
                     }
                 }
+                // assert usePC == true;
                 if (pcEnd >= pc.length)
                     ensurePC(pcEnd);
                 if (ch != '\n' || !normalizedCR) {
@@ -1689,18 +2057,22 @@ public class MXParser implements XmlPullParser {
                     throw new XmlPullParserException(
                             "non-default namespace can not be declared to be empty string", this, null);
                 }
+                // declare new namespace
                 namespacePrefix[namespaceEnd] = name;
                 if (!allStringsInterned) {
                     prefixHash = namespacePrefixHash[namespaceEnd] = name.hashCode();
                 }
             } else {
-                namespacePrefix[namespaceEnd] = null;
+                // declare new default namespace ...
+                namespacePrefix[namespaceEnd] = null; // ""; //null; //TODO
+                                                     // check FIXME Alek
                 if (!allStringsInterned) {
                     prefixHash = namespacePrefixHash[namespaceEnd] = -1;
                 }
             }
             namespaceUri[namespaceEnd] = ns;
 
+            // detect duplicate namespace declarations!!!
             final int startNs = elNamespaceCount[depth - 1];
             for (int i = namespaceEnd - 1; i >= startNs; --i) {
                 if (((allStringsInterned || name == null) && namespacePrefix[i] == name)
@@ -1728,13 +2100,20 @@ public class MXParser implements XmlPullParser {
     protected char[] charRefOneCharBuf = new char[1];
 
     protected char[] parseEntityRef() throws XmlPullParserException, IOException {
+        // entity reference
+        // http://www.w3.org/TR/2000/REC-xml-20001006#NT-Reference
+        // [67] Reference ::= EntityRef | CharRef
+
+        // ASSUMPTION just after &
         entityRefName = null;
         posStart = pos;
         char ch = more();
         if (ch == '#') {
+            // parse character reference
             char charRef = 0;
             ch = more();
             if (ch == 'x') {
+                // encoded in hex
                 while (true) {
                     ch = more();
                     if (ch >= '0' && ch <= '9') {
@@ -1751,6 +2130,7 @@ public class MXParser implements XmlPullParser {
                     }
                 }
             } else {
+                // encoded in decimal
                 while (true) {
                     if (ch >= '0' && ch <= '9') {
                         charRef = (char) (charRef * 10 + (ch - '0'));
@@ -1770,6 +2150,8 @@ public class MXParser implements XmlPullParser {
             }
             return charRefOneCharBuf;
         } else {
+            // [68] EntityRef ::= '&' Name ';'
+            // scan name until ;
             if (!isNameStartChar(ch)) {
                 throw new XmlPullParserException(
                         "entity reference names can not start with character '" + printable(ch) + "'", this, null);
@@ -1785,6 +2167,7 @@ public class MXParser implements XmlPullParser {
                 }
             }
             posEnd = pos - 1;
+            // determine what name maps to
             final int len = posEnd - posStart;
             if (len == 2 && buf[posStart] == 'l' && buf[posStart + 1] == 't') {
                 if (tokenize) {
@@ -1792,6 +2175,10 @@ public class MXParser implements XmlPullParser {
                 }
                 charRefOneCharBuf[0] = '<';
                 return charRefOneCharBuf;
+                // if(paramPC || isParserTokenizing) {
+                // if(pcEnd >= pc.length) ensurePC();
+                // pc[pcEnd++] = '<';
+                // }
             } else if (len == 3 && buf[posStart] == 'a' && buf[posStart + 1] == 'm' && buf[posStart + 2] == 'p') {
                 if (tokenize) {
                     text = "&";
@@ -1848,6 +2235,7 @@ public class MXParser implements XmlPullParser {
         } else {
             entityRefName = newString(buf, posStart, posEnd - posStart);
             for (int i = entityEnd - 1; i >= 0; --i) {
+                // take advantage that interning for newStirng is enforced
                 if (entityRefName == entityName[i]) {
                     if (tokenize)
                         text = entityReplacement[i];
@@ -1859,6 +2247,9 @@ public class MXParser implements XmlPullParser {
     }
 
     protected void parseComment() throws XmlPullParserException, IOException {
+        // implements XML 1.0 Section 2.5 Comments
+
+        // ASSUMPTION: seen <!-
         char ch = more();
         if (ch != '-')
             throw new XmlPullParserException("expected <!-- for comment start", this, null);
@@ -1874,6 +2265,7 @@ public class MXParser implements XmlPullParser {
             boolean seenDash = false;
             boolean seenDashDash = false;
             while (true) {
+                // scan until it hits -->
                 ch = more();
                 if (seenDashDash && ch != '>') {
                     throw new XmlPullParserException(
@@ -1899,6 +2291,9 @@ public class MXParser implements XmlPullParser {
                 if (normalizeIgnorableWS) {
                     if (ch == '\r') {
                         normalizedCR = true;
+                        // posEnd = pos -1;
+                        // joinPC();
+                        // posEnd is already set
                         if (!usePC) {
                             posEnd = pos - 1;
                             if (posEnd > posStart) {
@@ -1908,6 +2303,7 @@ public class MXParser implements XmlPullParser {
                                 pcStart = pcEnd = 0;
                             }
                         }
+                        // assert usePC == true;
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
                         pc[pcEnd++] = '\n';
@@ -1930,6 +2326,7 @@ public class MXParser implements XmlPullParser {
             }
 
         } catch (EOFException ex) {
+            // detect EOF and create meaningful error ...
             throw new XmlPullParserException(
                     "comment started on line " + curLine + " and column " + curColumn + " was not closed", this, ex);
         }
@@ -1942,6 +2339,11 @@ public class MXParser implements XmlPullParser {
     }
 
     protected boolean parsePI() throws XmlPullParserException, IOException {
+        // implements XML 1.0 Section 2.6 Processing Instructions
+
+        // [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
+        // [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
+        // ASSUMPTION: seen <?
         if (tokenize)
             posStart = pos;
         final int curLine = lineNumber;
@@ -1959,6 +2361,9 @@ public class MXParser implements XmlPullParser {
                         "processing instruction PITarget must be exactly after <? and not white space character", this, null);
             }
             while (true) {
+                // scan until it hits ?>
+                // ch = more();
+
                 if (ch == '?') {
                     seenQ = true;
                 } else if (ch == '>') {
@@ -1970,11 +2375,15 @@ public class MXParser implements XmlPullParser {
                     if (piTargetEnd == -1 && isS(ch)) {
                         piTargetEnd = pos - 1 + bufAbsoluteStart;
 
+                        // [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm')
+                        // ('L' | 'l'))
                         if ((piTargetEnd - piTargetStart) == 3) {
                             if ((buf[piTargetStart] == 'x' || buf[piTargetStart] == 'X')
                                     && (buf[piTargetStart + 1] == 'm' || buf[piTargetStart + 1] == 'M')
                                     && (buf[piTargetStart + 2] == 'l' || buf[piTargetStart + 2] == 'L')) {
-                                if (piTargetStart > 3) {
+                                if (piTargetStart > 3) { // <?xml is allowed as
+                                                        // first characters in
+                                                        // input ...
                                     throw new XmlPullParserException(
                                             "processing instruction can not have PITarget with reserveld xml name", this, null);
                                 } else {
@@ -1998,6 +2407,9 @@ public class MXParser implements XmlPullParser {
                 if (normalizeIgnorableWS) {
                     if (ch == '\r') {
                         normalizedCR = true;
+                        // posEnd = pos -1;
+                        // joinPC();
+                        // posEnd is already set
                         if (!usePC) {
                             posEnd = pos - 1;
                             if (posEnd > posStart) {
@@ -2007,6 +2419,7 @@ public class MXParser implements XmlPullParser {
                                 pcStart = pcEnd = 0;
                             }
                         }
+                        // assert usePC == true;
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
                         pc[pcEnd++] = '\n';
@@ -2029,12 +2442,15 @@ public class MXParser implements XmlPullParser {
                 ch = more();
             }
         } catch (EOFException ex) {
+            // detect EOF and create meaningful error ...
             throw new XmlPullParserException(
                     "processing instruction started on line " + curLine + " and column " + curColumn + " was not closed", this,
                     ex);
         }
         if (piTargetEnd == -1) {
             piTargetEnd = pos - 2 + bufAbsoluteStart;
+            // throw new XmlPullParserException(
+            // "processing instruction must have PITarget name", this, null);
         }
         piTargetStart -= bufAbsoluteStart;
         piTargetEnd -= bufAbsoluteStart;
@@ -2047,6 +2463,13 @@ public class MXParser implements XmlPullParser {
         return true;
     }
 
+    // protected final static char[] VERSION = {'v','e','r','s','i','o','n'};
+    // protected final static char[] NCODING = {'n','c','o','d','i','n','g'};
+    // protected final static char[] TANDALONE =
+    // {'t','a','n','d','a','l','o','n','e'};
+    // protected final static char[] YES = {'y','e','s'};
+    // protected final static char[] NO = {'n','o'};
+
     protected static final char[] VERSION = "version".toCharArray();
     protected static final char[] NCODING = "ncoding".toCharArray();
     protected static final char[] TANDALONE = "tandalone".toCharArray();
@@ -2054,11 +2477,20 @@ public class MXParser implements XmlPullParser {
     protected static final char[] NO = "no".toCharArray();
 
     protected void parseXmlDecl(char ch) throws XmlPullParserException, IOException {
+        // [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
+
+        // first make sure that relative positions will stay OK
         preventBufferCompaction = true;
-        bufStart = 0;
+        bufStart = 0; // necessary to keep pos unchanged during expansion!
+
+        // --- parse VersionInfo
 
+        // [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"'
+        // VersionNum '"')
+        // parse is positioned just on first S past <?xml
         ch = skipS(ch);
         ch = requireInput(ch, VERSION);
+        // [25] Eq ::= S? '=' S?
         ch = skipS(ch);
         if (ch != '=') {
             throw new XmlPullParserException("expected equals sign (=) after version and not " + printable(ch), this, null);
@@ -2070,8 +2502,11 @@ public class MXParser implements XmlPullParser {
                     "expected apostrophe (') or quotation mark (\") after version and not " + printable(ch), this, null);
         }
         final char quotChar = ch;
+        // int versionStart = pos + bufAbsoluteStart; // required if
+        // preventBufferCompaction==false
         final int versionStart = pos;
         ch = more();
+        // [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+
         while (ch != quotChar) {
             if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') && (ch < '0' || ch > '9') && ch != '_' && ch != '.'
                     && ch != ':' && ch != '-') {
@@ -2082,10 +2517,13 @@ public class MXParser implements XmlPullParser {
         }
         final int versionEnd = pos - 1;
         parseXmlDeclWithVersion(versionStart, versionEnd);
-        preventBufferCompaction = false;
+        preventBufferCompaction = false; // alow again buffer commpaction - pos
+                                        // MAY chnage
     }
+    // protected String xmlDeclVersion;
 
     protected void parseXmlDeclWithVersion(int versionStart, int versionEnd) throws XmlPullParserException, IOException {
+        // check version is "1.0"
         if ((versionEnd - versionStart != 3) || buf[versionStart] != '1' || buf[versionStart + 1] != '.'
                 || buf[versionStart + 2] != '0') {
             throw new XmlPullParserException(
@@ -2096,6 +2534,8 @@ public class MXParser implements XmlPullParser {
         }
         xmlDeclVersion = newString(buf, versionStart, versionEnd - versionStart);
 
+        // [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName
+        // "'" )
         char ch = more();
         ch = skipS(ch);
         if (ch == 'e') {
@@ -2115,6 +2555,7 @@ public class MXParser implements XmlPullParser {
             final char quotChar = ch;
             final int encodingStart = pos;
             ch = more();
+            // [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
             if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z')) {
                 throw new XmlPullParserException(
                         "<?xml encoding name expected to start with [A-Za-z]" + " not " + printable(ch), this, null);
@@ -2131,11 +2572,14 @@ public class MXParser implements XmlPullParser {
             }
             final int encodingEnd = pos - 1;
 
+            // TODO reconcile with setInput encodingName
             inputEncoding = newString(buf, encodingStart, encodingEnd - encodingStart);
             ch = more();
         }
 
         ch = skipS(ch);
+        // [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"'
+        // ('yes' | 'no') '"'))
         if (ch == 's') {
             ch = more();
             ch = requireInput(ch, TANDALONE);
@@ -2155,9 +2599,11 @@ public class MXParser implements XmlPullParser {
             ch = more();
             if (ch == 'y') {
                 ch = requireInput(ch, YES);
+                // Boolean standalone = new Boolean(true);
                 xmlDeclStandalone = Boolean.TRUE;
             } else if (ch == 'n') {
                 ch = requireInput(ch, NO);
+                // Boolean standalone = new Boolean(false);
                 xmlDeclStandalone = Boolean.FALSE;
             } else {
                 throw new XmlPullParserException(
@@ -2178,9 +2624,29 @@ public class MXParser implements XmlPullParser {
         if (ch != '>') {
             throw new XmlPullParserException("expected ?> as last part of <?xml not " + printable(ch), this, null);
         }
+
+        // NOTE: this code is broken as for some types of input streams (URLConnection ...)
+        // it is not possible to do more than once new InputStreamReader(inputStream)
+        // as it somehow detects it and closes undelrying inout stram (b.....d!)
+        // In future one will need better low level byte-by-byte reading of prolog and then doing InputStream ...
+        // for more details see http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=135
+        // //reset input stream
+        //        if ((this.inputEncoding != oldEncoding) && (this.inputStream != null)) {
+        //            if ((this.inputEncoding != null) && (!this.inputEncoding.equalsIgnoreCase(oldEncoding))) {
+        //                //              //there is need to reparse input to set location OK
+        //                //              reset();
+        //                this.reader = new InputStreamReader(this.inputStream, this.inputEncoding);
+        //                //              //skip <?xml
+        //                //              for (int i = 0; i < 5; i++){
+        //                //                  ch=more();
+        //                //              }
+        //                //              parseXmlDecl(ch);
+        //            }
+        //        }
     }
 
     protected void parseDocdecl() throws XmlPullParserException, IOException {
+        // ASSUMPTION: seen <!D
         char ch = more();
         if (ch != 'O')
             throw new XmlPullParserException("expected <!DOCTYPE", this, null);
@@ -2200,7 +2666,10 @@ public class MXParser implements XmlPullParser {
         if (ch != 'E')
             throw new XmlPullParserException("expected <!DOCTYPE", this, null);
         posStart = pos;
+        // do simple and crude scanning for end of doctype
 
+        // [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('['
+        // (markupdecl | DeclSep)* ']' S?)? '>'
         int bracketLevel = 0;
         final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
@@ -2215,6 +2684,9 @@ public class MXParser implements XmlPullParser {
             if (normalizeIgnorableWS) {
                 if (ch == '\r') {
                     normalizedCR = true;
+                    // posEnd = pos -1;
+                    // joinPC();
+                    // posEnd is alreadys set
                     if (!usePC) {
                         posEnd = pos - 1;
                         if (posEnd > posStart) {
@@ -2224,6 +2696,7 @@ public class MXParser implements XmlPullParser {
                             pcStart = pcEnd = 0;
                         }
                     }
+                    // assert usePC == true;
                     if (pcEnd >= pc.length)
                         ensurePC(pcEnd);
                     pc[pcEnd++] = '\n';
@@ -2249,6 +2722,14 @@ public class MXParser implements XmlPullParser {
     }
 
     protected void parseCDSect(boolean hadCharData) throws XmlPullParserException, IOException {
+        // implements XML 1.0 Section 2.7 CDATA Sections
+
+        // [18] CDSect ::= CDStart CData CDEnd
+        // [19] CDStart ::= '<![CDATA['
+        // [20] CData ::= (Char* - (Char* ']]>' Char*))
+        // [21] CDEnd ::= ']]>'
+
+        // ASSUMPTION: seen <![
         char ch = more();
         if (ch != 'C')
             throw new XmlPullParserException("expected <[CDATA[ for comment start", this, null);
@@ -2268,6 +2749,7 @@ public class MXParser implements XmlPullParser {
         if (ch != '[')
             throw new XmlPullParserException("expected <![CDATA[ for comment start", this, null);
 
+        // if(tokenize) {
         final int cdStart = pos + bufAbsoluteStart;
         final int curLine = lineNumber;
         final int curColumn = columnNumber;
@@ -2276,6 +2758,7 @@ public class MXParser implements XmlPullParser {
             if (normalizeInput) {
                 if (hadCharData) {
                     if (!usePC) {
+                        // posEnd is correct already!!!
                         if (posEnd > posStart) {
                             joinPC();
                         } else {
@@ -2289,12 +2772,14 @@ public class MXParser implements XmlPullParser {
             boolean seenBracketBracket = false;
             boolean normalizedCR = false;
             while (true) {
+                // scan until it hits "]]>"
                 ch = more();
                 if (ch == ']') {
                     if (!seenBracket) {
                         seenBracket = true;
                     } else {
                         seenBracketBracket = true;
+                        // seenBracket = false;
                     }
                 } else if (ch == '>') {
                     if (seenBracket && seenBracketBracket) {
@@ -2309,10 +2794,11 @@ public class MXParser implements XmlPullParser {
                     }
                 }
                 if (normalizeInput) {
+                    // deal with normalization issues ...
                     if (ch == '\r') {
                         normalizedCR = true;
                         posStart = cdStart - bufAbsoluteStart;
-                        posEnd = pos - 1;
+                        posEnd = pos - 1; // posEnd is alreadys set
                         if (!usePC) {
                             if (posEnd > posStart) {
                                 joinPC();
@@ -2321,6 +2807,7 @@ public class MXParser implements XmlPullParser {
                                 pcStart = pcEnd = 0;
                             }
                         }
+                        // assert usePC == true;
                         if (pcEnd >= pc.length)
                             ensurePC(pcEnd);
                         pc[pcEnd++] = '\n';
@@ -2342,6 +2829,7 @@ public class MXParser implements XmlPullParser {
                 }
             }
         } catch (EOFException ex) {
+            // detect EOF and create meaningful error ...
             throw new XmlPullParserException(
                     "CDATA section started on line " + curLine + " and column " + curColumn + " was not closed", this, ex);
         }
@@ -2358,32 +2846,45 @@ public class MXParser implements XmlPullParser {
         if (reader == null)
             throw new XmlPullParserException("reader must be set before parsing is started");
 
+        // see if we are in compaction area
         if (bufEnd > bufSoftLimit) {
 
+            // expand buffer it makes sense!!!!
             boolean compact;
             if (preventBufferCompaction) {
                 compact = false;
             } else {
                 compact = bufStart > bufSoftLimit;
                 if (!compact) {
+                    // freeSpace
+                    // if at least half of buffer can be reclaimed --> worthwhile effort!!!
+                    // else less than half buffer available for compacting --> expand instead!!!
                     if (bufStart >= buf.length / 2) {
                         compact = true;
                     }
                 }
             }
 
+            // if buffer almost full then compact it
             if (compact) {
+                // TODO: look on trashing
+                // //assert bufStart > 0
                 System.arraycopy(buf, bufStart, buf, 0, bufEnd - bufStart);
-                LOG.trace("fillBuf() compacting {} bufEnd={} pos={} posStart={} posEnd={} buf first 100 chars:{}",
-                        bufStart, bufEnd, pos, posStart, posEnd, new String(buf, bufStart, Math.min(bufEnd - bufStart, 100)));
+                if (TRACE_SIZING)
+                    System.out.println("TRACE_SIZING fillBuf() compacting " + bufStart + " bufEnd=" + bufEnd + " pos=" + pos
+                                       + " posStart=" + posStart + " posEnd=" + posEnd
+                                       + " buf first 100 chars:"
+                                       + new String(buf, bufStart, Math.min(bufEnd - bufStart, 100)));
 
             } else {
                 final int newSize = 2 * buf.length;
                 final char[] newBuf = new char[newSize];
-                LOG.trace("fillBuf() {} => {}", buf.length, newSize);
+                if (TRACE_SIZING)
+                    System.out.println("TRACE_SIZING fillBuf() " + buf.length + " => " + newSize);
                 System.arraycopy(buf, bufStart, newBuf, 0, bufEnd - bufStart);
                 buf = newBuf;
                 if (bufLoadFactor > 0) {
+                    // bufSoftLimit = ( bufLoadFactor * buf.length ) /100;
                     bufSoftLimit = (int) ((((long) bufLoadFactor) * buf.length) / 100);
                 }
 
@@ -2394,15 +2895,19 @@ public class MXParser implements XmlPullParser {
             posEnd -= bufStart;
             bufAbsoluteStart += bufStart;
             bufStart = 0;
-            LOG.trace("fillBuf() after bufEnd={} pos={} posStart={} posEnd={} buf first 100 chars:{}",
-                    bufEnd, pos, posStart, posEnd, new String(buf, 0, bufEnd < 100 ? bufEnd : 100));
+            if (TRACE_SIZING)
+                System.out.println("TRACE_SIZING fillBuf() after bufEnd=" + bufEnd + " pos=" + pos + " posStart=" + posStart
+                                   + " posEnd=" + posEnd + " buf first 100 chars:"
+                                   + new String(buf, 0, bufEnd < 100 ? bufEnd : 100));
         }
+        // at least one character must be read or error
         final int len = buf.length - bufEnd > READ_CHUNK_SIZE ? READ_CHUNK_SIZE : buf.length - bufEnd;
         final int ret = reader.read(buf, bufEnd, len);
         if (ret > 0) {
             bufEnd += ret;
-            LOG.trace("fillBuf() after filling in buffer buf first 100 chars:{}",
-                    new String(buf, 0, bufEnd < 100 ? bufEnd : 100));
+            if (TRACE_SIZING)
+                System.out.println("TRACE_SIZING fillBuf() after filling in buffer" + " buf first 100 chars:"
+                                   + new String(buf, 0, bufEnd < 100 ? bufEnd : 100));
 
             return;
         }
@@ -2410,15 +2915,19 @@ public class MXParser implements XmlPullParser {
             if (bufAbsoluteStart == 0 && pos == 0) {
                 throw new EOFException("input contained no data");
             } else {
-                if (seenRoot && depth == 0) {
+                if (seenRoot && depth == 0) { // inside parsing epilog!!!
                     reachedEnd = true;
                     return;
                 } else {
                     StringBuilder expectedTagStack = new StringBuilder();
                     if (depth > 0) {
+                        // final char[] cbuf = elRawName[depth];
+                        // final String startname = new String(cbuf, 0,
+                        // elRawNameEnd[depth]);
                         expectedTagStack.append(" - expected end tag");
                         if (depth > 1) {
-                            expectedTagStack.append("s");
+                            expectedTagStack.append("s"); // more than one end
+                                                         // tag
                         }
                         expectedTagStack.append(" ");
                         for (int i = depth; i > 0; i--) {
@@ -2428,7 +2937,8 @@ public class MXParser implements XmlPullParser {
                         expectedTagStack.append(" to close");
                         for (int i = depth; i > 0; i--) {
                             if (i != depth) {
-                                expectedTagStack.append(" and");
+                                expectedTagStack.append(" and"); // more than
+                                                                // one end tag
                             }
                             String tagName = new String(elRawName[i], 0, elRawNameEnd[i]);
                             expectedTagStack.append(" start tag <").append(tagName).append('>');
@@ -2447,32 +2957,52 @@ public class MXParser implements XmlPullParser {
     protected char more() throws IOException, XmlPullParserException {
         if (pos >= bufEnd) {
             fillBuf();
+            // this return value should be ignonored as it is used in epilog
+            // parsing ...
             if (reachedEnd)
                 return (char) -1;
         }
         final char ch = buf[pos++];
+        // line/columnNumber
         if (ch == '\n') {
             ++lineNumber;
             columnNumber = 1;
         } else {
             ++columnNumber;
         }
+        // System.out.print(ch);
         return ch;
     }
 
+    // /**
+    // * This function returns position of parser in XML input stream
+    // * (how many <b>characters</b> were processed.
+    // * <p><b>NOTE:</b> this logical position and not byte offset as encodings
+    // * such as UTF8 may use more than one byte to encode one character.
+    // */
+    // public int getCurrentInputPosition() {
+    // return pos + bufAbsoluteStart;
+    // }
+
     protected void ensurePC(int end) {
+        // assert end >= pc.length;
         final int newSize = end > READ_CHUNK_SIZE ? 2 * end : 2 * READ_CHUNK_SIZE;
         final char[] newPC = new char[newSize];
-        LOG.trace("ensurePC() {} ==> {} end={}", pc.length, newSize, end);
+        if (TRACE_SIZING)
+            System.out.println("TRACE_SIZING ensurePC() " + pc.length + " ==> " + newSize + " end=" + end);
         System.arraycopy(pc, 0, newPC, 0, pcEnd);
         pc = newPC;
+        // assert end < pc.length;
     }
 
     protected void joinPC() {
+        // assert usePC == false;
+        // assert posEnd > posStart;
         final int len = posEnd - posStart;
         final int newEnd = pcEnd + len + 1;
         if (newEnd >= pc.length)
             ensurePC(newEnd); // add 1 for extra space for one char
+        // assert newEnd < pc.length;
         System.arraycopy(buf, posStart, pc, pcEnd, len);
         pcEnd += len;
         usePC = true;
@@ -2506,16 +3036,25 @@ public class MXParser implements XmlPullParser {
         return ch;
     }
 
+    // nameStart / name lookup tables based on XML 1.1
+    // http://www.w3.org/TR/2001/WD-xml11-20011213/
     protected static final int LOOKUP_MAX = 0x400;
     protected static final char LOOKUP_MAX_CHAR = (char) LOOKUP_MAX;
+    // protected static int lookupNameStartChar[] = new int[ LOOKUP_MAX_CHAR /
+    // 32 ];
+    // protected static int lookupNameChar[] = new int[ LOOKUP_MAX_CHAR / 32 ];
     protected static boolean[] lookupNameStartChar = new boolean[LOOKUP_MAX];
     protected static boolean[] lookupNameChar = new boolean[LOOKUP_MAX];
 
-    private static void setName(char ch) {
+    private static void setName(char ch)
+    // { lookupNameChar[ (int)ch / 32 ] |= (1 << (ch % 32)); }
+    {
         lookupNameChar[ch] = true;
     }
 
-    private static void setNameStart(char ch) {
+    private static void setNameStart(char ch)
+    // { lookupNameStartChar[ (int)ch / 32 ] |= (1 << (ch % 32)); setName(ch); }
+    {
         lookupNameStartChar[ch] = true;
         setName(ch);
     }
@@ -2543,22 +3082,76 @@ public class MXParser implements XmlPullParser {
             setName(ch);
     }
 
+    // private final static boolean isNameStartChar(char ch) {
     protected boolean isNameStartChar(char ch) {
         return (ch < LOOKUP_MAX_CHAR && lookupNameStartChar[ch]) || (ch >= LOOKUP_MAX_CHAR && ch <= '\u2027')
                 || (ch >= '\u202A' && ch <= '\u218F')
                 || (ch >= '\u2800' && ch <= '\uFFEF');
-    }
 
+        // if(ch < LOOKUP_MAX_CHAR) return lookupNameStartChar[ ch ];
+        // else return ch <= '\u2027'
+        // || (ch >= '\u202A' && ch <= '\u218F')
+        // || (ch >= '\u2800' && ch <= '\uFFEF')
+        // ;
+        // return false;
+        // return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch ==
+        // ':'
+        // || (ch >= '0' && ch <= '9');
+        // if(ch < LOOKUP_MAX_CHAR) return (lookupNameStartChar[ (int)ch / 32 ]
+        // & (1 << (ch % 32))) != 0;
+        // if(ch <= '\u2027') return true;
+        // //[#x202A-#x218F]
+        // if(ch < '\u202A') return false;
+        // if(ch <= '\u218F') return true;
+        // // added pairts [#x2800-#xD7FF] | [#xE000-#xFDCF] | [#xFDE0-#xFFEF] |
+        // [#x10000-#x10FFFF]
+        // if(ch < '\u2800') return false;
+        // if(ch <= '\uFFEF') return true;
+        // return false;
+
+        // else return (supportXml11 && ( (ch < '\u2027') || (ch > '\u2029' &&
+        // ch < '\u2200') ...
+    }
+
+    // private final static boolean isNameChar(char ch) {
     protected boolean isNameChar(char ch) {
+        // return isNameStartChar(ch);
+
+        // if(ch < LOOKUP_MAX_CHAR) return (lookupNameChar[ (int)ch / 32 ] & (1
+        // << (ch % 32))) != 0;
+
         return (ch < LOOKUP_MAX_CHAR && lookupNameChar[ch]) || (ch >= LOOKUP_MAX_CHAR && ch <= '\u2027')
                 || (ch >= '\u202A' && ch <= '\u218F')
                 || (ch >= '\u2800' && ch <= '\uFFEF');
+        // return false;
+        // return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch ==
+        // ':'
+        // || (ch >= '0' && ch <= '9');
+        // if(ch < LOOKUP_MAX_CHAR) return (lookupNameStartChar[ (int)ch / 32 ]
+        // & (1 << (ch % 32))) != 0;
+
+        // else return
+        // else if(ch <= '\u2027') return true;
+        // //[#x202A-#x218F]
+        // else if(ch < '\u202A') return false;
+        // else if(ch <= '\u218F') return true;
+        // // added pairts [#x2800-#xD7FF] | [#xE000-#xFDCF] | [#xFDE0-#xFFEF] |
+        // [#x10000-#x10FFFF]
+        // else if(ch < '\u2800') return false;
+        // else if(ch <= '\uFFEF') return true;
+        // else return false;
     }
 
     protected boolean isS(char ch) {
         return (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t');
+        // || (supportXml11 && (ch == '\u0085' || ch == '\u2028');
     }
 
+    // protected boolean isChar(char ch) { return (ch < '\uD800' || ch >
+    // '\uDFFF')
+    // ch != '\u0000' ch < '\uFFFE'
+
+    // protected char printable(char ch) { return ch; }
     protected String printable(char ch) {
         if (ch == '\n') {
             return "\\n";
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/PipeProvider.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/PipeProvider.java
index 9a3f4e115f9f..26cd72bcb9d8 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/PipeProvider.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/PipeProvider.java
@@ -30,8 +30,6 @@ import org.apache.camel.spi.Resource;
 import org.apache.camel.spi.ResourceResolver;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.StringHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.snakeyaml.engine.v2.api.LoadSettings;
 import org.snakeyaml.engine.v2.api.YamlUnicodeReader;
 import org.snakeyaml.engine.v2.composer.Composer;
@@ -50,7 +48,6 @@ import static org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.nodeAt;
  */
 public class PipeProvider extends ObjectReferenceBindingProvider {
 
-    private static final Logger LOG = LoggerFactory.getLogger(PipeProvider.class);
     private static final String prefix = "kamelet:";
 
     public PipeProvider() {
@@ -147,10 +144,10 @@ public class PipeProvider extends ObjectReferenceBindingProvider {
                 }
                 IOHelper.close(is);
             } catch (Exception e) {
-                LOG.error("Error parsing Kamelet: {} due to: {}", loc, e.getMessage(), e);
+                System.err.println("Error parsing Kamelet: " + loc + " due to: " + e.getMessage());
             }
         } else {
-            LOG.error("Kamelet not found on github: {}", kamelet);
+            System.err.println("Kamelet not found on github: " + kamelet);
         }
 
         endpointProperties.putAll(userProperties);
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
index d49bf05f8f2f..d61cc198c890 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
@@ -19,8 +19,6 @@ package org.apache.camel.dsl.jbang.core.common;
 import java.util.StringJoiner;
 
 import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Printer interface used by commands to write output to given print stream. By default, uses System out print stream,
@@ -54,29 +52,25 @@ public interface Printer {
     }
 
     /**
-     * Default printer uses a logger.
+     * Default printer uses System out print stream.
      */
     class SystemOutPrinter implements Printer {
-
-        private static final Logger LOG = LoggerFactory.getLogger(SystemOutPrinter.class);
-
         public void println() {
-            // print empty line is not really logging
             System.out.println();
             System.out.flush();
         }
 
         public void println(String line) {
-            LOG.info(line);
+            System.out.println(line);
+            System.out.flush();
         }
 
         public void print(String output) {
-            // printing without a newline is not really logging
             System.out.print(output);
         }
 
         public void printf(String format, Object... args) {
-            LOG.info(String.format(format, args));
+            System.out.printf(format, args);
         }
     }
 
diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesHelper.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesHelper.java
index 97819de5f3dc..edc4cf28bc04 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesHelper.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesHelper.java
@@ -45,8 +45,6 @@ import io.fabric8.kubernetes.client.dsl.base.ResourceDefinitionContext;
 import org.apache.camel.dsl.jbang.core.common.YamlHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.StringHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.yaml.snakeyaml.Yaml;
 
 /**
@@ -54,7 +52,6 @@ import org.yaml.snakeyaml.Yaml;
  */
 public final class KubernetesHelper {
 
-    private static final Logger LOG = LoggerFactory.getLogger(KubernetesHelper.class);
     private static KubernetesClient kubernetesClient;
 
     /** Clients with custom config */
@@ -160,7 +157,7 @@ public final class KubernetesHelper {
             APIGroup apiGroup = getKubernetesClient().getApiGroup("route.openshift.io");
             ocp = apiGroup != null;
         } catch (RuntimeException e) {
-            LOG.warn("Failed to detect cluster, defaulting to kubernetes: {}", e.getMessage());
+            System.out.println("Failed to detect cluster: " + e.getMessage() + ", default to kubernetes.");
         }
         return ocp;
     }
@@ -183,8 +180,8 @@ public final class KubernetesHelper {
             minikubeEnv = System.getenv("MINIKUBE_ACTIVE_DOCKERD") != null
                     && System.getenv("DOCKER_TLS_VERIFY") != null;
             if (minikube && !minikubeEnv) {
-                LOG.warn(
-                        "It seems you have minikube running but forgot to run \"eval $(minikube docker-env)\", defaulting cluster to kubernetes.");
+                System.out.println(
+                        "It seems you have minikube running but forgot to run \"eval $(minikube docker-env)\", default cluster to kubernetes.");
             }
         } catch (Exception e) {
             // ignore it, since we try to discover the cluster and don't want the caller to handle any error
diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index cac9db19c3e8..caff3eb0128d 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -112,15 +112,12 @@ import org.apache.camel.support.RouteOnDemandReloadStrategy;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.support.startup.BacklogStartupStepRecorder;
 import org.apache.camel.tooling.maven.MavenGav;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * A Main class for booting up Camel with Kamelet in standalone mode.
  */
 public class KameletMain extends MainCommandLineSupport {
 
-    private static final Logger LOG = LoggerFactory.getLogger(KameletMain.class);
     public static final String DEFAULT_KAMELETS_LOCATION = "classpath:kamelets,github:apache:camel-kamelets/kamelets";
 
     private final String instanceType;
@@ -357,7 +354,8 @@ public class KameletMain extends MainCommandLineSupport {
 
     @Override
     public void showOptionsHeader() {
-        LOG.info("Apache Camel (KameletMain) takes the following options");
+        System.out.println("Apache Camel (KameletMain) takes the following options");
+        System.out.println();
     }
 
     @Override
diff --git a/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi/RestDslYamlGenerator.java b/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi/RestDslYamlGenerator.java
index a93b1d8699bf..6bafb924496f 100644
--- a/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi/RestDslYamlGenerator.java
+++ b/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi/RestDslYamlGenerator.java
@@ -173,11 +173,7 @@ public class RestDslYamlGenerator extends RestDslGenerator<RestDslYamlGenerator>
             }
         }
 
-        YAMLFactory yamlFactory = new YAMLFactory()
-                .disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER)
-                .enable(YAMLGenerator.Feature.MINIMIZE_QUOTES)
-                .enable(YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR);
-        ObjectMapper mapper = new ObjectMapper(yamlFactory);
+        ObjectMapper mapper = new ObjectMapper(new YAMLFactory().disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER));
         return mapper.writeValueAsString(node);
     }
 


(camel) 07/07: chore(artifacts): revert log output

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6838d8ca24383d97ad2a2a0f03fb1e0aadf26bee
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Mon Oct 13 16:33:46 2025 +0200

    chore(artifacts): revert log output
---
 .../resources/archetype-resources/src/main/java/__name__Producer.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java b/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
index dcf6d26572db..098b60305f10 100644
--- a/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
+++ b/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Producer.java
@@ -31,7 +31,7 @@ public class ${name}Producer extends DefaultProducer {
     }
 
     public void process(Exchange exchange) throws Exception {
-        LOG.info(exchange.getIn().getBody());
+        System.out.println(exchange.getIn().getBody());
     }
 
 }