You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2023/06/07 11:15:10 UTC
svn commit: r1910276 - in /jackrabbit/trunk: jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java
Author: reschke
Date: Wed Jun 7 11:15:10 2023
New Revision: 1910276
URL: http://svn.apache.org/viewvc?rev=1910276&view=rev
Log:
JCR-4938: update remaining copies of XMLChar.java with latest version from Xerces
Modified:
jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java
Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java?rev=1910276&r1=1910275&r2=1910276&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java Wed Jun 7 11:15:10 2023
@@ -5,9 +5,9 @@
* 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.
@@ -68,10 +68,10 @@ public class XMLChar {
/** Pubid character mask. */
public static final int MASK_PUBID = 0x10;
-
- /**
+
+ /**
* Content character mask. Special characters are those that can
- * be considered the start of markup, such as '<' and '&'.
+ * be considered the start of markup, such as '<' and '&'.
* The various newline characters are considered special as well.
* All other valid XML characters can be considered content.
* <p>
@@ -90,10 +90,10 @@ public class XMLChar {
//
static {
-
+
// Initializing the Character Flag Array
// Code generated by: XMLCharGenerator.
-
+
CHARS[9] = 35;
CHARS[10] = 19;
CHARS[13] = 19;
@@ -897,21 +897,23 @@ public class XMLChar {
* @return true if name is a valid Name
*/
public static boolean isValidName(String name) {
- if (name.length() == 0)
+ final int length = name.length();
+ if (length == 0) {
return false;
+ }
char ch = name.charAt(0);
- if( isNameStart(ch) == false)
- return false;
- for (int i = 1; i < name.length(); i++ ) {
- ch = name.charAt(i);
- if( isName( ch ) == false ){
- return false;
- }
+ if (!isNameStart(ch)) {
+ return false;
+ }
+ for (int i = 1; i < length; ++i) {
+ ch = name.charAt(i);
+ if (!isName(ch)) {
+ return false;
+ }
}
return true;
} // isValidName(String):boolean
-
-
+
/*
* from the namespace rec
* [4] NCName ::= (Letter | '_') (NCNameChar)*
@@ -924,16 +926,19 @@ public class XMLChar {
* @return true if name is a valid NCName
*/
public static boolean isValidNCName(String ncName) {
- if (ncName.length() == 0)
+ final int length = ncName.length();
+ if (length == 0) {
return false;
+ }
char ch = ncName.charAt(0);
- if( isNCNameStart(ch) == false)
- return false;
- for (int i = 1; i < ncName.length(); i++ ) {
- ch = ncName.charAt(i);
- if( isNCName( ch ) == false ){
- return false;
- }
+ if (!isNCNameStart(ch)) {
+ return false;
+ }
+ for (int i = 1; i < length; ++i) {
+ ch = ncName.charAt(i);
+ if (!isNCName(ch)) {
+ return false;
+ }
}
return true;
} // isValidNCName(String):boolean
@@ -946,16 +951,18 @@ public class XMLChar {
* in the XML 1.0 Recommendation
*
* @param nmtoken string to check
- * @return true if nmtoken is a valid Nmtoken
+ * @return true if nmtoken is a valid Nmtoken
*/
public static boolean isValidNmtoken(String nmtoken) {
- if (nmtoken.length() == 0)
+ final int length = nmtoken.length();
+ if (length == 0) {
return false;
- for (int i = 0; i < nmtoken.length(); i++ ) {
- char ch = nmtoken.charAt(i);
- if( ! isName( ch ) ){
- return false;
- }
+ }
+ for (int i = 0; i < length; ++i) {
+ char ch = nmtoken.charAt(i);
+ if (!isName(ch)) {
+ return false;
+ }
}
return true;
} // isValidName(String):boolean
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java?rev=1910276&r1=1910275&r2=1910276&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java Wed Jun 7 11:15:10 2023
@@ -5,9 +5,9 @@
* 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.
@@ -68,10 +68,10 @@ public class XMLChar {
/** Pubid character mask. */
public static final int MASK_PUBID = 0x10;
-
- /**
+
+ /**
* Content character mask. Special characters are those that can
- * be considered the start of markup, such as '<' and '&'.
+ * be considered the start of markup, such as '<' and '&'.
* The various newline characters are considered special as well.
* All other valid XML characters can be considered content.
* <p>
@@ -90,10 +90,10 @@ public class XMLChar {
//
static {
-
+
// Initializing the Character Flag Array
// Code generated by: XMLCharGenerator.
-
+
CHARS[9] = 35;
CHARS[10] = 19;
CHARS[13] = 19;
@@ -897,21 +897,23 @@ public class XMLChar {
* @return true if name is a valid Name
*/
public static boolean isValidName(String name) {
- if (name.length() == 0)
+ final int length = name.length();
+ if (length == 0) {
return false;
+ }
char ch = name.charAt(0);
- if( isNameStart(ch) == false)
- return false;
- for (int i = 1; i < name.length(); i++ ) {
- ch = name.charAt(i);
- if( isName( ch ) == false ){
- return false;
- }
+ if (!isNameStart(ch)) {
+ return false;
+ }
+ for (int i = 1; i < length; ++i) {
+ ch = name.charAt(i);
+ if (!isName(ch)) {
+ return false;
+ }
}
return true;
} // isValidName(String):boolean
-
-
+
/*
* from the namespace rec
* [4] NCName ::= (Letter | '_') (NCNameChar)*
@@ -924,16 +926,19 @@ public class XMLChar {
* @return true if name is a valid NCName
*/
public static boolean isValidNCName(String ncName) {
- if (ncName.length() == 0)
+ final int length = ncName.length();
+ if (length == 0) {
return false;
+ }
char ch = ncName.charAt(0);
- if( isNCNameStart(ch) == false)
- return false;
- for (int i = 1; i < ncName.length(); i++ ) {
- ch = ncName.charAt(i);
- if( isNCName( ch ) == false ){
- return false;
- }
+ if (!isNCNameStart(ch)) {
+ return false;
+ }
+ for (int i = 1; i < length; ++i) {
+ ch = ncName.charAt(i);
+ if (!isNCName(ch)) {
+ return false;
+ }
}
return true;
} // isValidNCName(String):boolean
@@ -946,16 +951,18 @@ public class XMLChar {
* in the XML 1.0 Recommendation
*
* @param nmtoken string to check
- * @return true if nmtoken is a valid Nmtoken
+ * @return true if nmtoken is a valid Nmtoken
*/
public static boolean isValidNmtoken(String nmtoken) {
- if (nmtoken.length() == 0)
+ final int length = nmtoken.length();
+ if (length == 0) {
return false;
- for (int i = 0; i < nmtoken.length(); i++ ) {
- char ch = nmtoken.charAt(i);
- if( ! isName( ch ) ){
- return false;
- }
+ }
+ for (int i = 0; i < length; ++i) {
+ char ch = nmtoken.charAt(i);
+ if (!isName(ch)) {
+ return false;
+ }
}
return true;
} // isValidName(String):boolean