diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java b/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java index 879b27ce6..e933665ec 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java @@ -948,12 +948,12 @@ public class ToStringBuilder implements Builder { * method. Appends the class name followed by * {@link System#identityHashCode(java.lang.Object)}.

* - * @param object the Object whose class name and id to output + * @param srcObject the Object whose class name and id to output * @return this * @since 2.0 */ - public ToStringBuilder appendAsObjectToString(final Object object) { - ObjectUtils.identityToString(this.getStringBuffer(), object); + public ToStringBuilder appendAsObjectToString(final Object srcObject) { + ObjectUtils.identityToString(this.getStringBuffer(), srcObject); return this; } diff --git a/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java b/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java index 2c696985b..d7cede610 100644 --- a/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java +++ b/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java @@ -247,13 +247,13 @@ public class EventListenerSupport implements Serializable { private void readObject(final ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { @SuppressWarnings("unchecked") // Will throw CCE here if not correct final - L[] listeners = (L[]) objectInputStream.readObject(); + L[] srcListeners = (L[]) objectInputStream.readObject(); - this.listeners = new CopyOnWriteArrayList(listeners); + this.listeners = new CopyOnWriteArrayList(srcListeners); @SuppressWarnings("unchecked") // Will throw CCE here if not correct final - Class listenerInterface = (Class) listeners.getClass().getComponentType(); + Class listenerInterface = (Class) srcListeners.getClass().getComponentType(); initializeTransientFields(listenerInterface, Thread.currentThread().getContextClassLoader()); } diff --git a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java b/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java index 760947ee2..93886afe2 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java +++ b/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java @@ -738,10 +738,10 @@ public class StrSubstitutor { * represents a boolean flag as to whether any change occurred. */ private int substitute(final StrBuilder buf, final int offset, final int length, List priorVariables) { - final StrMatcher prefixMatcher = getVariablePrefixMatcher(); - final StrMatcher suffixMatcher = getVariableSuffixMatcher(); + final StrMatcher pfxMatcher = getVariablePrefixMatcher(); + final StrMatcher suffMatcher = getVariableSuffixMatcher(); final char escape = getEscapeChar(); - final StrMatcher valueDelimiterMatcher = getValueDelimiterMatcher(); + final StrMatcher valueDelimMatcher = getValueDelimiterMatcher(); final boolean substitutionInVariablesEnabled = isEnableSubstitutionInVariables(); final boolean top = priorVariables == null; @@ -751,7 +751,7 @@ public class StrSubstitutor { int bufEnd = offset + length; int pos = offset; while (pos < bufEnd) { - final int startMatchLen = prefixMatcher.isMatch(chars, pos, offset, + final int startMatchLen = pfxMatcher.isMatch(chars, pos, offset, bufEnd); if (startMatchLen == 0) { pos++; @@ -772,7 +772,7 @@ public class StrSubstitutor { int nestedVarCount = 0; while (pos < bufEnd) { if (substitutionInVariablesEnabled - && (endMatchLen = prefixMatcher.isMatch(chars, + && (endMatchLen = pfxMatcher.isMatch(chars, pos, offset, bufEnd)) != 0) { // found a nested variable start nestedVarCount++; @@ -780,7 +780,7 @@ public class StrSubstitutor { continue; } - endMatchLen = suffixMatcher.isMatch(chars, pos, offset, + endMatchLen = suffMatcher.isMatch(chars, pos, offset, bufEnd); if (endMatchLen == 0) { pos++; @@ -801,16 +801,16 @@ public class StrSubstitutor { String varName = varNameExpr; String varDefaultValue = null; - if (valueDelimiterMatcher != null) { + if (valueDelimMatcher != null) { final char [] varNameExprChars = varNameExpr.toCharArray(); int valueDelimiterMatchLen = 0; for (int i = 0; i < varNameExprChars.length; i++) { // if there's any nested variable when nested variable substitution disabled, then stop resolving name and default value. if (!substitutionInVariablesEnabled - && prefixMatcher.isMatch(varNameExprChars, i, i, varNameExprChars.length) != 0) { + && pfxMatcher.isMatch(varNameExprChars, i, i, varNameExprChars.length) != 0) { break; } - if ((valueDelimiterMatchLen = valueDelimiterMatcher.isMatch(varNameExprChars, i)) != 0) { + if ((valueDelimiterMatchLen = valueDelimMatcher.isMatch(varNameExprChars, i)) != 0) { varName = varNameExpr.substring(0, i); varDefaultValue = varNameExpr.substring(i + valueDelimiterMatchLen); break; diff --git a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java index 7430b1cb5..c9e2d0133 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java +++ b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java @@ -627,30 +627,30 @@ public class StrTokenizer implements ListIterator, Cloneable { * equal to the length of the array to this method, however a subclass * may pass other values, or even an entirely different array. * - * @param chars the character array being tokenized, may be null + * @param srcChars the character array being tokenized, may be null * @param offset the start position within the character array, must be valid * @param count the number of characters to tokenize, must be valid * @return the modifiable list of String tokens, unmodifiable if null array or zero count */ - protected List tokenize(final char[] chars, final int offset, final int count) { - if (chars == null || count == 0) { + protected List tokenize(final char[] srcChars, final int offset, final int count) { + if (srcChars == null || count == 0) { return Collections.emptyList(); } final StrBuilder buf = new StrBuilder(); - final List tokens = new ArrayList(); + final List tokenList = new ArrayList(); int pos = offset; // loop around the entire buffer while (pos >= 0 && pos < count) { // find next token - pos = readNextToken(chars, pos, count, buf, tokens); + pos = readNextToken(srcChars, pos, count, buf, tokenList); // handle case where end of string is a delimiter if (pos >= count) { - addToken(tokens, ""); + addToken(tokenList, ""); } } - return tokens; + return tokenList; } /** @@ -674,24 +674,24 @@ public class StrTokenizer implements ListIterator, Cloneable { /** * Reads character by character through the String to get the next token. * - * @param chars the character array being tokenized + * @param srcChars the character array being tokenized * @param start the first character of field * @param len the length of the character array being tokenized * @param workArea a temporary work area - * @param tokens the list of parsed tokens + * @param tokenList the list of parsed tokens * @return the starting position of the next field (the character * immediately after the delimiter), or -1 if end of string found */ - private int readNextToken(final char[] chars, int start, final int len, final StrBuilder workArea, final List tokens) { + private int readNextToken(final char[] srcChars, int start, final int len, final StrBuilder workArea, final List tokenList) { // skip all leading whitespace, unless it is the // field delimiter or the quote character while (start < len) { final int removeLen = Math.max( - getIgnoredMatcher().isMatch(chars, start, start, len), - getTrimmerMatcher().isMatch(chars, start, start, len)); + getIgnoredMatcher().isMatch(srcChars, start, start, len), + getTrimmerMatcher().isMatch(srcChars, start, start, len)); if (removeLen == 0 || - getDelimiterMatcher().isMatch(chars, start, start, len) > 0 || - getQuoteMatcher().isMatch(chars, start, start, len) > 0) { + getDelimiterMatcher().isMatch(srcChars, start, start, len) > 0 || + getQuoteMatcher().isMatch(srcChars, start, start, len) > 0) { break; } start += removeLen; @@ -699,41 +699,41 @@ public class StrTokenizer implements ListIterator, Cloneable { // handle reaching end if (start >= len) { - addToken(tokens, ""); + addToken(tokenList, ""); return -1; } // handle empty token - final int delimLen = getDelimiterMatcher().isMatch(chars, start, start, len); + final int delimLen = getDelimiterMatcher().isMatch(srcChars, start, start, len); if (delimLen > 0) { - addToken(tokens, ""); + addToken(tokenList, ""); return start + delimLen; } // handle found token - final int quoteLen = getQuoteMatcher().isMatch(chars, start, start, len); + final int quoteLen = getQuoteMatcher().isMatch(srcChars, start, start, len); if (quoteLen > 0) { - return readWithQuotes(chars, start + quoteLen, len, workArea, tokens, start, quoteLen); + return readWithQuotes(srcChars, start + quoteLen, len, workArea, tokenList, start, quoteLen); } - return readWithQuotes(chars, start, len, workArea, tokens, 0, 0); + return readWithQuotes(srcChars, start, len, workArea, tokenList, 0, 0); } /** * Reads a possibly quoted string token. * - * @param chars the character array being tokenized + * @param srcChars the character array being tokenized * @param start the first character of field * @param len the length of the character array being tokenized * @param workArea a temporary work area - * @param tokens the list of parsed tokens + * @param tokenList the list of parsed tokens * @param quoteStart the start position of the matched quote, 0 if no quoting * @param quoteLen the length of the matched quote, 0 if no quoting * @return the starting position of the next field (the character * immediately after the delimiter, or if end of string found, * then the length of string */ - private int readWithQuotes(final char[] chars, final int start, final int len, final StrBuilder workArea, - final List tokens, final int quoteStart, final int quoteLen) { + private int readWithQuotes(final char[] srcChars, final int start, final int len, final StrBuilder workArea, + final List tokenList, final int quoteStart, final int quoteLen) { // Loop until we've found the end of the quoted // string or the end of the input workArea.clear(); @@ -752,10 +752,10 @@ public class StrTokenizer implements ListIterator, Cloneable { // followed by a second quote. If so, then we need // to actually put the quote character into the token // rather than end the token. - if (isQuote(chars, pos, len, quoteStart, quoteLen)) { - if (isQuote(chars, pos + quoteLen, len, quoteStart, quoteLen)) { + if (isQuote(srcChars, pos, len, quoteStart, quoteLen)) { + if (isQuote(srcChars, pos + quoteLen, len, quoteStart, quoteLen)) { // matched pair of quotes, thus an escaped quote - workArea.append(chars, pos, quoteLen); + workArea.append(srcChars, pos, quoteLen); pos += quoteLen * 2; trimStart = workArea.size(); continue; @@ -768,29 +768,29 @@ public class StrTokenizer implements ListIterator, Cloneable { } // copy regular character from inside quotes - workArea.append(chars[pos++]); + workArea.append(srcChars[pos++]); trimStart = workArea.size(); } else { // Not in quoting mode // check for delimiter, and thus end of token - final int delimLen = getDelimiterMatcher().isMatch(chars, pos, start, len); + final int delimLen = getDelimiterMatcher().isMatch(srcChars, pos, start, len); if (delimLen > 0) { // return condition when end of token found - addToken(tokens, workArea.substring(0, trimStart)); + addToken(tokenList, workArea.substring(0, trimStart)); return pos + delimLen; } // check for quote, and thus back into quoting mode - if (quoteLen > 0 && isQuote(chars, pos, len, quoteStart, quoteLen)) { + if (quoteLen > 0 && isQuote(srcChars, pos, len, quoteStart, quoteLen)) { quoting = true; pos += quoteLen; continue; } // check for ignored (outside quotes), and ignore - final int ignoredLen = getIgnoredMatcher().isMatch(chars, pos, start, len); + final int ignoredLen = getIgnoredMatcher().isMatch(srcChars, pos, start, len); if (ignoredLen > 0) { pos += ignoredLen; continue; @@ -799,21 +799,21 @@ public class StrTokenizer implements ListIterator, Cloneable { // check for trimmed character // don't yet know if its at the end, so copy to workArea // use trimStart to keep track of trim at the end - final int trimmedLen = getTrimmerMatcher().isMatch(chars, pos, start, len); + final int trimmedLen = getTrimmerMatcher().isMatch(srcChars, pos, start, len); if (trimmedLen > 0) { - workArea.append(chars, pos, trimmedLen); + workArea.append(srcChars, pos, trimmedLen); pos += trimmedLen; continue; } // copy regular character from outside quotes - workArea.append(chars[pos++]); + workArea.append(srcChars[pos++]); trimStart = workArea.size(); } } // return condition when end of string found - addToken(tokens, workArea.substring(0, trimStart)); + addToken(tokenList, workArea.substring(0, trimStart)); return -1; } @@ -821,16 +821,16 @@ public class StrTokenizer implements ListIterator, Cloneable { * Checks if the characters at the index specified match the quote * already matched in readNextToken(). * - * @param chars the character array being tokenized + * @param srcChars the character array being tokenized * @param pos the position to check for a quote * @param len the length of the character array being tokenized * @param quoteStart the start position of the matched quote, 0 if no quoting * @param quoteLen the length of the matched quote, 0 if no quoting * @return true if a quote is matched */ - private boolean isQuote(final char[] chars, final int pos, final int len, final int quoteStart, final int quoteLen) { + private boolean isQuote(final char[] srcChars, final int pos, final int len, final int quoteStart, final int quoteLen) { for (int i = 0; i < quoteLen; i++) { - if (pos + i >= len || chars[pos + i] != chars[quoteStart + i]) { + if (pos + i >= len || srcChars[pos + i] != srcChars[quoteStart + i]) { return false; } }