Repository: commons-lang Updated Branches: refs/heads/master 716f140d4 -> f83e93685
Revert "[LANG-1227] Add XMLCharacter class." This reverts commit dd5a0e6e1e3edb41afb4b40e4ec2c99e5932e73c. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/f83e9368 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/f83e9368 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/f83e9368 Branch: refs/heads/master Commit: f83e93685baf911d8fce96485e0d5ed8d783eedb Parents: 716f140 Author: Benedikt Ritter <[email protected]> Authored: Sun Sep 11 14:37:57 2016 +0200 Committer: Benedikt Ritter <[email protected]> Committed: Sun Sep 11 14:39:14 2016 +0200 ---------------------------------------------------------------------- src/changes/changes.xml | 1 - .../org/apache/commons/lang3/XMLCharacter.java | 84 --------------- .../apache/commons/lang3/XMLCharacterTest.java | 104 ------------------- 3 files changed, 189 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/f83e9368/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 805b6f4..1c45e13 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -83,7 +83,6 @@ The <action> type attribute can be add,update,fix,remove. <action issue="LANG-1178" type="fix" dev="pschumacher" due-to="Henri Yandell">ArrayUtils.removeAll(Object array, int... indices) should do the clone, not its callers</action> <action issue="LANG-1151" type="update" dev="pschumacher" due-to="Juan Pablo Santos RodrÃguez">Performance improvements for NumberUtils.isParsable</action> <action issue="LANG-1120" type="fix" dev="pschumacher" due-to="kaching88">StringUtils.stripAccents should remove accents from "Å" and "Å".</action> - <action issue="LANG-1227" type="new" dev="ggregory" due-to="Gary Gregory">Add XMLCharacter class.</action> <action issue="LANG-1218" type="update" dev="ggregory" due-to="Ruslan Cheremin">EqualsBuilder.append(Object,Object) is too big to be inlined, which prevents whole builder to be scalarized</action> <action issue="LANG-1205" type="fix" dev="chas" due-to="pbrose">NumberUtils.createNumber() behaves inconsistently with NumberUtils.isNumber()</action> <action issue="LANG-1115" type="add" dev="chas" due-to="Jim Lloyd, Joe Ferner">Add support for varargs in ConstructorUtils, MemberUtils, and MethodUtils</action> http://git-wip-us.apache.org/repos/asf/commons-lang/blob/f83e9368/src/main/java/org/apache/commons/lang3/XMLCharacter.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/XMLCharacter.java b/src/main/java/org/apache/commons/lang3/XMLCharacter.java deleted file mode 100644 index ec42b2a..0000000 --- a/src/main/java/org/apache/commons/lang3/XMLCharacter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -/* - * From Apache Xalan XMLCharacterRecognizer. - */ -package org.apache.commons.lang3; - -/** - * Verifies whether specified primitives and objects conforms to the XML 1.0 definition of whitespace. - * - * <p> - * Copied and tweaked from Apache Xalan {@code XMLCharacterRecognizer} - * </p> - * - * @since 3.5 - */ -public class XMLCharacter { - - /** - * Returns whether the specified {@code ch} conforms to the XML 1.0 definition of whitespace. Refer to - * <a href="http://www.w3.org/TR/1998/REC-xml-19980210#NT-S"> the definition of <CODE>S</CODE></a> for details. - * - * @param ch - * Character to check as XML whitespace. - * @return true if {@code ch} is XML whitespace; otherwise false. - */ - public static boolean isWhitespace(final char ch) { - return ch == 0x20 || ch == 0x09 || ch == 0xD || ch == 0xA; - } - - /** - * Detects if the string is whitespace. - * - * @param ch - * Character array to check as XML whitespace. - * @param start - * Start index of characters in the array - * @param length - * Number of characters in the array - * @return true if the characters in the array are XML whitespace; otherwise, false. - */ - public static boolean isWhitespace(final char ch[], final int start, final int length) { - final int end = start + length; - for (int s = start; s < end; s++) { - if (!isWhitespace(ch[s])) { - return false; - } - } - return length > 0; - } - - /** - * Detects if the string is whitespace. - * - * @param charSequence - * StringBuffer to check as XML whitespace. - * @return True if characters in buffer are XML whitespace, false otherwise - */ - public static boolean isWhitespace(final CharSequence charSequence) { - final int length = charSequence.length(); - for (int i = 0; i < length; i++) { - if (!isWhitespace(charSequence.charAt(i))) { - return false; - } - } - return length > 0; - } - -} http://git-wip-us.apache.org/repos/asf/commons-lang/blob/f83e9368/src/test/java/org/apache/commons/lang3/XMLCharacterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/XMLCharacterTest.java b/src/test/java/org/apache/commons/lang3/XMLCharacterTest.java deleted file mode 100644 index 4984b88..0000000 --- a/src/test/java/org/apache/commons/lang3/XMLCharacterTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ -package org.apache.commons.lang3; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Tests {@link XMLCharacter}. - */ -public class XMLCharacterTest { - - private static char[] XML_WHITESPACE_CHARS = { ' ', '\t', '\r', '\n' }; - - private static char[] JAVA_EXTRA_WHITESPACE_CHARS = { '\u000B', '\u001C', '\u001D', '\u001E', '\u001F' }; - - /** - * @see Character#isWhitespace(char) - */ - @Test - public void testIsWhitespace_char() { - for (final char c : XML_WHITESPACE_CHARS) { - Assert.assertTrue(XMLCharacter.isWhitespace(c)); - Assert.assertTrue(Character.isWhitespace(c)); - } - for (final char c : JAVA_EXTRA_WHITESPACE_CHARS) { - Assert.assertFalse(XMLCharacter.isWhitespace(c)); - Assert.assertTrue(Character.isWhitespace(c)); - } - // - Assert.assertFalse(XMLCharacter.isWhitespace('a')); - } - - @Test - public void testIsWhitespace_char_arrary() { - Assert.assertTrue(XMLCharacter.isWhitespace(XML_WHITESPACE_CHARS, 0, XML_WHITESPACE_CHARS.length)); - Assert.assertFalse( - XMLCharacter.isWhitespace(JAVA_EXTRA_WHITESPACE_CHARS, 0, JAVA_EXTRA_WHITESPACE_CHARS.length)); - } - - @Test - public void testIsWhitespace_CharSequence() { - Assert.assertFalse(XMLCharacter.isWhitespace(StringUtils.EMPTY)); - } - - @Test - public void testIsWhitespace_EmptyArray() { - Assert.assertFalse(XMLCharacter.isWhitespace(new char[] {}, 0, 0)); - } - - @Test - public void testIsWhitespace_String_firstChar() { - for (final char c : XML_WHITESPACE_CHARS) { - Assert.assertTrue(XMLCharacter.isWhitespace(Character.toString(c) + Character.toString(c))); - Assert.assertFalse(XMLCharacter.isWhitespace(Character.toString(c) + "X")); - } - for (final char c : JAVA_EXTRA_WHITESPACE_CHARS) { - Assert.assertFalse(XMLCharacter.isWhitespace(Character.toString(c) + "X")); - } - // - Assert.assertFalse(XMLCharacter.isWhitespace('a')); - } - - @Test - public void testIsWhitespace_String_lastChar() { - for (final char c : XML_WHITESPACE_CHARS) { - Assert.assertTrue(XMLCharacter.isWhitespace(Character.toString(c) + Character.toString(c))); - Assert.assertFalse(XMLCharacter.isWhitespace("X" + Character.toString(c))); - } - for (final char c : JAVA_EXTRA_WHITESPACE_CHARS) { - Assert.assertFalse(XMLCharacter.isWhitespace("X" + Character.toString(c))); - } - // - Assert.assertFalse(XMLCharacter.isWhitespace('a')); - } - - @Test - public void testIsWhitespace_String_singleChar() { - for (final char c : XML_WHITESPACE_CHARS) { - Assert.assertTrue(XMLCharacter.isWhitespace(Character.toString(c))); - } - for (final char c : JAVA_EXTRA_WHITESPACE_CHARS) { - Assert.assertFalse(XMLCharacter.isWhitespace(Character.toString(c))); - } - // - Assert.assertFalse(XMLCharacter.isWhitespace('a')); - } - -}
