Convert to Java 5 enhanced loops.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1144929 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2011-07-10 18:26:16 +00:00
parent f3fbf1e4fa
commit fab64bbdc7
26 changed files with 110 additions and 121 deletions

View File

@ -216,8 +216,8 @@ public class ObjectUtils {
public static int hashCodeMulti(Object... objects) {
int hash = 1;
if (objects != null) {
for (int i = 0; i < objects.length; i++) {
hash = hash * 31 + ObjectUtils.hashCode(objects[i]);
for (Object object : objects) {
hash = hash * 31 + ObjectUtils.hashCode(object);
}
}
return hash;

View File

@ -6392,8 +6392,7 @@ public class StringUtils {
if (isEmpty(string) || ArrayUtils.isEmpty(searchStrings)) {
return false;
}
for (int i = 0; i < searchStrings.length; i++) {
CharSequence searchString = searchStrings[i];
for (CharSequence searchString : searchStrings) {
if (StringUtils.startsWith(string, searchString)) {
return true;
}
@ -6550,8 +6549,7 @@ public class StringUtils {
if (isEmpty(string) || ArrayUtils.isEmpty(searchStrings)) {
return false;
}
for (int i = 0; i < searchStrings.length; i++) {
CharSequence searchString = searchStrings[i];
for (CharSequence searchString : searchStrings) {
if (StringUtils.endsWith(string, searchString)) {
return true;
}

View File

@ -591,8 +591,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (boolean element : array) {
append(element);
}
}
return this;
@ -629,8 +629,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (byte element : array) {
append(element);
}
}
return this;
@ -663,8 +663,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (char element : array) {
append(element);
}
}
return this;
@ -696,8 +696,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (double element : array) {
append(element);
}
}
return this;
@ -730,8 +730,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (float element : array) {
append(element);
}
}
return this;
@ -764,8 +764,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (int element : array) {
append(element);
}
}
return this;
@ -802,8 +802,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (long element : array) {
append(element);
}
}
return this;
@ -866,8 +866,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (Object element : array) {
append(element);
}
}
return this;
@ -900,8 +900,8 @@ public class HashCodeBuilder implements Builder<Integer> {
if (array == null) {
iTotal = iTotal * iConstant;
} else {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (short element : array) {
append(element);
}
}
return this;

View File

@ -147,8 +147,7 @@ public class ExceptionUtils {
methodNames = CAUSE_METHOD_NAMES;
}
for (int i = 0; i < methodNames.length; i++) {
String methodName = methodNames[i];
for (String methodName : methodNames) {
if (methodName != null) {
Throwable cause = getCauseUsingMethodName(throwable, methodName);
if (cause != null) {
@ -461,8 +460,8 @@ public class ExceptionUtils {
throw new IllegalArgumentException("The PrintStream must not be null");
}
String trace[] = getRootCauseStackTrace(throwable);
for (int i = 0; i < trace.length; i++) {
stream.println(trace[i]);
for (String element : trace) {
stream.println(element);
}
stream.flush();
}
@ -494,8 +493,8 @@ public class ExceptionUtils {
throw new IllegalArgumentException("The PrintWriter must not be null");
}
String trace[] = getRootCauseStackTrace(throwable);
for (int i = 0; i < trace.length; i++) {
writer.println(trace[i]);
for (String element : trace) {
writer.println(element);
}
writer.flush();
}

View File

@ -18,7 +18,6 @@ package org.apache.commons.lang3.reflect;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Iterator;
import org.apache.commons.lang3.ClassUtils;
@ -114,16 +113,11 @@ public class FieldUtils {
// incase there is a public supersuperclass field hidden by a private/package
// superclass field.
Field match = null;
for (Iterator<Class<?>> intf = ClassUtils.getAllInterfaces(cls).iterator(); intf
.hasNext();) {
for (Class<?> class1 : ClassUtils.getAllInterfaces(cls)) {
try {
Field test = ((Class<?>) intf.next()).getField(fieldName);
Field test = ((Class<?>) class1).getField(fieldName);
if (match != null) {
throw new IllegalArgumentException(
"Reference to field "
+ fieldName
+ " is ambiguous relative to "
+ cls
throw new IllegalArgumentException("Reference to field " + fieldName + " is ambiguous relative to " + cls
+ "; a matching field exists on two or more implemented interfaces.");
}
match = test;

View File

@ -516,13 +516,13 @@ public class MethodUtils {
// search through all methods
Method bestMatch = null;
Method[] methods = cls.getMethods();
for (int i = 0, size = methods.length; i < size; i++) {
if (methods[i].getName().equals(methodName)) {
for (Method method : methods) {
if (method.getName().equals(methodName)) {
// compare parameters
if (ClassUtils.isAssignable(parameterTypes, methods[i]
if (ClassUtils.isAssignable(parameterTypes, method
.getParameterTypes(), true)) {
// get accessible version of method
Method accessibleMethod = getAccessibleMethod(methods[i]);
Method accessibleMethod = getAccessibleMethod(method);
if (accessibleMethod != null) {
if (bestMatch == null
|| MemberUtils.compareParameterTypes(

View File

@ -790,8 +790,7 @@ public class TypeUtils {
Type genericInterface = null;
// find the interface closest to the super class
for (int i = 0; i < interfaceTypes.length; i++) {
Type midType = interfaceTypes[i];
for (Type midType : interfaceTypes) {
Class<?> midClass = null;
if (midType instanceof ParameterizedType) {

View File

@ -525,8 +525,8 @@ public class ExtendedMessageFormat extends MessageFormat {
if (coll == null || coll.size() == 0) {
return false;
}
for (Iterator<?> iter = coll.iterator(); iter.hasNext();) {
if (iter.next() != null) {
for (Object name : coll) {
if (name != null) {
return true;
}
}

View File

@ -961,8 +961,8 @@ public class StrBuilder implements CharSequence, Appendable {
*/
public StrBuilder appendAll(Object[] array) {
if (array != null && array.length > 0) {
for (int i = 0; i < array.length; i++) {
append(array[i]);
for (Object element : array) {
append(element);
}
}
return this;

View File

@ -486,8 +486,8 @@ public class WordUtils {
if (delimiters == null) {
return Character.isWhitespace(ch);
}
for (int i = 0, isize = delimiters.length; i < isize; i++) {
if (ch == delimiters[i]) {
for (char delimiter : delimiters) {
if (ch == delimiter) {
return true;
}
}

View File

@ -310,12 +310,12 @@ public class DateUtils {
SimpleDateFormat parser = new SimpleDateFormat();
parser.setLenient(lenient);
ParsePosition pos = new ParsePosition(0);
for (int i = 0; i < parsePatterns.length; i++) {
for (String parsePattern : parsePatterns) {
String pattern = parsePatterns[i];
String pattern = parsePattern;
// LANG-530 - need to make sure 'ZZ' output doesn't get passed to SimpleDateFormat
if (parsePatterns[i].endsWith("ZZ")) {
if (parsePattern.endsWith("ZZ")) {
pattern = pattern.substring(0, pattern.length() - 1);
}
@ -324,7 +324,7 @@ public class DateUtils {
String str2 = str;
// LANG-530 - need to make sure 'ZZ' output doesn't hit SimpleDateFormat as it will ParseException
if (parsePatterns[i].endsWith("ZZ")) {
if (parsePattern.endsWith("ZZ")) {
str2 = str.replaceAll("([-+][0-9][0-9]):([0-9][0-9])$", "$1$2");
}
@ -950,9 +950,9 @@ public class DateUtils {
// ----------------- Fix for LANG-59 ----------------------- END ----------------
boolean roundUp = false;
for (int i = 0; i < fields.length; i++) {
for (int j = 0; j < fields[i].length; j++) {
if (fields[i][j] == field) {
for (int[] aField : fields) {
for (int j = 0; j < aField.length; j++) {
if (aField[j] == field) {
//This is our field... we stop looping
if (modType == MODIFY_CEILING || (modType == MODIFY_ROUND && roundUp)) {
if (field == DateUtils.SEMI_MONTH) {
@ -980,7 +980,7 @@ public class DateUtils {
} else {
//We need at add one to this field since the
// last number causes us to round up
val.add(fields[i][0], 1);
val.add(aField[0], 1);
}
}
return;
@ -992,7 +992,7 @@ public class DateUtils {
//These are special types of fields that require different rounding rules
switch (field) {
case DateUtils.SEMI_MONTH:
if (fields[i][0] == Calendar.DATE) {
if (aField[0] == Calendar.DATE) {
//If we're going to drop the DATE field's value,
// we want to do this our own way.
//We need to subtrace 1 since the date has a minimum of 1
@ -1008,7 +1008,7 @@ public class DateUtils {
}
break;
case Calendar.AM_PM:
if (fields[i][0] == Calendar.HOUR_OF_DAY) {
if (aField[0] == Calendar.HOUR_OF_DAY) {
//If we're going to drop the HOUR field's value,
// we want to do this our own way.
offset = val.get(Calendar.HOUR_OF_DAY);
@ -1021,16 +1021,16 @@ public class DateUtils {
break;
}
if (!offsetSet) {
int min = val.getActualMinimum(fields[i][0]);
int max = val.getActualMaximum(fields[i][0]);
int min = val.getActualMinimum(aField[0]);
int max = val.getActualMaximum(aField[0]);
//Calculate the offset from the minimum allowed value
offset = val.get(fields[i][0]) - min;
offset = val.get(aField[0]) - min;
//Set roundUp if this is more than half way between the minimum and maximum
roundUp = offset > ((max - min) / 2);
}
//We need to remove this field
if (offset != 0) {
val.set(fields[i][0], val.get(fields[i][0]) - offset);
val.set(aField[0], val.get(aField[0]) - offset);
}
}
throw new IllegalArgumentException("The field " + field + " is not supported");

View File

@ -125,8 +125,7 @@ public class CharUtilsPerfRun {
private int run_CharSet(int loopCount) {
int t = 0;
for (int i = 0; i < loopCount; i++) {
for (int j = 0; j < CHAR_SAMPLES.length; j++) {
char ch = CHAR_SAMPLES[j];
for (char ch : CHAR_SAMPLES) {
boolean b = CharSet.ASCII_NUMERIC.contains(ch);
t += b ? 1 : 0;
}
@ -137,8 +136,7 @@ public class CharUtilsPerfRun {
private int run_CharUtils_isAsciiNumeric(int loopCount) {
int t = 0;
for (int i = 0; i < loopCount; i++) {
for (int j = 0; j < CHAR_SAMPLES.length; j++) {
char ch = CHAR_SAMPLES[j];
for (char ch : CHAR_SAMPLES) {
boolean b = CharUtils.isAsciiNumeric(ch);
t += b ? 1 : 0;
}
@ -149,8 +147,7 @@ public class CharUtilsPerfRun {
private int run_inlined_CharUtils_isAsciiNumeric(int loopCount) {
int t = 0;
for (int i = 0; i < loopCount; i++) {
for (int j = 0; j < CHAR_SAMPLES.length; j++) {
char ch = CHAR_SAMPLES[j];
for (char ch : CHAR_SAMPLES) {
boolean b = (ch >= '0' && ch <= '9');
t += b ? 1 : 0;
}

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_5;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@ -27,8 +29,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.apache.commons.lang3.JavaVersion.*;
import junit.framework.TestCase;
/**
@ -793,10 +793,10 @@ public class ClassUtilsTest extends TestCase {
Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE,
Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE
};
for (int i = 0; i < primitives.length; i++) {
Class<?> wrapperCls = ClassUtils.primitiveToWrapper(primitives[i]);
for (Class<?> primitive : primitives) {
Class<?> wrapperCls = ClassUtils.primitiveToWrapper(primitive);
assertFalse("Still primitive", wrapperCls.isPrimitive());
assertEquals(wrapperCls + " -> " + primitives[i], primitives[i],
assertEquals(wrapperCls + " -> " + primitive, primitive,
ClassUtils.wrapperToPrimitive(wrapperCls));
}
}

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_4;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.util.Arrays;
@ -26,8 +28,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Set;
import static org.apache.commons.lang3.JavaVersion.*;
import junit.framework.TestCase;
/**
@ -385,7 +385,7 @@ public class LocaleUtilsTest extends TestCase {
assertNotNull(list);
assertSame(list, list2);
//search through langauges
for (int i = 0; i < languages.length; i++) {
for (String language : languages) {
Iterator<Locale> iterator = list.iterator();
boolean found = false;
// see if it was returned by the set
@ -395,13 +395,13 @@ public class LocaleUtilsTest extends TestCase {
assertTrue(locale.getVariant() == null
|| locale.getVariant().length() == 0);
assertEquals(country, locale.getCountry());
if (languages[i].equals(locale.getLanguage())) {
if (language.equals(locale.getLanguage())) {
found = true;
break;
}
}
if (!found) {
fail("Cound not find language: " + languages[i]
fail("Cound not find language: " + language
+ " for country: " + country);
}
}
@ -435,7 +435,7 @@ public class LocaleUtilsTest extends TestCase {
assertNotNull(list);
assertSame(list, list2);
//search through langauges
for (int i = 0; i < countries.length; i++) {
for (String countrie : countries) {
Iterator<Locale> iterator = list.iterator();
boolean found = false;
// see if it was returned by the set
@ -445,13 +445,13 @@ public class LocaleUtilsTest extends TestCase {
assertTrue(locale.getVariant() == null
|| locale.getVariant().length() == 0);
assertEquals(language, locale.getLanguage());
if (countries[i].equals(locale.getCountry())) {
if (countrie.equals(locale.getCountry())) {
found = true;
break;
}
}
if (!found) {
fail("Cound not find language: " + countries[i]
fail("Cound not find language: " + countrie
+ " for country: " + language);
}
}

View File

@ -220,8 +220,8 @@ public class StringUtilsEqualsIndexOfTest extends TestCase {
};
try {
for (int i = 0; i < locales.length; i++) {
Locale.setDefault(locales[i]);
for (Locale locale : locales) {
Locale.setDefault(locale);
for (int j = 0; j < tdata.length; j++) {
assertTrue(Locale.getDefault() + ": " + j + " " + tdata[j][0] + " " + tdata[j][1], StringUtils
.containsIgnoreCase(tdata[j][0], tdata[j][1]));

View File

@ -17,6 +17,7 @@
package org.apache.commons.lang3;
import junit.framework.TestCase;
import org.apache.commons.lang3.text.StrBuilder;
/**

View File

@ -1183,9 +1183,9 @@ public class StringUtilsTest extends TestCase {
{ "", "" },
{ "a", "" },
};
for (int i = 0; i < chopCases.length; i++) {
String original = chopCases[i][0];
String expectedResult = chopCases[i][1];
for (String[] chopCase : chopCases) {
String original = chopCase[0];
String expectedResult = chopCase[1];
assertEquals("chop(String) failed",
expectedResult, StringUtils.chop(original));
}
@ -1211,9 +1211,9 @@ public class StringUtilsTest extends TestCase {
{ null, null },
{ FOO_UNCAP + "\n\r", FOO_UNCAP + "\n"}
};
for (int i = 0; i < chompCases.length; i++) {
String original = chompCases[i][0];
String expectedResult = chompCases[i][1];
for (String[] chompCase : chompCases) {
String original = chompCase[0];
String expectedResult = chompCase[1];
assertEquals("chomp(String) failed",
expectedResult, StringUtils.chomp(original));
}
@ -1990,8 +1990,7 @@ public class StringUtilsTest extends TestCase {
public void testStringUtilsCharSequenceContract() {
Class<StringUtils> c = StringUtils.class;
Method[] methods = c.getMethods();
for (int i=0; i<methods.length; i++) {
Method m = methods[i];
for (Method m : methods) {
if (m.getReturnType() == String.class || m.getReturnType() == String[].class) {
// Assume this is mutable and ensure the first parameter is not CharSequence.
// It may be String or it may be something else (String[], Object, Object[]) so

View File

@ -19,6 +19,8 @@
package org.apache.commons.lang3;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_4;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
@ -27,8 +29,6 @@ import java.util.Locale;
import junit.framework.Assert;
import junit.framework.TestCase;
import static org.apache.commons.lang3.JavaVersion.*;
/**
* Unit tests {@link org.apache.commons.lang3.SystemUtils}.
*

View File

@ -17,8 +17,8 @@
package org.apache.commons.lang3.event;
import java.beans.PropertyVetoException;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

View File

@ -16,7 +16,6 @@
*/
package org.apache.commons.lang3.event;
import javax.naming.event.ObjectChangeListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.VetoableChangeListener;
@ -29,6 +28,8 @@ import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import javax.naming.event.ObjectChangeListener;
import junit.framework.TestCase;
/**

View File

@ -23,11 +23,11 @@ import java.util.Date;
import java.util.List;
import java.util.Set;
import junit.framework.TestCase;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.tuple.Pair;
import junit.framework.TestCase;
/**
* Abstract test of an ExceptionContext implementation.

View File

@ -408,8 +408,8 @@ public class ExceptionUtilsTest extends TestCase {
Throwable withCause = createExceptionWithCause();
String[] stackTrace = ExceptionUtils.getRootCauseStackTrace(withCause);
boolean match = false;
for (int i = 0; i < stackTrace.length; i++) {
if (stackTrace[i].startsWith(ExceptionUtils.WRAPPED_MARKER)) {
for (String element : stackTrace) {
if (element.startsWith(ExceptionUtils.WRAPPED_MARKER)) {
match = true;
break;
}
@ -418,8 +418,8 @@ public class ExceptionUtilsTest extends TestCase {
stackTrace = ExceptionUtils.getRootCauseStackTrace(withoutCause);
match = false;
for (int i = 0; i < stackTrace.length; i++) {
if (stackTrace[i].startsWith(ExceptionUtils.WRAPPED_MARKER)) {
for (String element : stackTrace) {
if (element.startsWith(ExceptionUtils.WRAPPED_MARKER)) {
match = true;
break;
}

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3.math;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_3;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
@ -23,7 +25,6 @@ import java.math.BigInteger;
import junit.framework.TestCase;
import static org.apache.commons.lang3.JavaVersion.*;
import org.apache.commons.lang3.SystemUtils;
/**

View File

@ -254,8 +254,8 @@ public class MethodUtilsTest extends TestCase {
public void testGetAccessibleInterfaceMethod() throws Exception {
Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
for (int i = 0; i < p.length; i++) {
Method method = TestMutable.class.getMethod("getValue", p[i]);
for (Class<?>[] element : p) {
Method method = TestMutable.class.getMethod("getValue", element);
Method accessibleMethod = MethodUtils.getAccessibleMethod(method);
assertNotSame(accessibleMethod, method);
assertSame(Mutable.class, accessibleMethod.getDeclaringClass());
@ -272,9 +272,9 @@ public class MethodUtilsTest extends TestCase {
public void testGetAccessibleInterfaceMethodFromDescription()
throws Exception {
Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
for (int i = 0; i < p.length; i++) {
for (Class<?>[] element : p) {
Method accessibleMethod = MethodUtils.getAccessibleMethod(
TestMutable.class, "getValue", p[i]);
TestMutable.class, "getValue", element);
assertSame(Mutable.class, accessibleMethod.getDeclaringClass());
}
}

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3.text;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_4;
import java.text.ChoiceFormat;
import java.text.DateFormat;
import java.text.FieldPosition;
@ -28,13 +30,11 @@ import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import junit.framework.TestCase;
import static org.apache.commons.lang3.JavaVersion.*;
import org.apache.commons.lang3.SystemUtils;
/**
@ -102,8 +102,7 @@ public class ExtendedMessageFormatTest extends TestCase {
testLocales.retainAll(Arrays.asList(NumberFormat.getAvailableLocales()));
testLocales.add(null);
for (Iterator<Locale> l = testLocales.iterator(); l.hasNext();) {
Locale locale = l.next();
for (Locale locale : testLocales) {
MessageFormat builtins = createMessageFormat(builtinsPattern, locale);
String expectedPattern = extendedPattern + builtins.toPattern();
DateFormat df = null;
@ -194,13 +193,13 @@ public class ExtendedMessageFormatTest extends TestCase {
Locale[] availableLocales = ChoiceFormat.getAvailableLocales();
choicePattern = "{0,choice,1#One|2#Two|3#Many {0,number}}";
for (int i = 0; i < values.length; i++) {
checkBuiltInFormat(values[i] + ": " + choicePattern, new Object[] {values[i]}, availableLocales);
for (Object value : values) {
checkBuiltInFormat(value + ": " + choicePattern, new Object[] {value}, availableLocales);
}
choicePattern = "{0,choice,1#''One''|2#\"Two\"|3#''{Many}'' {0,number}}";
for (int i = 0; i < values.length; i++) {
checkBuiltInFormat(values[i] + ": " + choicePattern, new Object[] {values[i]}, availableLocales);
for (Object value : values) {
checkBuiltInFormat(value + ": " + choicePattern, new Object[] {value}, availableLocales);
}
}
@ -326,8 +325,8 @@ public class ExtendedMessageFormatTest extends TestCase {
*/
private void checkBuiltInFormat(String pattern, Map<String, ?> registry, Object[] args, Locale[] locales) {
checkBuiltInFormat(pattern, registry, args, (Locale) null);
for (int i = 0; i < locales.length; i++) {
checkBuiltInFormat(pattern, registry, args, locales[i]);
for (Locale locale : locales) {
checkBuiltInFormat(pattern, registry, args, locale);
}
}

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3.time;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_4;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.text.DateFormat;
@ -32,7 +34,6 @@ import java.util.TimeZone;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import static org.apache.commons.lang3.JavaVersion.*;
import org.apache.commons.lang3.SystemUtils;
/**