This is an automated email from the ASF dual-hosted git repository. dkulp pushed a commit to branch datatypes in repository https://gitbox.apache.org/repos/asf/ws-axiom.git
commit 23df3a6dbf31224fb37fd232e2946d66028147b1 Author: Andreas Veithen <veit...@apache.org> AuthorDate: Sun Nov 22 21:48:42 2015 +0000 Use the isWhitespace method from XMLChar. --- datatypes/pom.xml | 5 +++++ .../main/java/org/apache/axiom/datatype/TypeHelper.java | 17 ++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/datatypes/pom.xml b/datatypes/pom.xml index d794f62..a931b19 100644 --- a/datatypes/pom.xml +++ b/datatypes/pom.xml @@ -34,6 +34,11 @@ <dependencies> <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>xml-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> diff --git a/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java b/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java index 34b7d99..b9615b2 100644 --- a/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java +++ b/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java @@ -18,6 +18,8 @@ */ package org.apache.axiom.datatype; +import static org.apache.axiom.util.xml.XMLChar.isWhitespace; + /** * Contains utility methods for usage by {@link Type} implementations. */ @@ -25,17 +27,6 @@ public final class TypeHelper { private TypeHelper() {} /** - * Determine if the given character is whitespace according to the XML specification. - * - * @param c - * the character to examine - * @return {@code true} if the character is whitespace, {@code false} otherwise - */ - public static boolean isWhitespace(char c) { - return c == ' ' || c == '\r' || c == '\n' || c == '\t'; - } - - /** * Determine the index of the first non whitespace character in the given literal. This method * is intended for use in implementations of XSD datatypes for which the {@code whiteSpace} * facet is {@code collapse}. @@ -52,7 +43,7 @@ public final class TypeHelper { throw new UnexpectedEndOfStringException(literal); } int start = 0; - while (TypeHelper.isWhitespace(literal.charAt(start))) { + while (isWhitespace(literal.charAt(start))) { if (++start == len) { throw new UnexpectedEndOfStringException(literal); } @@ -78,7 +69,7 @@ public final class TypeHelper { throw new UnexpectedEndOfStringException(literal); } int end = len; - while (TypeHelper.isWhitespace(literal.charAt(end-1))) { + while (isWhitespace(literal.charAt(end-1))) { if (--end == 0) { throw new UnexpectedEndOfStringException(literal); }