You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2013/01/22 08:09:49 UTC
svn commit: r1436770 [2/16] - in /commons/proper/lang/trunk/src:
main/java/org/apache/commons/lang3/
main/java/org/apache/commons/lang3/builder/
main/java/org/apache/commons/lang3/concurrent/
main/java/org/apache/commons/lang3/event/ main/java/org/apac...
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java Tue Jan 22 07:09:45 2013
@@ -512,9 +512,9 @@ public class Conversion {
if (src.length == 0) {
throw new IllegalArgumentException("Cannot convert an empty array.");
}
- int beSrcPos = src.length - 1 - srcPos;
- int srcLen = Math.min(4, beSrcPos + 1);
- boolean[] paddedSrc = new boolean[4];
+ final int beSrcPos = src.length - 1 - srcPos;
+ final int srcLen = Math.min(4, beSrcPos + 1);
+ final boolean[] paddedSrc = new boolean[4];
System.arraycopy(src, beSrcPos + 1 - srcLen, paddedSrc, 4 - srcLen, srcLen);
src = paddedSrc;
srcPos = 0;
@@ -600,7 +600,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
*/
public static char intToHexDigit(final int nibble) {
- char c = Character.forDigit(nibble, 16);
+ final char c = Character.forDigit(nibble, 16);
if (c == Character.MIN_VALUE) {
throw new IllegalArgumentException("nibble value not between 0 and 15: " + nibble);
}
@@ -693,8 +693,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nInts; i++ ) {
shift = i * 32 + dstPos;
- long bits = ((0xffffffffL & src[i + srcPos]) << shift);
- long mask = 0xffffffffL << shift;
+ final long bits = ((0xffffffffL & src[i + srcPos]) << shift);
+ final long mask = 0xffffffffL << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -730,8 +730,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nShorts; i++ ) {
shift = i * 16 + dstPos;
- long bits = (0xffffL & src[i + srcPos]) << shift;
- long mask = 0xffffL << shift;
+ final long bits = (0xffffL & src[i + srcPos]) << shift;
+ final long mask = 0xffffL << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -767,8 +767,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nShorts; i++ ) {
shift = i * 16 + dstPos;
- int bits = (0xffff & src[i + srcPos]) << shift;
- int mask = 0xffff << shift;
+ final int bits = (0xffff & src[i + srcPos]) << shift;
+ final int mask = 0xffff << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -804,8 +804,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nBytes; i++ ) {
shift = i * 8 + dstPos;
- long bits = (0xffL & src[i + srcPos]) << shift;
- long mask = 0xffL << shift;
+ final long bits = (0xffL & src[i + srcPos]) << shift;
+ final long mask = 0xffL << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -840,8 +840,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nBytes; i++ ) {
shift = i * 8 + dstPos;
- int bits = (0xff & src[i + srcPos]) << shift;
- int mask = 0xff << shift;
+ final int bits = (0xff & src[i + srcPos]) << shift;
+ final int mask = 0xff << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -877,8 +877,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nBytes; i++ ) {
shift = i * 8 + dstPos;
- int bits = (0xff & src[i + srcPos]) << shift;
- int mask = 0xff << shift;
+ final int bits = (0xff & src[i + srcPos]) << shift;
+ final int mask = 0xff << shift;
out = (short)((out & ~mask) | bits);
}
return out;
@@ -911,8 +911,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nHex; i++ ) {
shift = i * 4 + dstPos;
- long bits = (0xfL & hexDigitToInt(src.charAt(i + srcPos))) << shift;
- long mask = 0xfL << shift;
+ final long bits = (0xfL & hexDigitToInt(src.charAt(i + srcPos))) << shift;
+ final long mask = 0xfL << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -945,8 +945,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nHex; i++ ) {
shift = i * 4 + dstPos;
- int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift;
- int mask = 0xf << shift;
+ final int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift;
+ final int mask = 0xf << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -979,8 +979,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nHex; i++ ) {
shift = i * 4 + dstPos;
- int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift;
- int mask = 0xf << shift;
+ final int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift;
+ final int mask = 0xf << shift;
out = (short)((out & ~mask) | bits);
}
return out;
@@ -1013,8 +1013,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nHex; i++ ) {
shift = i * 4 + dstPos;
- int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift;
- int mask = 0xf << shift;
+ final int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift;
+ final int mask = 0xf << shift;
out = (byte)((out & ~mask) | bits);
}
return out;
@@ -1050,8 +1050,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nBools; i++ ) {
shift = i * 1 + dstPos;
- long bits = (src[i + srcPos] ? 1L : 0) << shift;
- long mask = 0x1L << shift;
+ final long bits = (src[i + srcPos] ? 1L : 0) << shift;
+ final long mask = 0x1L << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -1086,8 +1086,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nBools; i++ ) {
shift = i * 1 + dstPos;
- int bits = (src[i + srcPos] ? 1 : 0) << shift;
- int mask = 0x1 << shift;
+ final int bits = (src[i + srcPos] ? 1 : 0) << shift;
+ final int mask = 0x1 << shift;
out = (out & ~mask) | bits;
}
return out;
@@ -1123,8 +1123,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nBools; i++ ) {
shift = i * 1 + dstPos;
- int bits = (src[i + srcPos] ? 1 : 0) << shift;
- int mask = 0x1 << shift;
+ final int bits = (src[i + srcPos] ? 1 : 0) << shift;
+ final int mask = 0x1 << shift;
out = (short)((out & ~mask) | bits);
}
return out;
@@ -1159,8 +1159,8 @@ public class Conversion {
int shift = 0;
for (int i = 0; i < nBools; i++ ) {
shift = i * 1 + dstPos;
- int bits = (src[i + srcPos] ? 1 : 0) << shift;
- int mask = 0x1 << shift;
+ final int bits = (src[i + srcPos] ? 1 : 0) << shift;
+ final int mask = 0x1 << shift;
out = (byte)((out & ~mask) | bits);
}
return out;
@@ -1392,12 +1392,12 @@ public class Conversion {
throw new IllegalArgumentException(
"(nHexs-1)*4+srcPos is greather or equal to than 64");
}
- StringBuilder sb = new StringBuilder(dstInit);
+ final StringBuilder sb = new StringBuilder(dstInit);
int shift = 0;
int append = sb.length();
for (int i = 0; i < nHexs; i++ ) {
shift = i * 4 + srcPos;
- int bits = (int)(0xF & (src >> shift));
+ final int bits = (int)(0xF & (src >> shift));
if (dstPos + i == append) {
++append;
sb.append(intToHexDigit(bits));
@@ -1432,12 +1432,12 @@ public class Conversion {
throw new IllegalArgumentException(
"(nHexs-1)*4+srcPos is greather or equal to than 32");
}
- StringBuilder sb = new StringBuilder(dstInit);
+ final StringBuilder sb = new StringBuilder(dstInit);
int shift = 0;
int append = sb.length();
for (int i = 0; i < nHexs; i++ ) {
shift = i * 4 + srcPos;
- int bits = 0xF & (src >> shift);
+ final int bits = 0xF & (src >> shift);
if (dstPos + i == append) {
++append;
sb.append(intToHexDigit(bits));
@@ -1472,12 +1472,12 @@ public class Conversion {
throw new IllegalArgumentException(
"(nHexs-1)*4+srcPos is greather or equal to than 16");
}
- StringBuilder sb = new StringBuilder(dstInit);
+ final StringBuilder sb = new StringBuilder(dstInit);
int shift = 0;
int append = sb.length();
for (int i = 0; i < nHexs; i++ ) {
shift = i * 4 + srcPos;
- int bits = 0xF & (src >> shift);
+ final int bits = 0xF & (src >> shift);
if (dstPos + i == append) {
++append;
sb.append(intToHexDigit(bits));
@@ -1512,12 +1512,12 @@ public class Conversion {
throw new IllegalArgumentException(
"(nHexs-1)*4+srcPos is greather or equal to than 8");
}
- StringBuilder sb = new StringBuilder(dstInit);
+ final StringBuilder sb = new StringBuilder(dstInit);
int shift = 0;
int append = sb.length();
for (int i = 0; i < nHexs; i++ ) {
shift = i * 4 + srcPos;
- int bits = 0xF & (src >> shift);
+ final int bits = 0xF & (src >> shift);
if (dstPos + i == append) {
++append;
sb.append(intToHexDigit(bits));
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/EnumUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/EnumUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/EnumUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/EnumUtils.java Tue Jan 22 07:09:45 2013
@@ -56,8 +56,8 @@ public class EnumUtils {
* @return the modifiable map of enum names to enums, never null
*/
public static <E extends Enum<E>> Map<String, E> getEnumMap(final Class<E> enumClass) {
- Map<String, E> map = new LinkedHashMap<String, E>();
- for (E e: enumClass.getEnumConstants()) {
+ final Map<String, E> map = new LinkedHashMap<String, E>();
+ for (final E e: enumClass.getEnumConstants()) {
map.put(e.name(), e);
}
return map;
@@ -94,7 +94,7 @@ public class EnumUtils {
try {
Enum.valueOf(enumClass, enumName);
return true;
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
return false;
}
}
@@ -116,7 +116,7 @@ public class EnumUtils {
}
try {
return Enum.valueOf(enumClass, enumName);
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
return null;
}
}
@@ -143,7 +143,7 @@ public class EnumUtils {
checkBitVectorable(enumClass);
Validate.notNull(values);
long total = 0;
- for (E constant : values) {
+ for (final E constant : values) {
Validate.isTrue(constant != null, NULL_ELEMENTS_NOT_PERMITTED);
total |= 1 << constant.ordinal();
}
@@ -170,12 +170,12 @@ public class EnumUtils {
asEnum(enumClass);
Validate.notNull(values);
final EnumSet<E> condensed = EnumSet.noneOf(enumClass);
- for (E constant : values) {
+ for (final E constant : values) {
Validate.isTrue(constant != null, NULL_ELEMENTS_NOT_PERMITTED);
condensed.add(constant);
}
final long[] result = new long[(enumClass.getEnumConstants().length - 1) / Long.SIZE + 1];
- for (E value : condensed) {
+ for (final E value : condensed) {
result[value.ordinal() / Long.SIZE] |= 1 << (value.ordinal() % Long.SIZE);
}
ArrayUtils.reverse(result);
@@ -226,7 +226,7 @@ public class EnumUtils {
final EnumSet<E> condensed = EnumSet.noneOf(enumClass);
Collections.addAll(condensed, values);
final long[] result = new long[(enumClass.getEnumConstants().length - 1) / Long.SIZE + 1];
- for (E value : condensed) {
+ for (final E value : condensed) {
result[value.ordinal() / Long.SIZE] |= 1 << (value.ordinal() % Long.SIZE);
}
ArrayUtils.reverse(result);
@@ -268,8 +268,8 @@ public class EnumUtils {
final EnumSet<E> results = EnumSet.noneOf(asEnum(enumClass));
values = ArrayUtils.clone(Validate.notNull(values));
ArrayUtils.reverse(values);
- for (E constant : enumClass.getEnumConstants()) {
- int block = constant.ordinal() / Long.SIZE;
+ for (final E constant : enumClass.getEnumConstants()) {
+ final int block = constant.ordinal() / Long.SIZE;
if (block < values.length && (values[block] & 1 << (constant.ordinal() % Long.SIZE)) != 0) {
results.add(constant);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java Tue Jan 22 07:09:45 2013
@@ -184,7 +184,7 @@ public class LocaleUtils {
* @return the unmodifiable list of Locale objects, 0 being locale, not null
*/
public static List<Locale> localeLookupList(final Locale locale, final Locale defaultLocale) {
- List<Locale> list = new ArrayList<Locale>(4);
+ final List<Locale> list = new ArrayList<Locale>(4);
if (locale != null) {
list.add(locale);
if (locale.getVariant().length() > 0) {
@@ -256,9 +256,9 @@ public class LocaleUtils {
List<Locale> langs = cLanguagesByCountry.get(countryCode);
if (langs == null) {
langs = new ArrayList<Locale>();
- List<Locale> locales = availableLocaleList();
+ final List<Locale> locales = availableLocaleList();
for (int i = 0; i < locales.size(); i++) {
- Locale locale = locales.get(i);
+ final Locale locale = locales.get(i);
if (countryCode.equals(locale.getCountry()) &&
locale.getVariant().isEmpty()) {
langs.add(locale);
@@ -288,9 +288,9 @@ public class LocaleUtils {
List<Locale> countries = cCountriesByLanguage.get(languageCode);
if (countries == null) {
countries = new ArrayList<Locale>();
- List<Locale> locales = availableLocaleList();
+ final List<Locale> locales = availableLocaleList();
for (int i = 0; i < locales.size(); i++) {
- Locale locale = locales.get(i);
+ final Locale locale = locales.get(i);
if (languageCode.equals(locale.getLanguage()) &&
locale.getCountry().length() != 0 &&
locale.getVariant().isEmpty()) {
@@ -313,7 +313,7 @@ public class LocaleUtils {
private static final Set<Locale> AVAILABLE_LOCALE_SET;
static {
- List<Locale> list = new ArrayList<Locale>(Arrays.asList(Locale.getAvailableLocales())); // extra safe
+ final List<Locale> list = new ArrayList<Locale>(Arrays.asList(Locale.getAvailableLocales())); // extra safe
AVAILABLE_LOCALE_LIST = Collections.unmodifiableList(list);
AVAILABLE_LOCALE_SET = Collections.unmodifiableSet(new HashSet<Locale>(list));
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java Tue Jan 22 07:09:45 2013
@@ -118,7 +118,7 @@ public class ObjectUtils {
*/
public static <T> T firstNonNull(final T... values) {
if (values != null) {
- for (T val : values) {
+ for (final T val : values) {
if (val != null) {
return val;
}
@@ -222,7 +222,7 @@ public class ObjectUtils {
public static int hashCodeMulti(final Object... objects) {
int hash = 1;
if (objects != null) {
- for (Object object : objects) {
+ for (final Object object : objects) {
hash = hash * 31 + ObjectUtils.hashCode(object);
}
}
@@ -251,7 +251,7 @@ public class ObjectUtils {
if (object == null) {
return null;
}
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
identityToString(buffer, object);
return buffer.toString();
}
@@ -344,7 +344,7 @@ public class ObjectUtils {
public static <T extends Comparable<? super T>> T min(final T... values) {
T result = null;
if (values != null) {
- for (T value : values) {
+ for (final T value : values) {
if (compare(value, result, true) < 0) {
result = value;
}
@@ -369,7 +369,7 @@ public class ObjectUtils {
public static <T extends Comparable<? super T>> T max(final T... values) {
T result = null;
if (values != null) {
- for (T value : values) {
+ for (final T value : values) {
if (compare(value, result, false) > 0) {
result = value;
}
@@ -429,9 +429,10 @@ public class ObjectUtils {
public static <T extends Comparable<? super T>> T median(final T... items) {
Validate.notEmpty(items);
Validate.noNullElements(items);
- TreeSet<T> sort = new TreeSet<T>();
+ final TreeSet<T> sort = new TreeSet<T>();
Collections.addAll(sort, items);
@SuppressWarnings("unchecked") //we know all items added were T instances
+ final
T result = (T) sort.toArray()[(sort.size() - 1) / 2];
return result;
}
@@ -451,9 +452,10 @@ public class ObjectUtils {
Validate.notEmpty(items, "null/empty items");
Validate.noNullElements(items);
Validate.notNull(comparator, "null comparator");
- TreeSet<T> sort = new TreeSet<T>(comparator);
+ final TreeSet<T> sort = new TreeSet<T>(comparator);
Collections.addAll(sort, items);
@SuppressWarnings("unchecked") //we know all items added were T instances
+ final
T result = (T) sort.toArray()[(sort.size() - 1) / 2];
return result;
}
@@ -470,9 +472,9 @@ public class ObjectUtils {
*/
public static <T> T mode(final T... items) {
if (ArrayUtils.isNotEmpty(items)) {
- HashMap<T, MutableInt> occurrences = new HashMap<T, MutableInt>(items.length);
- for (T t : items) {
- MutableInt count = occurrences.get(t);
+ final HashMap<T, MutableInt> occurrences = new HashMap<T, MutableInt>(items.length);
+ for (final T t : items) {
+ final MutableInt count = occurrences.get(t);
if (count == null) {
occurrences.put(t, new MutableInt(1));
} else {
@@ -481,8 +483,8 @@ public class ObjectUtils {
}
T result = null;
int max = 0;
- for (Map.Entry<T, MutableInt> e : occurrences.entrySet()) {
- int cmp = e.getValue().intValue();
+ for (final Map.Entry<T, MutableInt> e : occurrences.entrySet()) {
+ final int cmp = e.getValue().intValue();
if (cmp == max) {
result = null;
} else if (cmp > max) {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/RandomStringUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/RandomStringUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/RandomStringUtils.java Tue Jan 22 07:09:45 2013
@@ -248,8 +248,8 @@ public class RandomStringUtils {
}
}
- char[] buffer = new char[count];
- int gap = end - start;
+ final char[] buffer = new char[count];
+ final int gap = end - start;
while (count-- != 0) {
char ch;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Range.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Range.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Range.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Range.java Tue Jan 22 07:09:45 2013
@@ -386,8 +386,8 @@ public final class Range<T> implements S
if (this.equals(other)) {
return this;
}
- T min = getComparator().compare(minimum, other.minimum) < 0 ? other.minimum : minimum;
- T max = getComparator().compare(maximum, other.maximum) < 0 ? maximum : other.maximum;
+ final T min = getComparator().compare(minimum, other.minimum) < 0 ? other.minimum : minimum;
+ final T max = getComparator().compare(maximum, other.maximum) < 0 ? maximum : other.maximum;
return between(min, max, getComparator());
}
@@ -411,6 +411,7 @@ public final class Range<T> implements S
return false;
} else {
@SuppressWarnings("unchecked") // OK because we checked the class above
+ final
Range<T> range = (Range<T>) obj;
return minimum.equals(range.minimum) &&
maximum.equals(range.maximum);
@@ -446,7 +447,7 @@ public final class Range<T> implements S
public String toString() {
String result = toString;
if (result == null) {
- StringBuilder buf = new StringBuilder(32);
+ final StringBuilder buf = new StringBuilder(32);
buf.append('[');
buf.append(minimum);
buf.append("..");
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java Tue Jan 22 07:09:45 2013
@@ -79,8 +79,8 @@ public class SerializationUtils {
if (object == null) {
return null;
}
- byte[] objectData = serialize(object);
- ByteArrayInputStream bais = new ByteArrayInputStream(objectData);
+ final byte[] objectData = serialize(object);
+ final ByteArrayInputStream bais = new ByteArrayInputStream(objectData);
ClassLoaderAwareObjectInputStream in = null;
try {
@@ -92,19 +92,20 @@ public class SerializationUtils {
* is of the same type as the original serialized object
*/
@SuppressWarnings("unchecked") // see above
+ final
T readObject = (T) in.readObject();
return readObject;
- } catch (ClassNotFoundException ex) {
+ } catch (final ClassNotFoundException ex) {
throw new SerializationException("ClassNotFoundException while reading cloned object data", ex);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new SerializationException("IOException while reading cloned object data", ex);
} finally {
try {
if (in != null) {
in.close();
}
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new SerializationException("IOException on closing cloned object data InputStream.", ex);
}
}
@@ -137,14 +138,14 @@ public class SerializationUtils {
out = new ObjectOutputStream(outputStream);
out.writeObject(obj);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new SerializationException(ex);
} finally {
try {
if (out != null) {
out.close();
}
- } catch (IOException ex) { // NOPMD
+ } catch (final IOException ex) { // NOPMD
// ignore close exception
}
}
@@ -159,7 +160,7 @@ public class SerializationUtils {
* @throws SerializationException (runtime) if the serialization fails
*/
public static byte[] serialize(final Serializable obj) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
serialize(obj, baos);
return baos.toByteArray();
}
@@ -207,16 +208,16 @@ public class SerializationUtils {
in = new ObjectInputStream(inputStream);
return (T) in.readObject();
- } catch (ClassNotFoundException ex) {
+ } catch (final ClassNotFoundException ex) {
throw new SerializationException(ex);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new SerializationException(ex);
} finally {
try {
if (in != null) {
in.close();
}
- } catch (IOException ex) { // NOPMD
+ } catch (final IOException ex) { // NOPMD
// ignore close exception
}
}
@@ -300,14 +301,14 @@ public class SerializationUtils {
*/
@Override
protected Class<?> resolveClass(final ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- String name = desc.getName();
+ final String name = desc.getName();
try {
return Class.forName(name, false, classLoader);
- } catch (ClassNotFoundException ex) {
+ } catch (final ClassNotFoundException ex) {
try {
return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException cnfe) {
- Class<?> cls = primitiveTypes.get(name);
+ } catch (final ClassNotFoundException cnfe) {
+ final Class<?> cls = primitiveTypes.get(name);
if (cls != null) {
return cls;
} else {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java Tue Jan 22 07:09:45 2013
@@ -286,7 +286,7 @@ public class StringEscapeUtils {
}
// strip quotes
- String quoteless = input.subSequence(1, input.length() - 1).toString();
+ final String quoteless = input.subSequence(1, input.length() - 1).toString();
if ( StringUtils.containsAny(quoteless, CSV_SEARCH_CHARS) ) {
// deal with escaped quotes; ie) ""
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Tue Jan 22 07:09:45 2013
@@ -316,7 +316,7 @@ public class StringUtils {
* @since 2.0
*/
public static String trimToNull(final String str) {
- String ts = trim(str);
+ final String ts = trim(str);
return isEmpty(ts) ? null : ts;
}
@@ -608,7 +608,7 @@ public class StringUtils {
if (strs == null || (strsLen = strs.length) == 0) {
return strs;
}
- String[] newArr = new String[strsLen];
+ final String[] newArr = new String[strsLen];
for (int i = 0; i < strsLen; i++) {
newArr[i] = strip(strs[i], stripChars);
}
@@ -637,8 +637,8 @@ public class StringUtils {
if(input == null) {
return null;
}
- Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");//$NON-NLS-1$
- String decomposed = Normalizer.normalize(input, Normalizer.Form.NFD);
+ final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");//$NON-NLS-1$
+ final String decomposed = Normalizer.normalize(input, Normalizer.Form.NFD);
// Note that this doesn't correctly remove ligatures...
return pattern.matcher(decomposed).replaceAll("");//$NON-NLS-1$
}
@@ -988,7 +988,7 @@ public class StringUtils {
if (startPos < 0) {
startPos = 0;
}
- int endLimit = str.length() - searchStr.length() + 1;
+ final int endLimit = str.length() - searchStr.length() + 1;
if (startPos > endLimit) {
return INDEX_NOT_FOUND;
}
@@ -1338,8 +1338,8 @@ public class StringUtils {
if (str == null || searchStr == null) {
return false;
}
- int len = searchStr.length();
- int max = str.length() - len;
+ final int len = searchStr.length();
+ final int max = str.length() - len;
for (int i = 0; i <= max; i++) {
if (CharSequenceUtils.regionMatches(str, true, i, searchStr, 0, len)) {
return true;
@@ -1361,7 +1361,7 @@ public class StringUtils {
if (isEmpty(seq)) {
return false;
}
- int strLen = seq.length();
+ final int strLen = seq.length();
for (int i = 0; i < strLen; i++) {
if (Character.isWhitespace(seq.charAt(i))) {
return true;
@@ -1399,12 +1399,12 @@ public class StringUtils {
if (isEmpty(cs) || ArrayUtils.isEmpty(searchChars)) {
return INDEX_NOT_FOUND;
}
- int csLen = cs.length();
- int csLast = csLen - 1;
- int searchLen = searchChars.length;
- int searchLast = searchLen - 1;
+ final int csLen = cs.length();
+ final int csLast = csLen - 1;
+ final int searchLen = searchChars.length;
+ final int searchLast = searchLen - 1;
for (int i = 0; i < csLen; i++) {
- char ch = cs.charAt(i);
+ final char ch = cs.charAt(i);
for (int j = 0; j < searchLen; j++) {
if (searchChars[j] == ch) {
if (i < csLast && j < searchLast && Character.isHighSurrogate(ch)) {
@@ -1481,12 +1481,12 @@ public class StringUtils {
if (isEmpty(cs) || ArrayUtils.isEmpty(searchChars)) {
return false;
}
- int csLength = cs.length();
- int searchLength = searchChars.length;
- int csLast = csLength - 1;
- int searchLast = searchLength - 1;
+ final int csLength = cs.length();
+ final int searchLength = searchChars.length;
+ final int csLast = csLength - 1;
+ final int searchLast = searchLength - 1;
for (int i = 0; i < csLength; i++) {
- char ch = cs.charAt(i);
+ final char ch = cs.charAt(i);
for (int j = 0; j < searchLength; j++) {
if (searchChars[j] == ch) {
if (Character.isHighSurrogate(ch)) {
@@ -1572,13 +1572,13 @@ public class StringUtils {
if (isEmpty(cs) || ArrayUtils.isEmpty(searchChars)) {
return INDEX_NOT_FOUND;
}
- int csLen = cs.length();
- int csLast = csLen - 1;
- int searchLen = searchChars.length;
- int searchLast = searchLen - 1;
+ final int csLen = cs.length();
+ final int csLast = csLen - 1;
+ final int searchLen = searchChars.length;
+ final int searchLast = searchLen - 1;
outer:
for (int i = 0; i < csLen; i++) {
- char ch = cs.charAt(i);
+ final char ch = cs.charAt(i);
for (int j = 0; j < searchLen; j++) {
if (searchChars[j] == ch) {
if (i < csLast && j < searchLast && Character.isHighSurrogate(ch)) {
@@ -1622,12 +1622,12 @@ public class StringUtils {
if (isEmpty(seq) || isEmpty(searchChars)) {
return INDEX_NOT_FOUND;
}
- int strLen = seq.length();
+ final int strLen = seq.length();
for (int i = 0; i < strLen; i++) {
- char ch = seq.charAt(i);
- boolean chFound = CharSequenceUtils.indexOf(searchChars, ch, 0) >= 0;
+ final char ch = seq.charAt(i);
+ final boolean chFound = CharSequenceUtils.indexOf(searchChars, ch, 0) >= 0;
if (i + 1 < strLen && Character.isHighSurrogate(ch)) {
- char ch2 = seq.charAt(i + 1);
+ final char ch2 = seq.charAt(i + 1);
if (chFound && CharSequenceUtils.indexOf(searchChars, ch2, 0) < 0) {
return i;
}
@@ -1737,12 +1737,12 @@ public class StringUtils {
if (cs == null || searchChars == null) {
return true;
}
- int csLen = cs.length();
- int csLast = csLen - 1;
- int searchLen = searchChars.length;
- int searchLast = searchLen - 1;
+ final int csLen = cs.length();
+ final int csLast = csLen - 1;
+ final int searchLen = searchChars.length;
+ final int searchLast = searchLen - 1;
for (int i = 0; i < csLen; i++) {
- char ch = cs.charAt(i);
+ final char ch = cs.charAt(i);
for (int j = 0; j < searchLen; j++) {
if (searchChars[j] == ch) {
if (Character.isHighSurrogate(ch)) {
@@ -1826,14 +1826,14 @@ public class StringUtils {
if (str == null || searchStrs == null) {
return INDEX_NOT_FOUND;
}
- int sz = searchStrs.length;
+ final int sz = searchStrs.length;
// String's can't have a MAX_VALUEth index.
int ret = Integer.MAX_VALUE;
int tmp = 0;
for (int i = 0; i < sz; i++) {
- CharSequence search = searchStrs[i];
+ final CharSequence search = searchStrs[i];
if (search == null) {
continue;
}
@@ -1880,11 +1880,11 @@ public class StringUtils {
if (str == null || searchStrs == null) {
return INDEX_NOT_FOUND;
}
- int sz = searchStrs.length;
+ final int sz = searchStrs.length;
int ret = INDEX_NOT_FOUND;
int tmp = 0;
for (int i = 0; i < sz; i++) {
- CharSequence search = searchStrs[i];
+ final CharSequence search = searchStrs[i];
if (search == null) {
continue;
}
@@ -2155,7 +2155,7 @@ public class StringUtils {
if (separator.length() == 0) {
return EMPTY;
}
- int pos = str.indexOf(separator);
+ final int pos = str.indexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return str;
}
@@ -2197,7 +2197,7 @@ public class StringUtils {
if (separator == null) {
return EMPTY;
}
- int pos = str.indexOf(separator);
+ final int pos = str.indexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return EMPTY;
}
@@ -2235,7 +2235,7 @@ public class StringUtils {
if (isEmpty(str) || isEmpty(separator)) {
return str;
}
- int pos = str.lastIndexOf(separator);
+ final int pos = str.lastIndexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return str;
}
@@ -2278,7 +2278,7 @@ public class StringUtils {
if (isEmpty(separator)) {
return EMPTY;
}
- int pos = str.lastIndexOf(separator);
+ final int pos = str.lastIndexOf(separator);
if (pos == INDEX_NOT_FOUND || pos == str.length() - separator.length()) {
return EMPTY;
}
@@ -2343,9 +2343,9 @@ public class StringUtils {
if (str == null || open == null || close == null) {
return null;
}
- int start = str.indexOf(open);
+ final int start = str.indexOf(open);
if (start != INDEX_NOT_FOUND) {
- int end = str.indexOf(close, start + open.length());
+ final int end = str.indexOf(close, start + open.length());
if (end != INDEX_NOT_FOUND) {
return str.substring(start + open.length(), end);
}
@@ -2379,13 +2379,13 @@ public class StringUtils {
if (str == null || isEmpty(open) || isEmpty(close)) {
return null;
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
- int closeLen = close.length();
- int openLen = open.length();
- List<String> list = new ArrayList<String>();
+ final int closeLen = close.length();
+ final int openLen = open.length();
+ final List<String> list = new ArrayList<String>();
int pos = 0;
while (pos < strLen - closeLen) {
int start = str.indexOf(open, pos);
@@ -2393,7 +2393,7 @@ public class StringUtils {
break;
}
start += openLen;
- int end = str.indexOf(close, start);
+ final int end = str.indexOf(close, start);
if (end < 0) {
break;
}
@@ -2668,7 +2668,7 @@ public class StringUtils {
return null;
}
- int len = str.length();
+ final int len = str.length();
if (len == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
@@ -2679,9 +2679,9 @@ public class StringUtils {
return splitWorker(str, null, max, preserveAllTokens);
}
- int separatorLength = separator.length();
+ final int separatorLength = separator.length();
- ArrayList<String> substrings = new ArrayList<String>();
+ final ArrayList<String> substrings = new ArrayList<String>();
int numberOfSubstrings = 0;
int beg = 0;
int end = 0;
@@ -2811,11 +2811,11 @@ public class StringUtils {
if (str == null) {
return null;
}
- int len = str.length();
+ final int len = str.length();
if (len == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
- List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<String>();
int i = 0, start = 0;
boolean match = false;
boolean lastMatch = false;
@@ -2938,11 +2938,11 @@ public class StringUtils {
if (str == null) {
return null;
}
- int len = str.length();
+ final int len = str.length();
if (len == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
- List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<String>();
int sizePlus1 = 1;
int i = 0, start = 0;
boolean match = false;
@@ -2969,7 +2969,7 @@ public class StringUtils {
}
} else if (separatorChars.length() == 1) {
// Optimise 1 character case
- char sep = separatorChars.charAt(0);
+ final char sep = separatorChars.charAt(0);
while (i < len) {
if (str.charAt(i) == sep) {
if (match || preserveAllTokens) {
@@ -3087,17 +3087,17 @@ public class StringUtils {
if (str.length() == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
- char[] c = str.toCharArray();
- List<String> list = new ArrayList<String>();
+ final char[] c = str.toCharArray();
+ final List<String> list = new ArrayList<String>();
int tokenStart = 0;
int currentType = Character.getType(c[tokenStart]);
for (int pos = tokenStart + 1; pos < c.length; pos++) {
- int type = Character.getType(c[pos]);
+ final int type = Character.getType(c[pos]);
if (type == currentType) {
continue;
}
if (camelCase && type == Character.LOWERCASE_LETTER && currentType == Character.UPPERCASE_LETTER) {
- int newTokenStart = pos - 1;
+ final int newTokenStart = pos - 1;
if (newTokenStart != tokenStart) {
list.add(new String(c, tokenStart, newTokenStart - tokenStart));
tokenStart = newTokenStart;
@@ -3424,11 +3424,11 @@ public class StringUtils {
if (array == null) {
return null;
}
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -3475,11 +3475,11 @@ public class StringUtils {
if (array == null) {
return null;
}
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -3524,11 +3524,11 @@ public class StringUtils {
if (array == null) {
return null;
}
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -3573,11 +3573,11 @@ public class StringUtils {
if (array == null) {
return null;
}
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -3622,11 +3622,11 @@ public class StringUtils {
if (array == null) {
return null;
}
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -3671,11 +3671,11 @@ public class StringUtils {
if (array == null) {
return null;
}
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -3720,11 +3720,11 @@ public class StringUtils {
if (array == null) {
return null;
}
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -3769,11 +3769,11 @@ public class StringUtils {
if (array == null) {
return null;
}
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -3859,12 +3859,12 @@ public class StringUtils {
// endIndex - startIndex > 0: Len = NofStrings *(len(firstString) + len(separator))
// (Assuming that all Strings are roughly equally long)
- int noOfItems = endIndex - startIndex;
+ final int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
- StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
@@ -3900,20 +3900,20 @@ public class StringUtils {
if (!iterator.hasNext()) {
return EMPTY;
}
- Object first = iterator.next();
+ final Object first = iterator.next();
if (!iterator.hasNext()) {
return ObjectUtils.toString(first);
}
// two or more elements
- StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small
+ final StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small
if (first != null) {
buf.append(first);
}
while (iterator.hasNext()) {
buf.append(separator);
- Object obj = iterator.next();
+ final Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
@@ -3944,13 +3944,13 @@ public class StringUtils {
if (!iterator.hasNext()) {
return EMPTY;
}
- Object first = iterator.next();
+ final Object first = iterator.next();
if (!iterator.hasNext()) {
return ObjectUtils.toString(first);
}
// two or more elements
- StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small
+ final StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small
if (first != null) {
buf.append(first);
}
@@ -3959,7 +3959,7 @@ public class StringUtils {
if (separator != null) {
buf.append(separator);
}
- Object obj = iterator.next();
+ final Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
@@ -4029,8 +4029,8 @@ public class StringUtils {
if (isEmpty(str)) {
return str;
}
- int sz = str.length();
- char[] chs = new char[sz];
+ final int sz = str.length();
+ final char[] chs = new char[sz];
int count = 0;
for (int i = 0; i < sz; i++) {
if (!Character.isWhitespace(str.charAt(i))) {
@@ -4237,7 +4237,7 @@ public class StringUtils {
if (isEmpty(str) || str.indexOf(remove) == INDEX_NOT_FOUND) {
return str;
}
- char[] chars = str.toCharArray();
+ final char[] chars = str.toCharArray();
int pos = 0;
for (int i = 0; i < chars.length; i++) {
if (chars[i] != remove) {
@@ -4380,11 +4380,11 @@ public class StringUtils {
if (end == INDEX_NOT_FOUND) {
return text;
}
- int replLength = searchString.length();
+ final int replLength = searchString.length();
int increase = replacement.length() - replLength;
increase = increase < 0 ? 0 : increase;
increase *= max < 0 ? 16 : max > 64 ? 64 : max;
- StringBuilder buf = new StringBuilder(text.length() + increase);
+ final StringBuilder buf = new StringBuilder(text.length() + increase);
while (end != INDEX_NOT_FOUND) {
buf.append(text.substring(start, end)).append(replacement);
start = end + replLength;
@@ -4487,7 +4487,7 @@ public class StringUtils {
public static String replaceEachRepeatedly(final String text, final String[] searchList, final String[] replacementList) {
// timeToLive should be 0 if not used or nothing to replace, else it's
// the length of the replace array
- int timeToLive = searchList == null ? 0 : searchList.length;
+ final int timeToLive = searchList == null ? 0 : searchList.length;
return replaceEach(text, searchList, replacementList, true, timeToLive);
}
@@ -4556,8 +4556,8 @@ public class StringUtils {
"output of one loop is the input of another");
}
- int searchLength = searchList.length;
- int replacementLength = replacementList.length;
+ final int searchLength = searchList.length;
+ final int replacementLength = replacementList.length;
// make sure lengths are ok, these need to be equal
if (searchLength != replacementLength) {
@@ -4568,7 +4568,7 @@ public class StringUtils {
}
// keep track of which still have matches
- boolean[] noMoreMatchesForReplIndex = new boolean[searchLength];
+ final boolean[] noMoreMatchesForReplIndex = new boolean[searchLength];
// index on index that the match was found
int textIndex = -1;
@@ -4611,7 +4611,7 @@ public class StringUtils {
if (searchList[i] == null || replacementList[i] == null) {
continue;
}
- int greater = replacementList[i].length() - searchList[i].length();
+ final int greater = replacementList[i].length() - searchList[i].length();
if (greater > 0) {
increase += 3 * greater; // assume 3 matches
}
@@ -4619,7 +4619,7 @@ public class StringUtils {
// have upper-bound at 20% increase, then let Java take over
increase = Math.min(increase, text.length() / 5);
- StringBuilder buf = new StringBuilder(text.length() + increase);
+ final StringBuilder buf = new StringBuilder(text.length() + increase);
while (textIndex != -1) {
@@ -4655,11 +4655,11 @@ public class StringUtils {
// NOTE: logic duplicated above END
}
- int textLength = text.length();
+ final int textLength = text.length();
for (int i = start; i < textLength; i++) {
buf.append(text.charAt(i));
}
- String result = buf.toString();
+ final String result = buf.toString();
if (!repeat) {
return result;
}
@@ -4740,12 +4740,12 @@ public class StringUtils {
replaceChars = EMPTY;
}
boolean modified = false;
- int replaceCharsLength = replaceChars.length();
- int strLength = str.length();
- StringBuilder buf = new StringBuilder(strLength);
+ final int replaceCharsLength = replaceChars.length();
+ final int strLength = str.length();
+ final StringBuilder buf = new StringBuilder(strLength);
for (int i = 0; i < strLength; i++) {
- char ch = str.charAt(i);
- int index = searchChars.indexOf(ch);
+ final char ch = str.charAt(i);
+ final int index = searchChars.indexOf(ch);
if (index >= 0) {
modified = true;
if (index < replaceCharsLength) {
@@ -4799,7 +4799,7 @@ public class StringUtils {
if (overlay == null) {
overlay = EMPTY;
}
- int len = str.length();
+ final int len = str.length();
if (start < 0) {
start = 0;
}
@@ -4813,7 +4813,7 @@ public class StringUtils {
end = len;
}
if (start > end) {
- int temp = start;
+ final int temp = start;
start = end;
end = temp;
}
@@ -4857,7 +4857,7 @@ public class StringUtils {
}
if (str.length() == 1) {
- char ch = str.charAt(0);
+ final char ch = str.charAt(0);
if (ch == CharUtils.CR || ch == CharUtils.LF) {
return EMPTY;
}
@@ -4865,7 +4865,7 @@ public class StringUtils {
}
int lastIdx = str.length() - 1;
- char last = str.charAt(lastIdx);
+ final char last = str.charAt(lastIdx);
if (last == CharUtils.LF) {
if (str.charAt(lastIdx - 1) == CharUtils.CR) {
@@ -4938,13 +4938,13 @@ public class StringUtils {
if (str == null) {
return null;
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen < 2) {
return EMPTY;
}
- int lastIdx = strLen - 1;
- String ret = str.substring(0, lastIdx);
- char last = str.charAt(lastIdx);
+ final int lastIdx = strLen - 1;
+ final String ret = str.substring(0, lastIdx);
+ final char last = str.charAt(lastIdx);
if (last == CharUtils.LF && ret.charAt(lastIdx - 1) == CharUtils.CR) {
return ret.substring(0, lastIdx - 1);
}
@@ -4983,7 +4983,7 @@ public class StringUtils {
if (repeat <= 0) {
return EMPTY;
}
- int inputLength = str.length();
+ final int inputLength = str.length();
if (repeat == 1 || inputLength == 0) {
return str;
}
@@ -4991,21 +4991,21 @@ public class StringUtils {
return repeat(str.charAt(0), repeat);
}
- int outputLength = inputLength * repeat;
+ final int outputLength = inputLength * repeat;
switch (inputLength) {
case 1 :
return repeat(str.charAt(0), repeat);
case 2 :
- char ch0 = str.charAt(0);
- char ch1 = str.charAt(1);
- char[] output2 = new char[outputLength];
+ final char ch0 = str.charAt(0);
+ final char ch1 = str.charAt(1);
+ final char[] output2 = new char[outputLength];
for (int i = repeat * 2 - 2; i >= 0; i--, i--) {
output2[i] = ch0;
output2[i + 1] = ch1;
}
return new String(output2);
default :
- StringBuilder buf = new StringBuilder(outputLength);
+ final StringBuilder buf = new StringBuilder(outputLength);
for (int i = 0; i < repeat; i++) {
buf.append(str);
}
@@ -5038,7 +5038,7 @@ public class StringUtils {
return repeat(str, repeat);
} else {
// given that repeat(String, int) is quite optimized, better to rely on it than try and splice this into it
- String result = repeat(str + separator, repeat);
+ final String result = repeat(str + separator, repeat);
return removeEnd(result, separator);
}
}
@@ -5066,7 +5066,7 @@ public class StringUtils {
* @see #repeat(String, int)
*/
public static String repeat(final char ch, final int repeat) {
- char[] buf = new char[repeat];
+ final char[] buf = new char[repeat];
for (int i = repeat - 1; i >= 0; i--) {
buf[i] = ch;
}
@@ -5121,7 +5121,7 @@ public class StringUtils {
if (str == null) {
return null;
}
- int pads = size - str.length();
+ final int pads = size - str.length();
if (pads <= 0) {
return str; // returns original String when possible
}
@@ -5161,9 +5161,9 @@ public class StringUtils {
if (isEmpty(padStr)) {
padStr = SPACE;
}
- int padLen = padStr.length();
- int strLen = str.length();
- int pads = size - strLen;
+ final int padLen = padStr.length();
+ final int strLen = str.length();
+ final int pads = size - strLen;
if (pads <= 0) {
return str; // returns original String when possible
}
@@ -5176,8 +5176,8 @@ public class StringUtils {
} else if (pads < padLen) {
return str.concat(padStr.substring(0, pads));
} else {
- char[] padding = new char[pads];
- char[] padChars = padStr.toCharArray();
+ final char[] padding = new char[pads];
+ final char[] padChars = padStr.toCharArray();
for (int i = 0; i < pads; i++) {
padding[i] = padChars[i % padLen];
}
@@ -5233,7 +5233,7 @@ public class StringUtils {
if (str == null) {
return null;
}
- int pads = size - str.length();
+ final int pads = size - str.length();
if (pads <= 0) {
return str; // returns original String when possible
}
@@ -5273,9 +5273,9 @@ public class StringUtils {
if (isEmpty(padStr)) {
padStr = SPACE;
}
- int padLen = padStr.length();
- int strLen = str.length();
- int pads = size - strLen;
+ final int padLen = padStr.length();
+ final int strLen = str.length();
+ final int pads = size - strLen;
if (pads <= 0) {
return str; // returns original String when possible
}
@@ -5288,8 +5288,8 @@ public class StringUtils {
} else if (pads < padLen) {
return padStr.substring(0, pads).concat(str);
} else {
- char[] padding = new char[pads];
- char[] padChars = padStr.toCharArray();
+ final char[] padding = new char[pads];
+ final char[] padChars = padStr.toCharArray();
for (int i = 0; i < pads; i++) {
padding[i] = padChars[i % padLen];
}
@@ -5369,8 +5369,8 @@ public class StringUtils {
if (str == null || size <= 0) {
return str;
}
- int strLen = str.length();
- int pads = size - strLen;
+ final int strLen = str.length();
+ final int pads = size - strLen;
if (pads <= 0) {
return str;
}
@@ -5412,8 +5412,8 @@ public class StringUtils {
if (isEmpty(padStr)) {
padStr = SPACE;
}
- int strLen = str.length();
- int pads = size - strLen;
+ final int strLen = str.length();
+ final int pads = size - strLen;
if (pads <= 0) {
return str;
}
@@ -5616,10 +5616,10 @@ public class StringUtils {
return str;
}
- char[] buffer = str.toCharArray();
+ final char[] buffer = str.toCharArray();
for (int i = 0; i < buffer.length; i++) {
- char ch = buffer[i];
+ final char ch = buffer[i];
if (Character.isUpperCase(ch)) {
buffer[i] = Character.toLowerCase(ch);
} else if (Character.isTitleCase(ch)) {
@@ -5692,7 +5692,7 @@ public class StringUtils {
if (cs == null || cs.length() == 0) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isLetter(cs.charAt(i)) == false) {
return false;
@@ -5727,7 +5727,7 @@ public class StringUtils {
if (cs == null) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isLetter(cs.charAt(i)) == false && cs.charAt(i) != ' ') {
return false;
@@ -5762,7 +5762,7 @@ public class StringUtils {
if (cs == null || cs.length() == 0) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isLetterOrDigit(cs.charAt(i)) == false) {
return false;
@@ -5797,7 +5797,7 @@ public class StringUtils {
if (cs == null) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isLetterOrDigit(cs.charAt(i)) == false && cs.charAt(i) != ' ') {
return false;
@@ -5836,7 +5836,7 @@ public class StringUtils {
if (cs == null) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (CharUtils.isAsciiPrintable(cs.charAt(i)) == false) {
return false;
@@ -5879,7 +5879,7 @@ public class StringUtils {
if (cs == null || cs.length() == 0) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isDigit(cs.charAt(i)) == false) {
return false;
@@ -5916,7 +5916,7 @@ public class StringUtils {
if (cs == null) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isDigit(cs.charAt(i)) == false && cs.charAt(i) != ' ') {
return false;
@@ -5949,7 +5949,7 @@ public class StringUtils {
if (cs == null) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isWhitespace(cs.charAt(i)) == false) {
return false;
@@ -5981,7 +5981,7 @@ public class StringUtils {
if (cs == null || isEmpty(cs)) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isLowerCase(cs.charAt(i)) == false) {
return false;
@@ -6013,7 +6013,7 @@ public class StringUtils {
if (cs == null || isEmpty(cs)) {
return false;
}
- int sz = cs.length();
+ final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isUpperCase(cs.charAt(i)) == false) {
return false;
@@ -6157,7 +6157,7 @@ public class StringUtils {
}
// could implement manually, but simple way is to reuse other,
// probably slower, methods.
- String[] strs = split(str, separatorChar);
+ final String[] strs = split(str, separatorChar);
ArrayUtils.reverse(strs);
return join(strs, separatorChar);
}
@@ -6302,11 +6302,11 @@ public class StringUtils {
return str;
}
- int targetSting = length-middle.length();
- int startOffset = targetSting/2+targetSting%2;
- int endOffset = str.length()-targetSting/2;
+ final int targetSting = length-middle.length();
+ final int startOffset = targetSting/2+targetSting%2;
+ final int endOffset = str.length()-targetSting/2;
- StringBuilder builder = new StringBuilder(length);
+ final StringBuilder builder = new StringBuilder(length);
builder.append(str.substring(0,startOffset));
builder.append(middle);
builder.append(str.substring(endOffset));
@@ -6348,7 +6348,7 @@ public class StringUtils {
if (str2 == null) {
return str1;
}
- int at = indexOfDifference(str1, str2);
+ final int at = indexOfDifference(str1, str2);
if (at == INDEX_NOT_FOUND) {
return EMPTY;
}
@@ -6437,7 +6437,7 @@ public class StringUtils {
}
boolean anyStringNull = false;
boolean allStringsNull = true;
- int arrayLen = css.length;
+ final int arrayLen = css.length;
int shortestStrLen = Integer.MAX_VALUE;
int longestStrLen = 0;
@@ -6468,7 +6468,7 @@ public class StringUtils {
// find the position with the first difference across all strings
int firstDiff = -1;
for (int stringPos = 0; stringPos < shortestStrLen; stringPos++) {
- char comparisonChar = css[0].charAt(stringPos);
+ final char comparisonChar = css[0].charAt(stringPos);
for (int arrayPos = 1; arrayPos < arrayLen; arrayPos++) {
if (css[arrayPos].charAt(stringPos) != comparisonChar) {
firstDiff = stringPos;
@@ -6526,7 +6526,7 @@ public class StringUtils {
if (strs == null || strs.length == 0) {
return EMPTY;
}
- int smallestIndexOfDiff = indexOfDifference(strs);
+ final int smallestIndexOfDiff = indexOfDifference(strs);
if (smallestIndexOfDiff == INDEX_NOT_FOUND) {
// all strings were identical
if (strs[0] == null) {
@@ -6613,7 +6613,7 @@ public class StringUtils {
if (n > m) {
// swap the input strings to consume less memory
- CharSequence tmp = s;
+ final CharSequence tmp = s;
s = t;
t = tmp;
n = m;
@@ -6753,7 +6753,7 @@ public class StringUtils {
if (n > m) {
// swap the two strings to consume less memory
- CharSequence tmp = s;
+ final CharSequence tmp = s;
s = t;
t = tmp;
n = m;
@@ -6765,7 +6765,7 @@ public class StringUtils {
int _d[]; // placeholder to assist in swapping p and d
// fill in starting table values
- int boundary = Math.min(n, threshold) + 1;
+ final int boundary = Math.min(n, threshold) + 1;
for (int i = 0; i < boundary; i++) {
p[i] = i;
}
@@ -6776,12 +6776,12 @@ public class StringUtils {
// iterates through t
for (int j = 1; j <= m; j++) {
- char t_j = t.charAt(j - 1); // jth character of t
+ final char t_j = t.charAt(j - 1); // jth character of t
d[0] = j;
// compute stripe indices, constrain to array size
- int min = Math.max(1, j - threshold);
- int max = Math.min(n, j + threshold);
+ final int min = Math.max(1, j - threshold);
+ final int max = Math.min(n, j + threshold);
// the stripe may lead off of the table if s and t are of different sizes
if (min > max) {
@@ -6918,7 +6918,7 @@ public class StringUtils {
if (isEmpty(string) || ArrayUtils.isEmpty(searchStrings)) {
return false;
}
- for (CharSequence searchString : searchStrings) {
+ for (final CharSequence searchString : searchStrings) {
if (StringUtils.startsWith(string, searchString)) {
return true;
}
@@ -7001,7 +7001,7 @@ public class StringUtils {
if (suffix.length() > str.length()) {
return false;
}
- int strOffset = str.length() - suffix.length();
+ final int strOffset = str.length() - suffix.length();
return CharSequenceUtils.regionMatches(str, ignoreCase, strOffset, suffix, 0, suffix.length());
}
@@ -7075,7 +7075,7 @@ public class StringUtils {
if (isEmpty(string) || ArrayUtils.isEmpty(searchStrings)) {
return false;
}
- for (CharSequence searchString : searchStrings) {
+ for (final CharSequence searchString : searchStrings) {
if (StringUtils.endsWith(string, searchString)) {
return true;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java Tue Jan 22 07:09:45 2013
@@ -1319,7 +1319,7 @@ public class SystemUtils {
private static String getSystemProperty(final String property) {
try {
return System.getProperty(property);
- } catch (SecurityException ex) {
+ } catch (final SecurityException ex) {
// we are not allowed to look at this property
System.err.println("Caught a SecurityException reading the system property '" + property
+ "'; the SystemUtils property value will default to null.");
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java Tue Jan 22 07:09:45 2013
@@ -506,7 +506,7 @@ public class Validate {
Validate.notNull(array);
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
- Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i));
+ final Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i));
throw new IllegalArgumentException(String.format(message, values2));
}
}
@@ -567,9 +567,9 @@ public class Validate {
public static <T extends Iterable<?>> T noNullElements(final T iterable, final String message, final Object... values) {
Validate.notNull(iterable);
int i = 0;
- for (Iterator<?> it = iterable.iterator(); it.hasNext(); i++) {
+ for (final Iterator<?> it = iterable.iterator(); it.hasNext(); i++) {
if (it.next() == null) {
- Object[] values2 = ArrayUtils.addAll(values, Integer.valueOf(i));
+ final Object[] values2 = ArrayUtils.addAll(values, Integer.valueOf(i));
throw new IllegalArgumentException(String.format(message, values2));
}
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java Tue Jan 22 07:09:45 2013
@@ -282,7 +282,7 @@ public class CompareToBuilder implements
if (!lhsClazz.isInstance(rhs)) {
throw new ClassCastException();
}
- CompareToBuilder compareToBuilder = new CompareToBuilder();
+ final CompareToBuilder compareToBuilder = new CompareToBuilder();
reflectionAppend(lhs, rhs, lhsClazz, compareToBuilder, compareTransients, excludeFields);
while (lhsClazz.getSuperclass() != null && lhsClazz != reflectUpToClass) {
lhsClazz = lhsClazz.getSuperclass();
@@ -310,17 +310,17 @@ public class CompareToBuilder implements
final boolean useTransients,
final String[] excludeFields) {
- Field[] fields = clazz.getDeclaredFields();
+ final Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (int i = 0; i < fields.length && builder.comparison == 0; i++) {
- Field f = fields[i];
+ final Field f = fields[i];
if (!ArrayUtils.contains(excludeFields, f.getName())
&& (f.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(f.getModifiers()))
&& (!Modifier.isStatic(f.getModifiers()))) {
try {
builder.append(f.get(lhs), f.get(rhs));
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// This can't happen. Would get a Security exception instead.
// Throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected IllegalAccessException");
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java Tue Jan 22 07:09:45 2013
@@ -132,8 +132,8 @@ public class EqualsBuilder implements Bu
* @return the pair
*/
static Pair<IDKey, IDKey> getRegisterPair(final Object lhs, final Object rhs) {
- IDKey left = new IDKey(lhs);
- IDKey right = new IDKey(rhs);
+ final IDKey left = new IDKey(lhs);
+ final IDKey right = new IDKey(rhs);
return Pair.of(left, right);
}
@@ -151,9 +151,9 @@ public class EqualsBuilder implements Bu
* @since 3.0
*/
static boolean isRegistered(final Object lhs, final Object rhs) {
- Set<Pair<IDKey, IDKey>> registry = getRegistry();
- Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
- Pair<IDKey, IDKey> swappedPair = Pair.of(pair.getLeft(), pair.getRight());
+ final Set<Pair<IDKey, IDKey>> registry = getRegistry();
+ final Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
+ final Pair<IDKey, IDKey> swappedPair = Pair.of(pair.getLeft(), pair.getRight());
return registry != null
&& (registry.contains(pair) || registry.contains(swappedPair));
@@ -175,8 +175,8 @@ public class EqualsBuilder implements Bu
}
}
- Set<Pair<IDKey, IDKey>> registry = getRegistry();
- Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
+ final Set<Pair<IDKey, IDKey>> registry = getRegistry();
+ final Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
registry.add(pair);
}
@@ -195,7 +195,7 @@ public class EqualsBuilder implements Bu
static void unregister(final Object lhs, final Object rhs) {
Set<Pair<IDKey, IDKey>> registry = getRegistry();
if (registry != null) {
- Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
+ final Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
registry.remove(pair);
synchronized (EqualsBuilder.class) {
//read again
@@ -333,8 +333,8 @@ public class EqualsBuilder implements Bu
// class or in classes between the leaf and root.
// If we are not testing transients or a subclass has no ivars,
// then a subclass can test equals to a superclass.
- Class<?> lhsClass = lhs.getClass();
- Class<?> rhsClass = rhs.getClass();
+ final Class<?> lhsClass = lhs.getClass();
+ final Class<?> rhsClass = rhs.getClass();
Class<?> testClass;
if (lhsClass.isInstance(rhs)) {
testClass = lhsClass;
@@ -352,14 +352,14 @@ public class EqualsBuilder implements Bu
// The two classes are not related.
return false;
}
- EqualsBuilder equalsBuilder = new EqualsBuilder();
+ final EqualsBuilder equalsBuilder = new EqualsBuilder();
try {
reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients, excludeFields);
while (testClass.getSuperclass() != null && testClass != reflectUpToClass) {
testClass = testClass.getSuperclass();
reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients, excludeFields);
}
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// In this case, we tried to test a subclass vs. a superclass and
// the subclass has ivars or the ivars are transient and
// we are testing transients.
@@ -395,17 +395,17 @@ public class EqualsBuilder implements Bu
try {
register(lhs, rhs);
- Field[] fields = clazz.getDeclaredFields();
+ final Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (int i = 0; i < fields.length && builder.isEquals; i++) {
- Field f = fields[i];
+ final Field f = fields[i];
if (!ArrayUtils.contains(excludeFields, f.getName())
&& (f.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(f.getModifiers()))
&& (!Modifier.isStatic(f.getModifiers()))) {
try {
builder.append(f.get(lhs), f.get(rhs));
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
//this can't happen. Would get a Security exception instead
//throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected IllegalAccessException");
@@ -455,7 +455,7 @@ public class EqualsBuilder implements Bu
this.setEquals(false);
return this;
}
- Class<?> lhsClass = lhs.getClass();
+ final Class<?> lhsClass = lhs.getClass();
if (!lhsClass.isArray()) {
// The simple case, not an array, just test the element
isEquals = lhs.equals(rhs);
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java Tue Jan 22 07:09:45 2013
@@ -148,7 +148,7 @@ public class HashCodeBuilder implements
* @since 2.3
*/
static boolean isRegistered(final Object value) {
- Set<IDKey> registry = getRegistry();
+ final Set<IDKey> registry = getRegistry();
return registry != null && registry.contains(new IDKey(value));
}
@@ -175,17 +175,17 @@ public class HashCodeBuilder implements
}
try {
register(object);
- Field[] fields = clazz.getDeclaredFields();
+ final Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
- for (Field field : fields) {
+ for (final Field field : fields) {
if (!ArrayUtils.contains(excludeFields, field.getName())
&& (field.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(field.getModifiers()))
&& (!Modifier.isStatic(field.getModifiers()))) {
try {
- Object fieldValue = field.get(object);
+ final Object fieldValue = field.get(object);
builder.append(fieldValue);
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// this can't happen. Would get a Security exception instead
// throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected IllegalAccessException");
@@ -335,7 +335,7 @@ public class HashCodeBuilder implements
if (object == null) {
throw new IllegalArgumentException("The object to build a hash code for must not be null");
}
- HashCodeBuilder builder = new HashCodeBuilder(initialNonZeroOddNumber, multiplierNonZeroOddNumber);
+ final HashCodeBuilder builder = new HashCodeBuilder(initialNonZeroOddNumber, multiplierNonZeroOddNumber);
Class<?> clazz = object.getClass();
reflectionAppend(object, clazz, builder, testTransients, excludeFields);
while (clazz.getSuperclass() != null && clazz != reflectUpToClass) {
@@ -591,7 +591,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (boolean element : array) {
+ for (final boolean element : array) {
append(element);
}
}
@@ -629,7 +629,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (byte element : array) {
+ for (final byte element : array) {
append(element);
}
}
@@ -663,7 +663,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (char element : array) {
+ for (final char element : array) {
append(element);
}
}
@@ -696,7 +696,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (double element : array) {
+ for (final double element : array) {
append(element);
}
}
@@ -730,7 +730,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (float element : array) {
+ for (final float element : array) {
append(element);
}
}
@@ -764,7 +764,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (int element : array) {
+ for (final int element : array) {
append(element);
}
}
@@ -802,7 +802,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (long element : array) {
+ for (final long element : array) {
append(element);
}
}
@@ -866,7 +866,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (Object element : array) {
+ for (final Object element : array) {
append(element);
}
}
@@ -900,7 +900,7 @@ public class HashCodeBuilder implements
if (array == null) {
iTotal = iTotal * iConstant;
} else {
- for (short element : array) {
+ for (final short element : array) {
append(element);
}
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/IDKey.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/IDKey.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/IDKey.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/IDKey.java Tue Jan 22 07:09:45 2013
@@ -64,7 +64,7 @@ final class IDKey {
if (!(other instanceof IDKey)) {
return false;
}
- IDKey idKey = (IDKey) other;
+ final IDKey idKey = (IDKey) other;
if (id != idKey.id) {
return false;
}