You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/04/03 07:43:49 UTC

[camel] branch main updated: simplified boolean conditions (#9767)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 43107aa9d6a simplified boolean conditions (#9767)
43107aa9d6a is described below

commit 43107aa9d6a645f63a48919426c78362a1f6b409
Author: dk2k <dk...@users.noreply.github.com>
AuthorDate: Mon Apr 3 10:43:43 2023 +0300

    simplified boolean conditions (#9767)
    
    Co-authored-by: dk2k <dk...@ya.ru>
---
 .../java/org/apache/camel/xml/io/MXParser.java     | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

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 7d268539185..fe086e2cdec 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
@@ -465,11 +465,11 @@ public class MXParser implements XmlPullParser {
             // this, null);
             // reportNsAttribs = state;
         } else if (FEATURE_NAMES_INTERNED.equals(name)) {
-            if (state != false) {
+            if (state) {
                 throw new XmlPullParserException("interning names in this implementation is not supported");
             }
         } else if (FEATURE_PROCESS_DOCDECL.equals(name)) {
-            if (state != false) {
+            if (state) {
                 throw new XmlPullParserException("processing DOCDECL is not supported");
             }
             // } else if(REPORT_DOCDECL.equals(name)) {
@@ -584,7 +584,7 @@ public class MXParser implements XmlPullParser {
     }
 
     public int getNamespaceCount(int depth) throws XmlPullParserException {
-        if (processNamespaces == false || depth == 0) {
+        if (!processNamespaces || depth == 0) {
             return 0;
         }
         // int maxDepth = eventType == END_TAG ? this.depth + 1 : this.depth;
@@ -852,7 +852,7 @@ public class MXParser implements XmlPullParser {
     public String getAttributeNamespace(int index) {
         if (eventType != START_TAG)
             throw new IndexOutOfBoundsException("only START_TAG can have attributes");
-        if (processNamespaces == false)
+        if (!processNamespaces)
             return NO_NAMESPACE;
         if (index < 0 || index >= attributeCount)
             throw new IndexOutOfBoundsException("attribute position must be 0.." + (attributeCount - 1) + " and not " + index);
@@ -870,7 +870,7 @@ public class MXParser implements XmlPullParser {
     public String getAttributePrefix(int index) {
         if (eventType != START_TAG)
             throw new IndexOutOfBoundsException("only START_TAG can have attributes");
-        if (processNamespaces == false)
+        if (!processNamespaces)
             return null;
         if (index < 0 || index >= attributeCount)
             throw new IndexOutOfBoundsException("attribute position must be 0.." + (attributeCount - 1) + " and not " + index);
@@ -942,7 +942,7 @@ public class MXParser implements XmlPullParser {
     }
 
     public void require(int type, String namespace, String name) throws XmlPullParserException, IOException {
-        if (processNamespaces == false && namespace != null) {
+        if (!processNamespaces && namespace != null) {
             throw new XmlPullParserException("processing namespaces must be enabled on parser (or factory)" + " to have possible namespaces declared on elements"
                                              + (" (position:" + getPositionDescription()) + ")");
         }
@@ -1272,7 +1272,7 @@ public class MXParser implements XmlPullParser {
                     hadCharData = true;
 
                     boolean normalizedCR = false;
-                    final boolean normalizeInput = tokenize == false || roundtripSupported == false;
+                    final boolean normalizeInput = !tokenize || !roundtripSupported;
                     // use loop locality here!!!!
                     boolean seenBracket = false;
                     boolean seenBracketBracket = false;
@@ -1477,7 +1477,7 @@ public class MXParser implements XmlPullParser {
             return eventType = END_DOCUMENT;
         }
         boolean gotS = false;
-        final boolean normalizeIgnorableWS = tokenize == true && roundtripSupported == false;
+        final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
         try {
             // epilog: Misc*
@@ -2216,7 +2216,7 @@ public class MXParser implements XmlPullParser {
         final int curLine = lineNumber;
         final int curColumn = columnNumber;
         try {
-            final boolean normalizeIgnorableWS = tokenize == true && roundtripSupported == false;
+            final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
             boolean normalizedCR = false;
 
             boolean seenDash = false;
@@ -2305,7 +2305,7 @@ public class MXParser implements XmlPullParser {
         final int curColumn = columnNumber;
         int piTargetStart = pos + bufAbsoluteStart;
         int piTargetEnd = -1;
-        final boolean normalizeIgnorableWS = tokenize == true && roundtripSupported == false;
+        final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
 
         try {
@@ -2603,7 +2603,7 @@ public class MXParser implements XmlPullParser {
         // [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('['
         // (markupdecl | DeclSep)* ']' S?)? '>'
         int bracketLevel = 0;
-        final boolean normalizeIgnorableWS = tokenize == true && roundtripSupported == false;
+        final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
         boolean normalizedCR = false;
         while (true) {
             ch = more();
@@ -2685,7 +2685,7 @@ public class MXParser implements XmlPullParser {
         final int cdStart = pos + bufAbsoluteStart;
         final int curLine = lineNumber;
         final int curColumn = columnNumber;
-        final boolean normalizeInput = tokenize == false || roundtripSupported == false;
+        final boolean normalizeInput = !tokenize || !roundtripSupported;
         try {
             if (normalizeInput) {
                 if (hadCharData) {