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 [4/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/reflect/TypeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java Tue Jan 22 07:09:45 2013
@@ -140,7 +140,7 @@ public class TypeUtils {
if (type instanceof TypeVariable<?>) {
// if any of the bounds are assignable to the class, then the
// type is assignable to the class.
- for (Type bound : ((TypeVariable<?>) type).getBounds()) {
+ for (final Type bound : ((TypeVariable<?>) type).getBounds()) {
if (isAssignable(bound, toClass)) {
return true;
}
@@ -194,10 +194,10 @@ public class TypeUtils {
}
// get the target type's raw type
- Class<?> toClass = getRawType(toParameterizedType);
+ final Class<?> toClass = getRawType(toParameterizedType);
// get the subject type's type arguments including owner type arguments
// and supertype arguments up to and including the target class.
- Map<TypeVariable<?>, Type> fromTypeVarAssigns = getTypeArguments(type, toClass, null);
+ final Map<TypeVariable<?>, Type> fromTypeVarAssigns = getTypeArguments(type, toClass, null);
// null means the two types are not compatible
if (fromTypeVarAssigns == null) {
@@ -212,13 +212,13 @@ public class TypeUtils {
}
// get the target type's type arguments including owner type arguments
- Map<TypeVariable<?>, Type> toTypeVarAssigns = getTypeArguments(toParameterizedType,
+ final Map<TypeVariable<?>, Type> toTypeVarAssigns = getTypeArguments(toParameterizedType,
toClass, typeVarAssigns);
// now to check each type argument
- for (TypeVariable<?> var : toTypeVarAssigns.keySet()) {
- Type toTypeArg = unrollVariableAssignments(var, toTypeVarAssigns);
- Type fromTypeArg = unrollVariableAssignments(var, fromTypeVarAssigns);
+ for (final TypeVariable<?> var : toTypeVarAssigns.keySet()) {
+ final Type toTypeArg = unrollVariableAssignments(var, toTypeVarAssigns);
+ final Type fromTypeArg = unrollVariableAssignments(var, fromTypeVarAssigns);
// parameters must either be absent from the subject type, within
// the bounds of the wildcard type, or be an exact match to the
@@ -274,10 +274,10 @@ public class TypeUtils {
return true;
}
- Type toComponentType = toGenericArrayType.getGenericComponentType();
+ final Type toComponentType = toGenericArrayType.getGenericComponentType();
if (type instanceof Class<?>) {
- Class<?> cls = (Class<?>) type;
+ final Class<?> cls = (Class<?>) type;
// compare the component types
return cls.isArray()
@@ -292,7 +292,7 @@ public class TypeUtils {
if (type instanceof WildcardType) {
// so long as one of the upper bounds is assignable, it's good
- for (Type bound : getImplicitUpperBounds((WildcardType) type)) {
+ for (final Type bound : getImplicitUpperBounds((WildcardType) type)) {
if (isAssignable(bound, toGenericArrayType)) {
return true;
}
@@ -304,7 +304,7 @@ public class TypeUtils {
if (type instanceof TypeVariable<?>) {
// probably should remove the following logic and just return false.
// type variables cannot specify arrays as bounds.
- for (Type bound : getImplicitBounds((TypeVariable<?>) type)) {
+ for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
if (isAssignable(bound, toGenericArrayType)) {
return true;
}
@@ -350,13 +350,13 @@ public class TypeUtils {
return true;
}
- Type[] toUpperBounds = getImplicitUpperBounds(toWildcardType);
- Type[] toLowerBounds = getImplicitLowerBounds(toWildcardType);
+ final Type[] toUpperBounds = getImplicitUpperBounds(toWildcardType);
+ final Type[] toLowerBounds = getImplicitLowerBounds(toWildcardType);
if (type instanceof WildcardType) {
- WildcardType wildcardType = (WildcardType) type;
- Type[] upperBounds = getImplicitUpperBounds(wildcardType);
- Type[] lowerBounds = getImplicitLowerBounds(wildcardType);
+ final WildcardType wildcardType = (WildcardType) type;
+ final Type[] upperBounds = getImplicitUpperBounds(wildcardType);
+ final Type[] lowerBounds = getImplicitLowerBounds(wildcardType);
for (Type toBound : toUpperBounds) {
// if there are assignments for unresolved type variables,
@@ -366,7 +366,7 @@ public class TypeUtils {
// each upper bound of the subject type has to be assignable to
// each
// upper bound of the target type
- for (Type bound : upperBounds) {
+ for (final Type bound : upperBounds) {
if (!isAssignable(bound, toBound, typeVarAssigns)) {
return false;
}
@@ -381,7 +381,7 @@ public class TypeUtils {
// each lower bound of the target type has to be assignable to
// each
// lower bound of the subject type
- for (Type bound : lowerBounds) {
+ for (final Type bound : lowerBounds) {
if (!isAssignable(toBound, bound, typeVarAssigns)) {
return false;
}
@@ -391,7 +391,7 @@ public class TypeUtils {
return true;
}
- for (Type toBound : toUpperBounds) {
+ for (final Type toBound : toUpperBounds) {
// if there are assignments for unresolved type variables,
// now's the time to substitute them.
if (!isAssignable(type, substituteTypeVariables(toBound, typeVarAssigns),
@@ -400,7 +400,7 @@ public class TypeUtils {
}
}
- for (Type toBound : toLowerBounds) {
+ for (final Type toBound : toLowerBounds) {
// if there are assignments for unresolved type variables,
// now's the time to substitute them.
if (!isAssignable(substituteTypeVariables(toBound, typeVarAssigns), type,
@@ -443,9 +443,9 @@ public class TypeUtils {
// a type variable is assignable to another type variable, if
// and only if the former is the latter, extends the latter, or
// is otherwise a descendant of the latter.
- Type[] bounds = getImplicitBounds((TypeVariable<?>) type);
+ final Type[] bounds = getImplicitBounds((TypeVariable<?>) type);
- for (Type bound : bounds) {
+ for (final Type bound : bounds) {
if (isAssignable(bound, toTypeVariable, typeVarAssigns)) {
return true;
}
@@ -470,7 +470,7 @@ public class TypeUtils {
*/
private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
- Type replacementType = typeVarAssigns.get(type);
+ final Type replacementType = typeVarAssigns.get(type);
if (replacementType == null) {
throw new IllegalArgumentException("missing assignment type for type variable "
@@ -560,7 +560,7 @@ public class TypeUtils {
// since wildcard types are not assignable to classes, should this just
// return null?
if (type instanceof WildcardType) {
- for (Type bound : getImplicitUpperBounds((WildcardType) type)) {
+ for (final Type bound : getImplicitUpperBounds((WildcardType) type)) {
// find the first bound that is assignable to the target class
if (isAssignable(bound, toClass)) {
return getTypeArguments(bound, toClass, subtypeVarAssigns);
@@ -572,7 +572,7 @@ public class TypeUtils {
// *
if (type instanceof TypeVariable<?>) {
- for (Type bound : getImplicitBounds((TypeVariable<?>) type)) {
+ for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
// find the first bound that is assignable to the target class
if (isAssignable(bound, toClass)) {
return getTypeArguments(bound, toClass, subtypeVarAssigns);
@@ -597,19 +597,19 @@ public class TypeUtils {
private static Map<TypeVariable<?>, Type> getTypeArguments(
final ParameterizedType parameterizedType, final Class<?> toClass,
final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
- Class<?> cls = getRawType(parameterizedType);
+ final Class<?> cls = getRawType(parameterizedType);
// make sure they're assignable
if (!isAssignable(cls, toClass)) {
return null;
}
- Type ownerType = parameterizedType.getOwnerType();
+ final Type ownerType = parameterizedType.getOwnerType();
Map<TypeVariable<?>, Type> typeVarAssigns;
if (ownerType instanceof ParameterizedType) {
// get the owner type arguments first
- ParameterizedType parameterizedOwnerType = (ParameterizedType) ownerType;
+ final ParameterizedType parameterizedOwnerType = (ParameterizedType) ownerType;
typeVarAssigns = getTypeArguments(parameterizedOwnerType,
getRawType(parameterizedOwnerType), subtypeVarAssigns);
} else {
@@ -619,13 +619,13 @@ public class TypeUtils {
}
// get the subject parameterized type's arguments
- Type[] typeArgs = parameterizedType.getActualTypeArguments();
+ final Type[] typeArgs = parameterizedType.getActualTypeArguments();
// and get the corresponding type variables from the raw class
- TypeVariable<?>[] typeParams = cls.getTypeParameters();
+ final TypeVariable<?>[] typeParams = cls.getTypeParameters();
// map the arguments to their respective type variables
for (int i = 0; i < typeParams.length; i++) {
- Type typeArg = typeArgs[i];
+ final Type typeArg = typeArgs[i];
typeVarAssigns.put(typeParams[i], typeVarAssigns.containsKey(typeArg) ? typeVarAssigns
.get(typeArg) : typeArg);
}
@@ -668,7 +668,7 @@ public class TypeUtils {
}
// create a copy of the incoming map, or an empty one if it's null
- HashMap<TypeVariable<?>, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap<TypeVariable<?>, Type>()
+ final HashMap<TypeVariable<?>, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap<TypeVariable<?>, Type>()
: new HashMap<TypeVariable<?>, Type>(subtypeVarAssigns);
// has target class been reached?
@@ -709,7 +709,7 @@ public class TypeUtils {
*/
public static Map<TypeVariable<?>, Type> determineTypeArguments(final Class<?> cls,
final ParameterizedType superType) {
- Class<?> superClass = getRawType(superType);
+ final Class<?> superClass = getRawType(superType);
// compatibility check
if (!isAssignable(cls, superClass)) {
@@ -721,18 +721,18 @@ public class TypeUtils {
}
// get the next class in the inheritance hierarchy
- Type midType = getClosestParentType(cls, superClass);
+ final Type midType = getClosestParentType(cls, superClass);
// can only be a class or a parameterized type
if (midType instanceof Class<?>) {
return determineTypeArguments((Class<?>) midType, superType);
}
- ParameterizedType midParameterizedType = (ParameterizedType) midType;
- Class<?> midClass = getRawType(midParameterizedType);
+ final ParameterizedType midParameterizedType = (ParameterizedType) midType;
+ final Class<?> midClass = getRawType(midParameterizedType);
// get the type variables of the mid class that map to the type
// arguments of the super class
- Map<TypeVariable<?>, Type> typeVarAssigns = determineTypeArguments(midClass, superType);
+ final Map<TypeVariable<?>, Type> typeVarAssigns = determineTypeArguments(midClass, superType);
// map the arguments of the mid type to the class type variables
mapTypeVariablesToArguments(cls, midParameterizedType, typeVarAssigns);
@@ -750,7 +750,7 @@ public class TypeUtils {
private static <T> void mapTypeVariablesToArguments(final Class<T> cls,
final ParameterizedType parameterizedType, final Map<TypeVariable<?>, Type> typeVarAssigns) {
// capture the type variables from the owner type that have assignments
- Type ownerType = parameterizedType.getOwnerType();
+ final Type ownerType = parameterizedType.getOwnerType();
if (ownerType instanceof ParameterizedType) {
// recursion to make sure the owner's owner type gets processed
@@ -761,19 +761,19 @@ public class TypeUtils {
// hierarchy of said interface/class) implemented/extended by the class
// cls. Find out which type variables of cls are type arguments of
// parameterizedType:
- Type[] typeArgs = parameterizedType.getActualTypeArguments();
+ final Type[] typeArgs = parameterizedType.getActualTypeArguments();
// of the cls's type variables that are arguments of parameterizedType,
// find out which ones can be determined from the super type's arguments
- TypeVariable<?>[] typeVars = getRawType(parameterizedType).getTypeParameters();
+ final TypeVariable<?>[] typeVars = getRawType(parameterizedType).getTypeParameters();
// use List view of type parameters of cls so the contains() method can be used:
- List<TypeVariable<Class<T>>> typeVarList = Arrays.asList(cls
+ final List<TypeVariable<Class<T>>> typeVarList = Arrays.asList(cls
.getTypeParameters());
for (int i = 0; i < typeArgs.length; i++) {
- TypeVariable<?> typeVar = typeVars[i];
- Type typeArg = typeArgs[i];
+ final TypeVariable<?> typeVar = typeVars[i];
+ final Type typeArg = typeArgs[i];
// argument of parameterizedType is a type variable of cls
if (typeVarList.contains(typeArg)
@@ -798,12 +798,12 @@ public class TypeUtils {
// only look at the interfaces if the super class is also an interface
if (superClass.isInterface()) {
// get the generic interfaces of the subject class
- Type[] interfaceTypes = cls.getGenericInterfaces();
+ final Type[] interfaceTypes = cls.getGenericInterfaces();
// will hold the best generic interface match found
Type genericInterface = null;
// find the interface closest to the super class
- for (Type midType : interfaceTypes) {
+ for (final Type midType : interfaceTypes) {
Class<?> midClass = null;
if (midType instanceof ParameterizedType) {
@@ -878,12 +878,12 @@ public class TypeUtils {
return bounds;
}
- Set<Type> types = new HashSet<Type>(bounds.length);
+ final Set<Type> types = new HashSet<Type>(bounds.length);
- for (Type type1 : bounds) {
+ for (final Type type1 : bounds) {
boolean subtypeFound = false;
- for (Type type2 : bounds) {
+ for (final Type type2 : bounds) {
if (type1 != type2 && isAssignable(type2, type1, null)) {
subtypeFound = true;
break;
@@ -908,7 +908,7 @@ public class TypeUtils {
* @return a non-empty array containing the bounds of the type variable.
*/
public static Type[] getImplicitBounds(final TypeVariable<?> typeVariable) {
- Type[] bounds = typeVariable.getBounds();
+ final Type[] bounds = typeVariable.getBounds();
return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
}
@@ -924,7 +924,7 @@ public class TypeUtils {
* type.
*/
public static Type[] getImplicitUpperBounds(final WildcardType wildcardType) {
- Type[] bounds = wildcardType.getUpperBounds();
+ final Type[] bounds = wildcardType.getUpperBounds();
return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
}
@@ -939,7 +939,7 @@ public class TypeUtils {
* type.
*/
public static Type[] getImplicitLowerBounds(final WildcardType wildcardType) {
- Type[] bounds = wildcardType.getLowerBounds();
+ final Type[] bounds = wildcardType.getLowerBounds();
return bounds.length == 0 ? new Type[] { null } : bounds;
}
@@ -960,11 +960,11 @@ public class TypeUtils {
public static boolean typesSatisfyVariables(final Map<TypeVariable<?>, Type> typeVarAssigns) {
// all types must be assignable to all the bounds of the their mapped
// type variable.
- for (Map.Entry<TypeVariable<?>, Type> entry : typeVarAssigns.entrySet()) {
- TypeVariable<?> typeVar = entry.getKey();
- Type type = entry.getValue();
+ for (final Map.Entry<TypeVariable<?>, Type> entry : typeVarAssigns.entrySet()) {
+ final TypeVariable<?> typeVar = entry.getKey();
+ final Type type = entry.getValue();
- for (Type bound : getImplicitBounds(typeVar)) {
+ for (final Type bound : getImplicitBounds(typeVar)) {
if (!isAssignable(type, substituteTypeVariables(bound, typeVarAssigns),
typeVarAssigns)) {
return false;
@@ -983,7 +983,7 @@ public class TypeUtils {
* @throws IllegalStateException if the conversion fails
*/
private static Class<?> getRawType(final ParameterizedType parameterizedType) {
- Type rawType = parameterizedType.getRawType();
+ final Type rawType = parameterizedType.getRawType();
// check if raw type is a Class object
// not currently necessary, but since the return type is Type instead of
@@ -1026,7 +1026,7 @@ public class TypeUtils {
}
// get the entity declaring this type variable
- Object genericDeclaration = ((TypeVariable<?>) type).getGenericDeclaration();
+ final Object genericDeclaration = ((TypeVariable<?>) type).getGenericDeclaration();
// can't get the raw type of a method- or constructor-declared type
// variable
@@ -1036,7 +1036,7 @@ public class TypeUtils {
// get the type arguments for the declaring class/interface based
// on the enclosing type
- Map<TypeVariable<?>, Type> typeVarAssigns = getTypeArguments(assigningType,
+ final Map<TypeVariable<?>, Type> typeVarAssigns = getTypeArguments(assigningType,
(Class<?>) genericDeclaration);
// enclosingType has to be a subclass (or subinterface) of the
@@ -1046,7 +1046,7 @@ public class TypeUtils {
}
// get the argument assigned to this type variable
- Type typeArgument = typeVarAssigns.get(type);
+ final Type typeArgument = typeVarAssigns.get(type);
if (typeArgument == null) {
return null;
@@ -1058,7 +1058,7 @@ public class TypeUtils {
if (type instanceof GenericArrayType) {
// get raw component type
- Class<?> rawComponentType = getRawType(((GenericArrayType) type)
+ final Class<?> rawComponentType = getRawType(((GenericArrayType) type)
.getGenericComponentType(), assigningType);
// create array type from raw component type and return its class
@@ -1089,7 +1089,7 @@ public class TypeUtils {
*/
public static Type getArrayComponentType(final Type type) {
if (type instanceof Class<?>) {
- Class<?> clazz = (Class<?>) type;
+ final Class<?> clazz = (Class<?>) type;
return clazz.isArray() ? clazz.getComponentType() : null;
}
if (type instanceof GenericArrayType) {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java Tue Jan 22 07:09:45 2013
@@ -148,12 +148,12 @@ public class ExtendedMessageFormat exten
toPattern = super.toPattern();
return;
}
- ArrayList<Format> foundFormats = new ArrayList<Format>();
- ArrayList<String> foundDescriptions = new ArrayList<String>();
- StringBuilder stripCustom = new StringBuilder(pattern.length());
+ final ArrayList<Format> foundFormats = new ArrayList<Format>();
+ final ArrayList<String> foundDescriptions = new ArrayList<String>();
+ final StringBuilder stripCustom = new StringBuilder(pattern.length());
- ParsePosition pos = new ParsePosition(0);
- char[] c = pattern.toCharArray();
+ final ParsePosition pos = new ParsePosition(0);
+ final char[] c = pattern.toCharArray();
int fmtCount = 0;
while (pos.getIndex() < pattern.length()) {
switch (c[pos.getIndex()]) {
@@ -163,8 +163,8 @@ public class ExtendedMessageFormat exten
case START_FE:
fmtCount++;
seekNonWs(pattern, pos);
- int start = pos.getIndex();
- int index = readArgumentIndex(pattern, next(pos));
+ final int start = pos.getIndex();
+ final int index = readArgumentIndex(pattern, next(pos));
stripCustom.append(START_FE).append(index);
seekNonWs(pattern, pos);
Format format = null;
@@ -194,12 +194,12 @@ public class ExtendedMessageFormat exten
super.applyPattern(stripCustom.toString());
toPattern = insertFormats(super.toPattern(), foundDescriptions);
if (containsElements(foundFormats)) {
- Format[] origFormats = getFormats();
+ final Format[] origFormats = getFormats();
// only loop over what we know we have, as MessageFormat on Java 1.3
// seems to provide an extra format element:
int i = 0;
- for (Iterator<Format> it = foundFormats.iterator(); it.hasNext(); i++) {
- Format f = it.next();
+ for (final Iterator<Format> it = foundFormats.iterator(); it.hasNext(); i++) {
+ final Format f = it.next();
if (f != null) {
origFormats[i] = f;
}
@@ -274,7 +274,7 @@ public class ExtendedMessageFormat exten
if (ObjectUtils.notEqual(getClass(), obj.getClass())) {
return false;
}
- ExtendedMessageFormat rhs = (ExtendedMessageFormat)obj;
+ final ExtendedMessageFormat rhs = (ExtendedMessageFormat)obj;
if (ObjectUtils.notEqual(toPattern, rhs.toPattern)) {
return false;
}
@@ -307,12 +307,12 @@ public class ExtendedMessageFormat exten
if (registry != null) {
String name = desc;
String args = null;
- int i = desc.indexOf(START_FMT);
+ final int i = desc.indexOf(START_FMT);
if (i > 0) {
name = desc.substring(0, i).trim();
args = desc.substring(i + 1).trim();
}
- FormatFactory factory = registry.get(name);
+ final FormatFactory factory = registry.get(name);
if (factory != null) {
return factory.getFormat(name, args, getLocale());
}
@@ -328,9 +328,9 @@ public class ExtendedMessageFormat exten
* @return argument index
*/
private int readArgumentIndex(final String pattern, final ParsePosition pos) {
- int start = pos.getIndex();
+ final int start = pos.getIndex();
seekNonWs(pattern, pos);
- StringBuilder result = new StringBuilder();
+ final StringBuilder result = new StringBuilder();
boolean error = false;
for (; !error && pos.getIndex() < pattern.length(); next(pos)) {
char c = pattern.charAt(pos.getIndex());
@@ -345,7 +345,7 @@ public class ExtendedMessageFormat exten
if ((c == START_FMT || c == END_FE) && result.length() > 0) {
try {
return Integer.parseInt(result.toString());
- } catch (NumberFormatException e) { // NOPMD
+ } catch (final NumberFormatException e) { // NOPMD
// we've already ensured only digits, so unless something
// outlandishly large was specified we should be okay.
}
@@ -370,9 +370,9 @@ public class ExtendedMessageFormat exten
* @return Format description String
*/
private String parseFormatDescription(final String pattern, final ParsePosition pos) {
- int start = pos.getIndex();
+ final int start = pos.getIndex();
seekNonWs(pattern, pos);
- int text = pos.getIndex();
+ final int text = pos.getIndex();
int depth = 1;
for (; pos.getIndex() < pattern.length(); next(pos)) {
switch (pattern.charAt(pos.getIndex())) {
@@ -405,12 +405,12 @@ public class ExtendedMessageFormat exten
if (!containsElements(customPatterns)) {
return pattern;
}
- StringBuilder sb = new StringBuilder(pattern.length() * 2);
- ParsePosition pos = new ParsePosition(0);
+ final StringBuilder sb = new StringBuilder(pattern.length() * 2);
+ final ParsePosition pos = new ParsePosition(0);
int fe = -1;
int depth = 0;
while (pos.getIndex() < pattern.length()) {
- char c = pattern.charAt(pos.getIndex());
+ final char c = pattern.charAt(pos.getIndex());
switch (c) {
case QUOTE:
appendQuotedString(pattern, pos, sb, false);
@@ -421,7 +421,7 @@ public class ExtendedMessageFormat exten
fe++;
sb.append(START_FE).append(
readArgumentIndex(pattern, next(pos)));
- String customPattern = customPatterns.get(fe);
+ final String customPattern = customPatterns.get(fe);
if (customPattern != null) {
sb.append(START_FMT).append(customPattern);
}
@@ -446,7 +446,7 @@ public class ExtendedMessageFormat exten
*/
private void seekNonWs(final String pattern, final ParsePosition pos) {
int len = 0;
- char[] buffer = pattern.toCharArray();
+ final char[] buffer = pattern.toCharArray();
do {
len = StrMatcher.splitMatcher().isMatch(buffer, pos.getIndex());
pos.setIndex(pos.getIndex() + len);
@@ -476,8 +476,8 @@ public class ExtendedMessageFormat exten
*/
private StringBuilder appendQuotedString(final String pattern, final ParsePosition pos,
final StringBuilder appendTo, final boolean escapingOn) {
- int start = pos.getIndex();
- char[] c = pattern.toCharArray();
+ final int start = pos.getIndex();
+ final char[] c = pattern.toCharArray();
if (escapingOn && c[start] == QUOTE) {
next(pos);
return appendTo == null ? null : appendTo.append(QUOTE);
@@ -525,7 +525,7 @@ public class ExtendedMessageFormat exten
if (coll == null || coll.isEmpty()) {
return false;
}
- for (Object name : coll) {
+ for (final Object name : coll) {
if (name != null) {
return true;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java Tue Jan 22 07:09:45 2013
@@ -135,12 +135,12 @@ public class FormattableUtils {
final int precision, final char padChar, final CharSequence ellipsis) {
Validate.isTrue(ellipsis == null || precision < 0 || ellipsis.length() <= precision,
"Specified ellipsis '%1$s' exceeds precision of %2$s", ellipsis, Integer.valueOf(precision));
- StringBuilder buf = new StringBuilder(seq);
+ final StringBuilder buf = new StringBuilder(seq);
if (precision >= 0 && precision < seq.length()) {
- CharSequence _ellipsis = ObjectUtils.defaultIfNull(ellipsis, StringUtils.EMPTY);
+ final CharSequence _ellipsis = ObjectUtils.defaultIfNull(ellipsis, StringUtils.EMPTY);
buf.replace(precision - _ellipsis.length(), seq.length(), _ellipsis.toString());
}
- boolean leftJustify = (flags & LEFT_JUSTIFY) == LEFT_JUSTIFY;
+ final boolean leftJustify = (flags & LEFT_JUSTIFY) == LEFT_JUSTIFY;
for (int i = buf.length(); i < width; i++) {
buf.insert(leftJustify ? i : 0, padChar);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java Tue Jan 22 07:09:45 2013
@@ -204,8 +204,8 @@ public class StrBuilder implements CharS
size = length;
} else if (length > size) {
ensureCapacity(length);
- int oldEnd = size;
- int newEnd = length;
+ final int oldEnd = size;
+ final int newEnd = length;
size = length;
for (int i = oldEnd; i < newEnd; i++) {
buffer[i] = '\0';
@@ -232,7 +232,7 @@ public class StrBuilder implements CharS
*/
public StrBuilder ensureCapacity(final int capacity) {
if (capacity > buffer.length) {
- char[] old = buffer;
+ final char[] old = buffer;
buffer = new char[capacity * 2];
System.arraycopy(old, 0, buffer, 0, size);
}
@@ -246,7 +246,7 @@ public class StrBuilder implements CharS
*/
public StrBuilder minimizeCapacity() {
if (buffer.length > length()) {
- char[] old = buffer;
+ final char[] old = buffer;
buffer = new char[length()];
System.arraycopy(old, 0, buffer, 0, size);
}
@@ -357,7 +357,7 @@ public class StrBuilder implements CharS
if (size == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY;
}
- char chars[] = new char[size];
+ final char chars[] = new char[size];
System.arraycopy(buffer, 0, chars, 0, size);
return chars;
}
@@ -374,11 +374,11 @@ public class StrBuilder implements CharS
*/
public char[] toCharArray(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
- int len = endIndex - startIndex;
+ final int len = endIndex - startIndex;
if (len == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY;
}
- char chars[] = new char[len];
+ final char chars[] = new char[len];
System.arraycopy(buffer, startIndex, chars, 0, len);
return chars;
}
@@ -390,7 +390,7 @@ public class StrBuilder implements CharS
* @return the input array, unless that was null or too small
*/
public char[] getChars(char[] destination) {
- int len = length();
+ final int len = length();
if (destination == null || destination.length < len) {
destination = new char[len];
}
@@ -510,9 +510,9 @@ public class StrBuilder implements CharS
if (str == null) {
return appendNull();
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + strLen);
str.getChars(0, strLen, buffer, len);
size += strLen;
@@ -541,7 +541,7 @@ public class StrBuilder implements CharS
throw new StringIndexOutOfBoundsException("length must be valid");
}
if (length > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + length);
str.getChars(startIndex, startIndex + length, buffer, len);
size += length;
@@ -573,9 +573,9 @@ public class StrBuilder implements CharS
if (str == null) {
return appendNull();
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + strLen);
str.getChars(0, strLen, buffer, len);
size += strLen;
@@ -603,7 +603,7 @@ public class StrBuilder implements CharS
throw new StringIndexOutOfBoundsException("length must be valid");
}
if (length > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + length);
str.getChars(startIndex, startIndex + length, buffer, len);
size += length;
@@ -623,9 +623,9 @@ public class StrBuilder implements CharS
if (str == null) {
return appendNull();
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + strLen);
str.getChars(0, strLen, buffer, len);
size += strLen;
@@ -654,7 +654,7 @@ public class StrBuilder implements CharS
throw new StringIndexOutOfBoundsException("length must be valid");
}
if (length > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + length);
str.getChars(startIndex, startIndex + length, buffer, len);
size += length;
@@ -673,9 +673,9 @@ public class StrBuilder implements CharS
if (str == null) {
return appendNull();
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + strLen);
System.arraycopy(str.buffer, 0, buffer, len, strLen);
size += strLen;
@@ -703,7 +703,7 @@ public class StrBuilder implements CharS
throw new StringIndexOutOfBoundsException("length must be valid");
}
if (length > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + length);
str.getChars(startIndex, startIndex + length, buffer, len);
size += length;
@@ -722,9 +722,9 @@ public class StrBuilder implements CharS
if (chars == null) {
return appendNull();
}
- int strLen = chars.length;
+ final int strLen = chars.length;
if (strLen > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + strLen);
System.arraycopy(chars, 0, buffer, len, strLen);
size += strLen;
@@ -752,7 +752,7 @@ public class StrBuilder implements CharS
throw new StringIndexOutOfBoundsException("Invalid length: " + length);
}
if (length > 0) {
- int len = length();
+ final int len = length();
ensureCapacity(len + length);
System.arraycopy(chars, startIndex, buffer, len, length);
size += length;
@@ -793,7 +793,7 @@ public class StrBuilder implements CharS
*/
@Override
public StrBuilder append(final char ch) {
- int len = length();
+ final int len = length();
ensureCapacity(len + 1);
buffer[size++] = ch;
return this;
@@ -1073,7 +1073,7 @@ public class StrBuilder implements CharS
*/
public <T> StrBuilder appendAll(final T... array) {
if (array != null && array.length > 0) {
- for (Object element : array) {
+ for (final Object element : array) {
append(element);
}
}
@@ -1091,7 +1091,7 @@ public class StrBuilder implements CharS
*/
public StrBuilder appendAll(final Iterable<?> iterable) {
if (iterable != null) {
- for (Object o : iterable) {
+ for (final Object o : iterable) {
append(o);
}
}
@@ -1152,7 +1152,7 @@ public class StrBuilder implements CharS
public StrBuilder appendWithSeparators(final Iterable<?> iterable, String separator) {
if (iterable != null) {
separator = ObjectUtils.toString(separator);
- Iterator<?> it = iterable.iterator();
+ final Iterator<?> it = iterable.iterator();
while (it.hasNext()) {
append(it.next());
if (it.hasNext()) {
@@ -1239,7 +1239,7 @@ public class StrBuilder implements CharS
* @since 2.5
*/
public StrBuilder appendSeparator(final String standard, final String defaultIfEmpty) {
- String str = isEmpty() ? defaultIfEmpty : standard;
+ final String str = isEmpty() ? defaultIfEmpty : standard;
if (str != null) {
append(str);
}
@@ -1383,11 +1383,11 @@ public class StrBuilder implements CharS
if (str == null) {
str = "";
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen >= width) {
str.getChars(strLen - width, strLen, buffer, size);
} else {
- int padLen = width - strLen;
+ final int padLen = width - strLen;
for (int i = 0; i < padLen; i++) {
buffer[size + i] = padChar;
}
@@ -1430,11 +1430,11 @@ public class StrBuilder implements CharS
if (str == null) {
str = "";
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen >= width) {
str.getChars(0, width, buffer, size);
} else {
- int padLen = width - strLen;
+ final int padLen = width - strLen;
str.getChars(0, strLen, buffer, size);
for (int i = 0; i < padLen; i++) {
buffer[size + strLen + i] = padChar;
@@ -1491,9 +1491,9 @@ public class StrBuilder implements CharS
if (str == null) {
str = nullText;
}
- int strLen = (str == null ? 0 : str.length());
+ final int strLen = (str == null ? 0 : str.length());
if (strLen > 0) {
- int newSize = size + strLen;
+ final int newSize = size + strLen;
ensureCapacity(newSize);
System.arraycopy(buffer, index, buffer, index + strLen, size - index);
size = newSize;
@@ -1516,7 +1516,7 @@ public class StrBuilder implements CharS
if (chars == null) {
return insert(index, nullText);
}
- int len = chars.length;
+ final int len = chars.length;
if (len > 0) {
ensureCapacity(size + len);
System.arraycopy(buffer, index, buffer, index + len, size - index);
@@ -1678,7 +1678,7 @@ public class StrBuilder implements CharS
*/
public StrBuilder delete(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
- int len = endIndex - startIndex;
+ final int len = endIndex - startIndex;
if (len > 0) {
deleteImpl(startIndex, endIndex, len);
}
@@ -1695,13 +1695,13 @@ public class StrBuilder implements CharS
public StrBuilder deleteAll(final char ch) {
for (int i = 0; i < size; i++) {
if (buffer[i] == ch) {
- int start = i;
+ final int start = i;
while (++i < size) {
if (buffer[i] != ch) {
break;
}
}
- int len = i - start;
+ final int len = i - start;
deleteImpl(start, i, len);
i -= len;
}
@@ -1733,7 +1733,7 @@ public class StrBuilder implements CharS
* @return this, to enable chaining
*/
public StrBuilder deleteAll(final String str) {
- int len = (str == null ? 0 : str.length());
+ final int len = (str == null ? 0 : str.length());
if (len > 0) {
int index = indexOf(str, 0);
while (index >= 0) {
@@ -1751,9 +1751,9 @@ public class StrBuilder implements CharS
* @return this, to enable chaining
*/
public StrBuilder deleteFirst(final String str) {
- int len = (str == null ? 0 : str.length());
+ final int len = (str == null ? 0 : str.length());
if (len > 0) {
- int index = indexOf(str, 0);
+ final int index = indexOf(str, 0);
if (index >= 0) {
deleteImpl(index, index + len, len);
}
@@ -1802,7 +1802,7 @@ public class StrBuilder implements CharS
* @throws IndexOutOfBoundsException if any index is invalid
*/
private void replaceImpl(final int startIndex, final int endIndex, final int removeLen, final String insertStr, final int insertLen) {
- int newSize = size - removeLen + insertLen;
+ final int newSize = size - removeLen + insertLen;
if (insertLen != removeLen) {
ensureCapacity(newSize);
System.arraycopy(buffer, endIndex, buffer, startIndex + insertLen, size - endIndex);
@@ -1826,7 +1826,7 @@ public class StrBuilder implements CharS
*/
public StrBuilder replace(final int startIndex, int endIndex, final String replaceStr) {
endIndex = validateRange(startIndex, endIndex);
- int insertLen = (replaceStr == null ? 0 : replaceStr.length());
+ final int insertLen = (replaceStr == null ? 0 : replaceStr.length());
replaceImpl(startIndex, endIndex, endIndex - startIndex, replaceStr, insertLen);
return this;
}
@@ -1880,9 +1880,9 @@ public class StrBuilder implements CharS
* @return this, to enable chaining
*/
public StrBuilder replaceAll(final String searchStr, final String replaceStr) {
- int searchLen = (searchStr == null ? 0 : searchStr.length());
+ final int searchLen = (searchStr == null ? 0 : searchStr.length());
if (searchLen > 0) {
- int replaceLen = (replaceStr == null ? 0 : replaceStr.length());
+ final int replaceLen = (replaceStr == null ? 0 : replaceStr.length());
int index = indexOf(searchStr, 0);
while (index >= 0) {
replaceImpl(index, index + searchLen, searchLen, replaceStr, replaceLen);
@@ -1900,11 +1900,11 @@ public class StrBuilder implements CharS
* @return this, to enable chaining
*/
public StrBuilder replaceFirst(final String searchStr, final String replaceStr) {
- int searchLen = (searchStr == null ? 0 : searchStr.length());
+ final int searchLen = (searchStr == null ? 0 : searchStr.length());
if (searchLen > 0) {
- int index = indexOf(searchStr, 0);
+ final int index = indexOf(searchStr, 0);
if (index >= 0) {
- int replaceLen = (replaceStr == null ? 0 : replaceStr.length());
+ final int replaceLen = (replaceStr == null ? 0 : replaceStr.length());
replaceImpl(index, index + searchLen, searchLen, replaceStr, replaceLen);
}
}
@@ -1987,10 +1987,10 @@ public class StrBuilder implements CharS
if (matcher == null || size == 0) {
return this;
}
- int replaceLen = (replaceStr == null ? 0 : replaceStr.length());
- char[] buf = buffer;
+ final int replaceLen = (replaceStr == null ? 0 : replaceStr.length());
+ final char[] buf = buffer;
for (int i = from; i < to && replaceCount != 0; i++) {
- int removeLen = matcher.isMatch(buf, i, from, to);
+ final int removeLen = matcher.isMatch(buf, i, from, to);
if (removeLen > 0) {
replaceImpl(i, i + removeLen, removeLen, replaceStr, replaceLen);
to = to - removeLen + replaceLen;
@@ -2014,10 +2014,10 @@ public class StrBuilder implements CharS
return this;
}
- int half = size / 2;
- char[] buf = buffer;
+ final int half = size / 2;
+ final char[] buf = buffer;
for (int leftIdx = 0, rightIdx = size - 1; leftIdx < half; leftIdx++,rightIdx--) {
- char swap = buf[leftIdx];
+ final char swap = buf[leftIdx];
buf[leftIdx] = buf[rightIdx];
buf[rightIdx] = swap;
}
@@ -2036,7 +2036,7 @@ public class StrBuilder implements CharS
return this;
}
int len = size;
- char[] buf = buffer;
+ final char[] buf = buffer;
int pos = 0;
while (pos < len && buf[pos] <= ' ') {
pos++;
@@ -2066,7 +2066,7 @@ public class StrBuilder implements CharS
if (str == null) {
return false;
}
- int len = str.length();
+ final int len = str.length();
if (len == 0) {
return true;
}
@@ -2093,7 +2093,7 @@ public class StrBuilder implements CharS
if (str == null) {
return false;
}
- int len = str.length();
+ final int len = str.length();
if (len == 0) {
return true;
}
@@ -2239,7 +2239,7 @@ public class StrBuilder implements CharS
* @return true if the builder contains the character
*/
public boolean contains(final char ch) {
- char[] thisBuf = buffer;
+ final char[] thisBuf = buffer;
for (int i = 0; i < this.size; i++) {
if (thisBuf[i] == ch) {
return true;
@@ -2296,7 +2296,7 @@ public class StrBuilder implements CharS
if (startIndex >= size) {
return -1;
}
- char[] thisBuf = buffer;
+ final char[] thisBuf = buffer;
for (int i = startIndex; i < size; i++) {
if (thisBuf[i] == ch) {
return i;
@@ -2332,7 +2332,7 @@ public class StrBuilder implements CharS
if (str == null || startIndex >= size) {
return -1;
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen == 1) {
return indexOf(str.charAt(0), startIndex);
}
@@ -2342,8 +2342,8 @@ public class StrBuilder implements CharS
if (strLen > size) {
return -1;
}
- char[] thisBuf = buffer;
- int len = size - strLen + 1;
+ final char[] thisBuf = buffer;
+ final int len = size - strLen + 1;
outer:
for (int i = startIndex; i < len; i++) {
for (int j = 0; j < strLen; j++) {
@@ -2387,8 +2387,8 @@ public class StrBuilder implements CharS
if (matcher == null || startIndex >= size) {
return -1;
}
- int len = size;
- char[] buf = buffer;
+ final int len = size;
+ final char[] buf = buffer;
for (int i = startIndex; i < len; i++) {
if (matcher.isMatch(buf, i, startIndex, len) > 0) {
return i;
@@ -2455,7 +2455,7 @@ public class StrBuilder implements CharS
if (str == null || startIndex < 0) {
return -1;
}
- int strLen = str.length();
+ final int strLen = str.length();
if (strLen > 0 && strLen <= size) {
if (strLen == 1) {
return lastIndexOf(str.charAt(0), startIndex);
@@ -2508,8 +2508,8 @@ public class StrBuilder implements CharS
if (matcher == null || startIndex < 0) {
return -1;
}
- char[] buf = buffer;
- int endIndex = startIndex + 1;
+ final char[] buf = buffer;
+ final int endIndex = startIndex + 1;
for (int i = startIndex; i >= 0; i--) {
if (matcher.isMatch(buf, i, 0, endIndex) > 0) {
return i;
@@ -2649,11 +2649,11 @@ public class StrBuilder implements CharS
if (this.size != other.size) {
return false;
}
- char thisBuf[] = this.buffer;
- char otherBuf[] = other.buffer;
+ final char thisBuf[] = this.buffer;
+ final char otherBuf[] = other.buffer;
for (int i = size - 1; i >= 0; i--) {
- char c1 = thisBuf[i];
- char c2 = otherBuf[i];
+ final char c1 = thisBuf[i];
+ final char c2 = otherBuf[i];
if (c1 != c2 && Character.toUpperCase(c1) != Character.toUpperCase(c2)) {
return false;
}
@@ -2675,8 +2675,8 @@ public class StrBuilder implements CharS
if (this.size != other.size) {
return false;
}
- char thisBuf[] = this.buffer;
- char otherBuf[] = other.buffer;
+ final char thisBuf[] = this.buffer;
+ final char otherBuf[] = other.buffer;
for (int i = size - 1; i >= 0; i--) {
if (thisBuf[i] != otherBuf[i]) {
return false;
@@ -2707,7 +2707,7 @@ public class StrBuilder implements CharS
*/
@Override
public int hashCode() {
- char buf[] = buffer;
+ final char buf[] = buffer;
int hash = 0;
for (int i = size - 1; i >= 0; i--) {
hash = 31 * hash + buf[i];
@@ -2823,7 +2823,7 @@ public class StrBuilder implements CharS
/** {@inheritDoc} */
@Override
public String getContent() {
- String str = super.getContent();
+ final String str = super.getContent();
if (str == null) {
return StrBuilder.this.toString();
} else {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrLookup.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrLookup.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrLookup.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrLookup.java Tue Jan 22 07:09:45 2013
@@ -52,7 +52,7 @@ public abstract class StrLookup<V> {
@SuppressWarnings("unchecked") // System property keys and values are always Strings
final Map<String, String> properties = (Map<String, String>) propMap;
lookup = new MapStrLookup<String>(properties);
- } catch (SecurityException ex) {
+ } catch (final SecurityException ex) {
lookup = NONE_LOOKUP;
}
SYSTEM_PROPERTIES_LOOKUP = lookup;
@@ -162,7 +162,7 @@ public abstract class StrLookup<V> {
if (map == null) {
return null;
}
- Object obj = map.get(key);
+ final Object obj = map.get(key);
if (obj == null) {
return null;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java Tue Jan 22 07:09:45 2013
@@ -364,7 +364,7 @@ public abstract class StrMatcher {
*/
@Override
public int isMatch(final char[] buffer, int pos, final int bufferStart, final int bufferEnd) {
- int len = chars.length;
+ final int len = chars.length;
if (pos + len > bufferEnd) {
return 0;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java Tue Jan 22 07:09:45 2013
@@ -179,11 +179,11 @@ public class StrSubstitutor {
if (valueProperties == null) {
return source.toString();
}
- Map<String,String> valueMap = new HashMap<String,String>();
- Enumeration<?> propNames = valueProperties.propertyNames();
+ final Map<String,String> valueMap = new HashMap<String,String>();
+ final Enumeration<?> propNames = valueProperties.propertyNames();
while (propNames.hasMoreElements()) {
- String propName = (String)propNames.nextElement();
- String propValue = valueProperties.getProperty(propName);
+ final String propName = (String)propNames.nextElement();
+ final String propValue = valueProperties.getProperty(propName);
valueMap.put(propName, propValue);
}
return StrSubstitutor.replace(source, valueMap);
@@ -301,7 +301,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder(source);
+ final StrBuilder buf = new StrBuilder(source);
if (substitute(buf, 0, source.length()) == false) {
return source;
}
@@ -324,7 +324,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder(length).append(source, offset, length);
+ final StrBuilder buf = new StrBuilder(length).append(source, offset, length);
if (substitute(buf, 0, length) == false) {
return source.substring(offset, offset + length);
}
@@ -344,7 +344,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder(source.length).append(source);
+ final StrBuilder buf = new StrBuilder(source.length).append(source);
substitute(buf, 0, source.length);
return buf.toString();
}
@@ -366,7 +366,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder(length).append(source, offset, length);
+ final StrBuilder buf = new StrBuilder(length).append(source, offset, length);
substitute(buf, 0, length);
return buf.toString();
}
@@ -384,7 +384,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder(source.length()).append(source);
+ final StrBuilder buf = new StrBuilder(source.length()).append(source);
substitute(buf, 0, buf.length());
return buf.toString();
}
@@ -406,7 +406,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder(length).append(source, offset, length);
+ final StrBuilder buf = new StrBuilder(length).append(source, offset, length);
substitute(buf, 0, length);
return buf.toString();
}
@@ -424,7 +424,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder(source.length()).append(source);
+ final StrBuilder buf = new StrBuilder(source.length()).append(source);
substitute(buf, 0, buf.length());
return buf.toString();
}
@@ -446,7 +446,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder(length).append(source, offset, length);
+ final StrBuilder buf = new StrBuilder(length).append(source, offset, length);
substitute(buf, 0, length);
return buf.toString();
}
@@ -464,7 +464,7 @@ public class StrSubstitutor {
if (source == null) {
return null;
}
- StrBuilder buf = new StrBuilder().append(source);
+ final StrBuilder buf = new StrBuilder().append(source);
substitute(buf, 0, buf.length());
return buf.toString();
}
@@ -502,7 +502,7 @@ public class StrSubstitutor {
if (source == null) {
return false;
}
- StrBuilder buf = new StrBuilder(length).append(source, offset, length);
+ final StrBuilder buf = new StrBuilder(length).append(source, offset, length);
if (substitute(buf, 0, length) == false) {
return false;
}
@@ -576,18 +576,18 @@ 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<String> priorVariables) {
- StrMatcher prefixMatcher = getVariablePrefixMatcher();
- StrMatcher suffixMatcher = getVariableSuffixMatcher();
- char escape = getEscapeChar();
+ final StrMatcher prefixMatcher = getVariablePrefixMatcher();
+ final StrMatcher suffixMatcher = getVariableSuffixMatcher();
+ final char escape = getEscapeChar();
- boolean top = priorVariables == null;
+ final boolean top = priorVariables == null;
boolean altered = false;
int lengthChange = 0;
char[] chars = buf.buffer;
int bufEnd = offset + length;
int pos = offset;
while (pos < bufEnd) {
- int startMatchLen = prefixMatcher.isMatch(chars, pos, offset,
+ final int startMatchLen = prefixMatcher.isMatch(chars, pos, offset,
bufEnd);
if (startMatchLen == 0) {
pos++;
@@ -602,7 +602,7 @@ public class StrSubstitutor {
bufEnd--;
} else {
// find suffix
- int startPos = pos;
+ final int startPos = pos;
pos += startMatchLen;
int endMatchLen = 0;
int nestedVarCount = 0;
@@ -627,12 +627,12 @@ public class StrSubstitutor {
+ startMatchLen, pos - startPos
- startMatchLen);
if (isEnableSubstitutionInVariables()) {
- StrBuilder bufName = new StrBuilder(varName);
+ final StrBuilder bufName = new StrBuilder(varName);
substitute(bufName, 0, bufName.length());
varName = bufName.toString();
}
pos += endMatchLen;
- int endPos = pos;
+ final int endPos = pos;
// on the first call initialize priorVariables
if (priorVariables == null) {
@@ -646,11 +646,11 @@ public class StrSubstitutor {
priorVariables.add(varName);
// resolve the variable
- String varValue = resolveVariable(varName, buf,
+ final String varValue = resolveVariable(varName, buf,
startPos, endPos);
if (varValue != null) {
// recursive replace
- int varLen = varValue.length();
+ final int varLen = varValue.length();
buf.replace(startPos, endPos, varValue);
altered = true;
int change = substitute(buf, startPos,
@@ -693,7 +693,7 @@ public class StrSubstitutor {
if (priorVariables.contains(varName) == false) {
return;
}
- StrBuilder buf = new StrBuilder(256);
+ final StrBuilder buf = new StrBuilder(256);
buf.append("Infinite loop in property interpolation of ");
buf.append(priorVariables.remove(0));
buf.append(": ");
@@ -719,7 +719,7 @@ public class StrSubstitutor {
* @return the variable's value or <b>null</b> if the variable is unknown
*/
protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) {
- StrLookup<?> resolver = getVariableResolver();
+ final StrLookup<?> resolver = getVariableResolver();
if (resolver == null) {
return null;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java Tue Jan 22 07:09:45 2013
@@ -162,7 +162,7 @@ public class StrTokenizer implements Lis
* @return a new tokenizer instance which parses Comma Separated Value strings
*/
public static StrTokenizer getCSVInstance(final String input) {
- StrTokenizer tok = getCSVClone();
+ final StrTokenizer tok = getCSVClone();
tok.reset(input);
return tok;
}
@@ -177,7 +177,7 @@ public class StrTokenizer implements Lis
* @return a new tokenizer instance which parses Comma Separated Value strings
*/
public static StrTokenizer getCSVInstance(final char[] input) {
- StrTokenizer tok = getCSVClone();
+ final StrTokenizer tok = getCSVClone();
tok.reset(input);
return tok;
}
@@ -212,7 +212,7 @@ public class StrTokenizer implements Lis
* @return a new tokenizer instance which parses Tab Separated Value strings.
*/
public static StrTokenizer getTSVInstance(final String input) {
- StrTokenizer tok = getTSVClone();
+ final StrTokenizer tok = getTSVClone();
tok.reset(input);
return tok;
}
@@ -225,7 +225,7 @@ public class StrTokenizer implements Lis
* @return a new tokenizer instance which parses Tab Separated Value strings.
*/
public static StrTokenizer getTSVInstance(final char[] input) {
- StrTokenizer tok = getTSVClone();
+ final StrTokenizer tok = getTSVClone();
tok.reset(input);
return tok;
}
@@ -441,8 +441,8 @@ public class StrTokenizer implements Lis
*/
public List<String> getTokenList() {
checkTokenized();
- List<String> list = new ArrayList<String>(tokens.length);
- for (String element : tokens) {
+ final List<String> list = new ArrayList<String>(tokens.length);
+ for (final String element : tokens) {
list.add(element);
}
return list;
@@ -603,10 +603,10 @@ public class StrTokenizer implements Lis
if (tokens == null) {
if (chars == null) {
// still call tokenize as subclass may do some work
- List<String> split = tokenize(null, 0, 0);
+ final List<String> split = tokenize(null, 0, 0);
tokens = split.toArray(new String[split.size()]);
} else {
- List<String> split = tokenize(chars, 0, chars.length);
+ final List<String> split = tokenize(chars, 0, chars.length);
tokens = split.toArray(new String[split.size()]);
}
}
@@ -636,8 +636,8 @@ public class StrTokenizer implements Lis
if (chars == null || count == 0) {
return Collections.emptyList();
}
- StrBuilder buf = new StrBuilder();
- List<String> tokens = new ArrayList<String>();
+ final StrBuilder buf = new StrBuilder();
+ final List<String> tokens = new ArrayList<String>();
int pos = offset;
// loop around the entire buffer
@@ -686,7 +686,7 @@ public class StrTokenizer implements Lis
// skip all leading whitespace, unless it is the
// field delimiter or the quote character
while (start < len) {
- int removeLen = Math.max(
+ final int removeLen = Math.max(
getIgnoredMatcher().isMatch(chars, start, start, len),
getTrimmerMatcher().isMatch(chars, start, start, len));
if (removeLen == 0 ||
@@ -704,14 +704,14 @@ public class StrTokenizer implements Lis
}
// handle empty token
- int delimLen = getDelimiterMatcher().isMatch(chars, start, start, len);
+ final int delimLen = getDelimiterMatcher().isMatch(chars, start, start, len);
if (delimLen > 0) {
addToken(tokens, "");
return start + delimLen;
}
// handle found token
- int quoteLen = getQuoteMatcher().isMatch(chars, start, start, len);
+ final int quoteLen = getQuoteMatcher().isMatch(chars, start, start, len);
if (quoteLen > 0) {
return readWithQuotes(chars, start + quoteLen, len, workArea, tokens, start, quoteLen);
}
@@ -775,7 +775,7 @@ public class StrTokenizer implements Lis
// Not in quoting mode
// check for delimiter, and thus end of token
- int delimLen = getDelimiterMatcher().isMatch(chars, pos, start, len);
+ final int delimLen = getDelimiterMatcher().isMatch(chars, pos, start, len);
if (delimLen > 0) {
// return condition when end of token found
addToken(tokens, workArea.substring(0, trimStart));
@@ -790,7 +790,7 @@ public class StrTokenizer implements Lis
}
// check for ignored (outside quotes), and ignore
- int ignoredLen = getIgnoredMatcher().isMatch(chars, pos, start, len);
+ final int ignoredLen = getIgnoredMatcher().isMatch(chars, pos, start, len);
if (ignoredLen > 0) {
pos += ignoredLen;
continue;
@@ -799,7 +799,7 @@ public class StrTokenizer implements Lis
// 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
- int trimmedLen = getTrimmerMatcher().isMatch(chars, pos, start, len);
+ final int trimmedLen = getTrimmerMatcher().isMatch(chars, pos, start, len);
if (trimmedLen > 0) {
workArea.append(chars, pos, trimmedLen);
pos += trimmedLen;
@@ -1075,7 +1075,7 @@ public class StrTokenizer implements Lis
public Object clone() {
try {
return cloneReset();
- } catch (CloneNotSupportedException ex) {
+ } catch (final CloneNotSupportedException ex) {
return null;
}
}
@@ -1089,7 +1089,7 @@ public class StrTokenizer implements Lis
*/
Object cloneReset() throws CloneNotSupportedException {
// this method exists to enable 100% test coverage
- StrTokenizer cloned = (StrTokenizer) super.clone();
+ final StrTokenizer cloned = (StrTokenizer) super.clone();
if (cloned.chars != null) {
cloned.chars = cloned.chars.clone();
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java Tue Jan 22 07:09:45 2013
@@ -95,9 +95,9 @@ public class WordUtils {
if (wrapLength < 1) {
wrapLength = 1;
}
- int inputLineLength = str.length();
+ final int inputLineLength = str.length();
int offset = 0;
- StringBuilder wrappedLine = new StringBuilder(inputLineLength + 32);
+ final StringBuilder wrappedLine = new StringBuilder(inputLineLength + 32);
while (inputLineLength - offset > wrapLength) {
if (str.charAt(offset) == ' ') {
@@ -198,14 +198,14 @@ public class WordUtils {
* @since 2.1
*/
public static String capitalize(final String str, final char... delimiters) {
- int delimLen = delimiters == null ? -1 : delimiters.length;
+ final int delimLen = delimiters == null ? -1 : delimiters.length;
if (StringUtils.isEmpty(str) || delimLen == 0) {
return str;
}
- char[] buffer = str.toCharArray();
+ final char[] buffer = str.toCharArray();
boolean capitalizeNext = true;
for (int i = 0; i < buffer.length; i++) {
- char ch = buffer[i];
+ final char ch = buffer[i];
if (isDelimiter(ch, delimiters)) {
capitalizeNext = true;
} else if (capitalizeNext) {
@@ -267,7 +267,7 @@ public class WordUtils {
* @since 2.1
*/
public static String capitalizeFully(String str, final char... delimiters) {
- int delimLen = delimiters == null ? -1 : delimiters.length;
+ final int delimLen = delimiters == null ? -1 : delimiters.length;
if (StringUtils.isEmpty(str) || delimLen == 0) {
return str;
}
@@ -323,14 +323,14 @@ public class WordUtils {
* @since 2.1
*/
public static String uncapitalize(final String str, final char... delimiters) {
- int delimLen = delimiters == null ? -1 : delimiters.length;
+ final int delimLen = delimiters == null ? -1 : delimiters.length;
if (StringUtils.isEmpty(str) || delimLen == 0) {
return str;
}
- char[] buffer = str.toCharArray();
+ final char[] buffer = str.toCharArray();
boolean uncapitalizeNext = true;
for (int i = 0; i < buffer.length; i++) {
- char ch = buffer[i];
+ final char ch = buffer[i];
if (isDelimiter(ch, delimiters)) {
uncapitalizeNext = true;
} else if (uncapitalizeNext) {
@@ -368,12 +368,12 @@ public class WordUtils {
if (StringUtils.isEmpty(str)) {
return str;
}
- char[] buffer = str.toCharArray();
+ final char[] buffer = str.toCharArray();
boolean whitespace = true;
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);
whitespace = false;
@@ -455,12 +455,12 @@ public class WordUtils {
if (delimiters != null && delimiters.length == 0) {
return "";
}
- int strLen = str.length();
- char[] buf = new char[strLen / 2 + 1];
+ final int strLen = str.length();
+ final char[] buf = new char[strLen / 2 + 1];
int count = 0;
boolean lastWasGap = true;
for (int i = 0; i < strLen; i++) {
- char ch = str.charAt(i);
+ final char ch = str.charAt(i);
if (isDelimiter(ch, delimiters)) {
lastWasGap = true;
@@ -486,7 +486,7 @@ public class WordUtils {
if (delimiters == null) {
return Character.isWhitespace(ch);
}
- for (char delimiter : delimiters) {
+ for (final char delimiter : delimiters) {
if (ch == delimiter) {
return true;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java Tue Jan 22 07:09:45 2013
@@ -48,8 +48,8 @@ public class AggregateTranslator extends
*/
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
- for (CharSequenceTranslator translator : translators) {
- int consumed = translator.translate(input, index, out);
+ for (final CharSequenceTranslator translator : translators) {
+ final int consumed = translator.translate(input, index, out);
if(consumed != 0) {
return consumed;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java Tue Jan 22 07:09:45 2013
@@ -55,10 +55,10 @@ public abstract class CharSequenceTransl
return null;
}
try {
- StringWriter writer = new StringWriter(input.length() * 2);
+ final StringWriter writer = new StringWriter(input.length() * 2);
translate(input, writer);
return writer.toString();
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
// this should never ever happen while writing to a StringWriter
throw new RuntimeException(ioe);
}
@@ -80,11 +80,11 @@ public abstract class CharSequenceTransl
return;
}
int pos = 0;
- int len = input.length();
+ final int len = input.length();
while (pos < len) {
- int consumed = translate(input, pos, out);
+ final int consumed = translate(input, pos, out);
if (consumed == 0) {
- char[] c = Character.toChars(Character.codePointAt(input, pos));
+ final char[] c = Character.toChars(Character.codePointAt(input, pos));
out.write(c);
pos+= c.length;
continue;
@@ -105,7 +105,7 @@ public abstract class CharSequenceTransl
* @return CharSequenceTranslator merging this translator with the others
*/
public final CharSequenceTranslator with(final CharSequenceTranslator... translators) {
- CharSequenceTranslator[] newArray = new CharSequenceTranslator[translators.length + 1];
+ final CharSequenceTranslator[] newArray = new CharSequenceTranslator[translators.length + 1];
newArray[0] = this;
System.arraycopy(translators, 0, newArray, 1, translators.length);
return new AggregateTranslator(newArray);
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java Tue Jan 22 07:09:45 2013
@@ -34,8 +34,8 @@ public abstract class CodePointTranslato
*/
@Override
public final int translate(final CharSequence input, final int index, final Writer out) throws IOException {
- int codepoint = Character.codePointAt(input, index);
- boolean consumed = translate(codepoint, out);
+ final int codepoint = Character.codePointAt(input, index);
+ final boolean consumed = translate(codepoint, out);
if (consumed) {
return 1;
} else {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java Tue Jan 22 07:09:45 2013
@@ -414,7 +414,7 @@ public class EntityArrays {
* @return String[][] inverted array
*/
public static String[][] invert(final String[][] array) {
- String[][] newarray = new String[array.length][2];
+ final String[][] newarray = new String[array.length][2];
for(int i = 0; i<array.length; i++) {
newarray[i][0] = array[i][1];
newarray[i][1] = array[i][0];
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java Tue Jan 22 07:09:45 2013
@@ -90,7 +90,7 @@ public class JavaUnicodeEscaper extends
*/
@Override
protected String toUtf16Escape(final int codepoint) {
- char[] surrogatePair = Character.toChars(codepoint);
+ final char[] surrogatePair = Character.toChars(codepoint);
return "\\u" + hex(surrogatePair[0]) + "\\u" + hex(surrogatePair[1]);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java Tue Jan 22 07:09:45 2013
@@ -42,9 +42,9 @@ public class LookupTranslator extends Ch
int _shortest = Integer.MAX_VALUE;
int _longest = 0;
if (lookup != null) {
- for (CharSequence[] seq : lookup) {
+ for (final CharSequence[] seq : lookup) {
this.lookupMap.put(seq[0], seq[1]);
- int sz = seq[0].length();
+ final int sz = seq[0].length();
if (sz < _shortest) {
_shortest = sz;
}
@@ -68,8 +68,8 @@ public class LookupTranslator extends Ch
}
// descend so as to get a greedy algorithm
for (int i = max; i >= shortest; i--) {
- CharSequence subSeq = input.subSequence(index, index + i);
- CharSequence result = lookupMap.get(subSeq);
+ final CharSequence subSeq = input.subSequence(index, index + i);
+ final CharSequence result = lookupMap.get(subSeq);
if (result != null) {
out.write(result.toString());
return i;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java Tue Jan 22 07:09:45 2013
@@ -76,13 +76,13 @@ public class NumericEntityUnescaper exte
*/
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
- int seqEnd = input.length();
+ final int seqEnd = input.length();
// Uses -2 to ensure there is something after the &#
if(input.charAt(index) == '&' && index < seqEnd - 2 && input.charAt(index + 1) == '#') {
int start = index + 2;
boolean isHex = false;
- char firstChar = input.charAt(start);
+ final char firstChar = input.charAt(start);
if(firstChar == 'x' || firstChar == 'X') {
start++;
isHex = true;
@@ -102,7 +102,7 @@ public class NumericEntityUnescaper exte
end++;
}
- boolean semiNext = end != seqEnd && input.charAt(end) == ';';
+ final boolean semiNext = end != seqEnd && input.charAt(end) == ';';
if(!semiNext) {
if(isSet(OPTION.semiColonRequired)) {
@@ -120,12 +120,12 @@ public class NumericEntityUnescaper exte
} else {
entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 10);
}
- } catch(NumberFormatException nfe) {
+ } catch(final NumberFormatException nfe) {
return 0;
}
if(entityValue > 0xFFFF) {
- char[] chrs = Character.toChars(entityValue);
+ final char[] chrs = Character.toChars(entityValue);
out.write(chrs[0]);
out.write(chrs[1]);
} else {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java Tue Jan 22 07:09:45 2013
@@ -41,7 +41,7 @@ public class OctalUnescaper extends Char
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
if(input.charAt(index) == '\\' && index < (input.length() - 1) && Character.isDigit(input.charAt(index + 1)) ) {
- int start = index + 1;
+ final int start = index + 1;
int end = index + 2;
while ( end < input.length() && Character.isDigit(input.charAt(end)) ) {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java Tue Jan 22 07:09:45 2013
@@ -47,12 +47,12 @@ public class UnicodeUnescaper extends Ch
if (index + i + 4 <= input.length()) {
// Get 4 hex digits
- CharSequence unicode = input.subSequence(index + i, index + i + 4);
+ final CharSequence unicode = input.subSequence(index + i, index + i + 4);
try {
- int value = Integer.parseInt(unicode.toString(), 16);
+ final int value = Integer.parseInt(unicode.toString(), 16);
out.write((char) value);
- } catch (NumberFormatException nfe) {
+ } catch (final NumberFormatException nfe) {
throw new IllegalArgumentException("Unable to parse unicode value: " + unicode, nfe);
}
return i + 4;