Remove the condition which is always true when reached

Motivation:
Condition 'isNextCharDoubleQuote' is always 'true' when reached.

Motification:
- Removed Condition 'isNextCharDoubleQuote'.
- Additionally fixed typo in javadoc

Result:
Cleaner code.
This commit is contained in:
JongYoon Lim 2015-04-30 21:34:24 +09:00 committed by Scott Mitchell
parent d74f96432f
commit e92c0ae756

View File

@ -329,7 +329,7 @@ public final class StringUtil {
* *
* @param value The value which will be escaped according to * @param value The value which will be escaped according to
* <a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a> * <a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a>
* @return {@link CharSequence} the escaped value if nesessary, or the value unchanged * @return {@link CharSequence} the escaped value if necessary, or the value unchanged
*/ */
public static CharSequence escapeCsv(CharSequence value) { public static CharSequence escapeCsv(CharSequence value) {
int length = checkNotNull(value, "value").length(); int length = checkNotNull(value, "value").length();
@ -354,7 +354,7 @@ public final class StringUtil {
} else { } else {
boolean isNextCharDoubleQuote = isDoubleQuote(value.charAt(i + 1)); boolean isNextCharDoubleQuote = isDoubleQuote(value.charAt(i + 1));
if (!isDoubleQuote(value.charAt(i - 1)) && if (!isDoubleQuote(value.charAt(i - 1)) &&
(!isNextCharDoubleQuote || isNextCharDoubleQuote && i + 1 == last)) { (!isNextCharDoubleQuote || i + 1 == last)) {
escaped.append(DOUBLE_QUOTE); escaped.append(DOUBLE_QUOTE);
escapedDoubleQuote = true; escapedDoubleQuote = true;
} }