TEXT-65: 3 TODO checkstyle errors
Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/0900a4c9 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/0900a4c9 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/0900a4c9 Branch: refs/heads/master Commit: 0900a4c91cece58e6d14faeb92507c544a731df1 Parents: 3e07584 Author: Rob Tompkins <chtom...@apache.org> Authored: Tue Feb 14 20:55:14 2017 -0500 Committer: Rob Tompkins <chtom...@apache.org> Committed: Tue Feb 14 20:55:14 2017 -0500 ---------------------------------------------------------------------- checkstyle-suppressions.xml | 4 ++++ .../commons/text/translate/NumericEntityUnescaper.java | 2 +- .../apache/commons/text/translate/UnicodeEscaper.java | 12 ++++++++---- .../apache/commons/text/translate/UnicodeUnescaper.java | 11 ++++++----- .../text/translate/UnicodeUnpairedSurrogateRemover.java | 2 +- 5 files changed, 20 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-text/blob/0900a4c9/checkstyle-suppressions.xml ---------------------------------------------------------------------- diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml index cc03b22..d52e173 100644 --- a/checkstyle-suppressions.xml +++ b/checkstyle-suppressions.xml @@ -53,4 +53,8 @@ <suppress checks="MagicNumber" files="NumericEntityUnescaper.java" lines="0-99999" /> <suppress checks="MagicNumber" files="OctalUnescaper.java" lines="0-99999" /> + + <suppress checks="MagicNumber" files="UnicodeEscaper.java" lines="0-99999" /> + + <suppress checks="MagicNumber" files="UnicodeUnescaper.java" lines="0-99999" /> </suppressions> http://git-wip-us.apache.org/repos/asf/commons-text/blob/0900a4c9/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java b/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java index 42b38ef..6060cf8 100644 --- a/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java +++ b/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java @@ -35,7 +35,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator { public static enum OPTION { semiColonRequired, semiColonOptional, errorIfNoSemiColon } /** EnumSet of OPTIONS, given from the constructor. */ - // TODO?: Create an OptionsSet class to hide some of the conditional logic below + // TODO: Create an OptionsSet class to hide some of the conditional logic below private final EnumSet<OPTION> options; /** http://git-wip-us.apache.org/repos/asf/commons-text/blob/0900a4c9/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java b/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java index 04b24e2..8fba4b4 100644 --- a/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java +++ b/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java @@ -26,14 +26,18 @@ import java.io.Writer; */ public class UnicodeEscaper extends CodePointTranslator { + /** int value representing the lowest codepoint boundary. */ private final int below; + /** int value representing the highest codepoint boundary. */ private final int above; + /** whether to escape between the boundaries or outside them. */ private final boolean between; /** - * <p>Constructs a <code>UnicodeEscaper</code> for all characters. </p> + * <p>Constructs a <code>UnicodeEscaper</code> for all characters. + * </p> */ - public UnicodeEscaper(){ + public UnicodeEscaper() { this(0, Integer.MAX_VALUE, true); } @@ -124,8 +128,8 @@ public class UnicodeEscaper extends CodePointTranslator { } /** - * Converts the given codepoint to a hex string of the form {@code "\\uXXXX"} - * + * Converts the given codepoint to a hex string of the form {@code "\\uXXXX"}. + * * @param codepoint * a Unicode code point * @return the hex string for the given codepoint http://git-wip-us.apache.org/repos/asf/commons-text/blob/0900a4c9/src/main/java/org/apache/commons/text/translate/UnicodeUnescaper.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/text/translate/UnicodeUnescaper.java b/src/main/java/org/apache/commons/text/translate/UnicodeUnescaper.java index 3a91d6c..1665d91 100644 --- a/src/main/java/org/apache/commons/text/translate/UnicodeUnescaper.java +++ b/src/main/java/org/apache/commons/text/translate/UnicodeUnescaper.java @@ -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. @@ -20,8 +20,8 @@ import java.io.IOException; import java.io.Writer; /** - * Translates escaped Unicode values of the form \\u+\d\d\d\d back to - * Unicode. It supports multiple 'u' characters and will work with or + * Translates escaped Unicode values of the form \\u+\d\d\d\d back to + * Unicode. It supports multiple 'u' characters and will work with or * without the +. * * @since 1.0 @@ -56,7 +56,8 @@ public class UnicodeUnescaper extends CharSequenceTranslator { } return i + 4; } - throw new IllegalArgumentException("Less than 4 hex digits in unicode value: '" + input.subSequence(index, input.length()) + throw new IllegalArgumentException("Less than 4 hex digits in unicode value: '" + + input.subSequence(index, input.length()) + "' due to end of CharSequence"); } return 0; http://git-wip-us.apache.org/repos/asf/commons-text/blob/0900a4c9/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java b/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java index ca90b89..09d69c7 100644 --- a/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java +++ b/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java @@ -26,7 +26,7 @@ import java.io.Writer; */ public class UnicodeUnpairedSurrogateRemover extends CodePointTranslator { /** - * Implementation of translate that throws out unpaired surrogates. + * Implementation of translate that throws out unpaired surrogates. * {@inheritDoc} */ @Override