Author: ggregory
Date: Mon Jul 11 01:10:36 2011
New Revision: 1145000
URL: http://svn.apache.org/viewvc?rev=1145000&view=rev
Log:
Convert to Java 5 enhanced loops.
Modified:
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/BaseNCodec.java
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/DoubleMetaphone.java
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32TestData.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64TestData.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/BCodecTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QCodecTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QuotedPrintableCodecTest.java
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/URLCodecTest.java
Modified:
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/BaseNCodec.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/BaseNCodec.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/BaseNCodec.java
(original)
+++
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/BaseNCodec.java
Mon Jul 11 01:10:36 2011
@@ -415,8 +415,8 @@ public abstract class BaseNCodec impleme
if (arrayOctet == null) {
return false;
}
- for (int i = 0; i < arrayOctet.length; i++) {
- if (PAD == arrayOctet[i] || isInAlphabet(arrayOctet[i])) {
+ for (byte element : arrayOctet) {
+ if (PAD == element || isInAlphabet(element)) {
return true;
}
}
Modified:
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java
(original)
+++
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java
Mon Jul 11 01:10:36 2011
@@ -272,8 +272,8 @@ public class ColognePhonetic implements
* Returns whether the array contains the key, or not.
*/
private static boolean arrayContains(char[] arr, char key) {
- for (int i = 0; i < arr.length; i++) {
- if (arr[i] == key) {
+ for (char element : arr) {
+ if (element == key) {
return true;
}
}
@@ -406,9 +406,9 @@ public class ColognePhonetic implements
for (int index = 0; index < chrs.length; index++) {
if (chrs[index] > 'Z') {
- for (int replacement = 0; replacement < PREPROCESS_MAP.length;
replacement++) {
- if (chrs[index] == PREPROCESS_MAP[replacement][0]) {
- chrs[index] = PREPROCESS_MAP[replacement][1];
+ for (char[] element : PREPROCESS_MAP) {
+ if (chrs[index] == element[0]) {
+ chrs[index] = element[1];
break;
}
}
Modified:
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/DoubleMetaphone.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/DoubleMetaphone.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/DoubleMetaphone.java
(original)
+++
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/DoubleMetaphone.java
Mon Jul 11 01:10:36 2011
@@ -905,8 +905,8 @@ public class DoubleMetaphone implements
*/
private boolean isSilentStart(String value) {
boolean result = false;
- for (int i = 0; i < SILENT_START.length; i++) {
- if (value.startsWith(SILENT_START[i])) {
+ for (String element : SILENT_START) {
+ if (value.startsWith(element)) {
result = true;
break;
}
@@ -1013,8 +1013,8 @@ public class DoubleMetaphone implements
if (start >= 0 && start + length <= value.length()) {
String target = value.substring(start, start + length);
- for (int i = 0; i < criteria.length; i++) {
- if (target.equals(criteria[i])) {
+ for (String element : criteria) {
+ if (target.equals(element)) {
result = true;
break;
}
Modified:
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java
(original)
+++
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java
Mon Jul 11 01:10:36 2011
@@ -153,8 +153,8 @@ public class QCodec extends RFC1522Codec
return null;
}
boolean hasUnderscores = false;
- for (int i = 0; i < bytes.length; i++) {
- if (bytes[i] == UNDERSCORE) {
+ for (byte b : bytes) {
+ if (b == UNDERSCORE) {
hasUnderscores = true;
break;
}
Modified:
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
(original)
+++
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
Mon Jul 11 01:10:36 2011
@@ -145,8 +145,8 @@ public class QuotedPrintableCodec implem
printable = PRINTABLE_CHARS;
}
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- for (int i = 0; i < bytes.length; i++) {
- int b = bytes[i];
+ for (byte c : bytes) {
+ int b = c;
if (b < 0) {
b = 256 + b;
}
Modified:
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java
(original)
+++
commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java
Mon Jul 11 01:10:36 2011
@@ -130,8 +130,8 @@ public class URLCodec implements BinaryE
}
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- for (int i = 0; i < bytes.length; i++) {
- int b = bytes[i];
+ for (byte c : bytes) {
+ int b = c;
if (b < 0) {
b = 256 + b;
}
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java
Mon Jul 11 01:10:36 2011
@@ -36,14 +36,14 @@ public abstract class StringEncoderAbstr
}
protected void checkEncodings(String[][] data) throws EncoderException {
- for (int i = 0; i < data.length; i++) {
- this.checkEncoding(data[i][1], data[i][0]);
+ for (String[] element : data) {
+ this.checkEncoding(element[1], element[0]);
}
}
protected void checkEncodingVariations(String expected, String data[])
throws EncoderException {
- for (int i = 0; i < data.length; i++) {
- this.checkEncoding(expected, data[i]);
+ for (String element : data) {
+ this.checkEncoding(expected, element);
}
}
@@ -93,16 +93,16 @@ public abstract class StringEncoderAbstr
Locale[] locales = {Locale.ENGLISH, new Locale("tr"),
Locale.getDefault()};
try {
- for (int i = 0; i < data.length; i++) {
+ for (String element : data) {
String ref = null;
for (int j = 0; j < locales.length; j++) {
Locale.setDefault(locales[j]);
if (j <= 0) {
- ref = encoder.encode(data[i]);
+ ref = encoder.encode(element);
} else {
String cur = null;
try {
- cur = encoder.encode(data[i]);
+ cur = encoder.encode(element);
} catch (Exception e) {
Assert.fail(Locale.getDefault().toString() + ": "
+ e.getMessage());
}
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java
Mon Jul 11 01:10:36 2011
@@ -230,8 +230,8 @@ public class Base32OutputStreamTest {
// Start with encode.
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
OutputStream out = new Base32OutputStream(byteOut, true, chunkSize,
seperator);
- for (int i = 0; i < decoded.length; i++) {
- out.write(decoded[i]);
+ for (byte element : decoded) {
+ out.write(element);
}
out.close();
byte[] output = byteOut.toByteArray();
@@ -240,8 +240,8 @@ public class Base32OutputStreamTest {
// Now let's try decode.
byteOut = new ByteArrayOutputStream();
out = new Base32OutputStream(byteOut, false);
- for (int i = 0; i < encoded.length; i++) {
- out.write(encoded[i]);
+ for (byte element : encoded) {
+ out.write(element);
}
out.close();
output = byteOut.toByteArray();
@@ -250,8 +250,8 @@ public class Base32OutputStreamTest {
// Now let's try decode with tonnes of flushes.
byteOut = new ByteArrayOutputStream();
out = new Base32OutputStream(byteOut, false);
- for (int i = 0; i < encoded.length; i++) {
- out.write(encoded[i]);
+ for (byte element : encoded) {
+ out.write(element);
out.flush();
}
out.close();
@@ -265,8 +265,8 @@ public class Base32OutputStreamTest {
out = new Base32OutputStream(out, false);
out = new Base32OutputStream(out, true, chunkSize, seperator);
}
- for (int i = 0; i < decoded.length; i++) {
- out.write(decoded[i]);
+ for (byte element : decoded) {
+ out.write(element);
}
out.close();
output = byteOut.toByteArray();
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java
Mon Jul 11 01:10:36 2011
@@ -61,24 +61,24 @@ public class Base32Test {
@Test
public void testBase32Samples() throws Exception {
Base32 codec = new Base32();
- for (int i = 0; i < BASE32_TEST_CASES.length; i++) {
- assertEquals(BASE32_TEST_CASES[i][1],
codec.encodeAsString(BASE32_TEST_CASES[i][0].getBytes("UTF-8")));
+ for (String[] element : BASE32_TEST_CASES) {
+ assertEquals(element[1],
codec.encodeAsString(element[0].getBytes("UTF-8")));
}
}
@Test
public void testBase32HexSamples() throws Exception {
Base32 codec = new Base32(true);
- for (int i = 0; i < BASE32HEX_TEST_CASES.length; i++) {
- assertEquals(BASE32HEX_TEST_CASES[i][1],
codec.encodeAsString(BASE32HEX_TEST_CASES[i][0].getBytes("UTF-8")));
+ for (String[] element : BASE32HEX_TEST_CASES) {
+ assertEquals(element[1],
codec.encodeAsString(element[0].getBytes("UTF-8")));
}
}
@Test
public void testBase32Chunked () throws Exception {
Base32 codec = new Base32(20);
- for (int i = 0; i < BASE32_TEST_CASES_CHUNKED.length; i++) {
- assertEquals(BASE32_TEST_CASES_CHUNKED[i][1],
codec.encodeAsString(BASE32_TEST_CASES_CHUNKED[i][0].getBytes("UTF-8")));
+ for (String[] element : BASE32_TEST_CASES_CHUNKED) {
+ assertEquals(element[1],
codec.encodeAsString(element[0].getBytes("UTF-8")));
}
}
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32TestData.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32TestData.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32TestData.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32TestData.java
Mon Jul 11 01:10:36 2011
@@ -116,8 +116,8 @@ public class Base32TestData {
* @return true if bytes contains c, false otherwise
*/
static boolean bytesContain(byte[] bytes, byte c) {
- for (int i = 0; i < bytes.length; i++) {
- if (bytes[i] == c) { return true; }
+ for (byte b : bytes) {
+ if (b == c) { return true; }
}
return false;
}
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
Mon Jul 11 01:10:36 2011
@@ -242,8 +242,8 @@ public class Base64OutputStreamTest {
// Start with encode.
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
OutputStream out = new Base64OutputStream(byteOut, true, chunkSize,
seperator);
- for (int i = 0; i < decoded.length; i++) {
- out.write(decoded[i]);
+ for (byte element : decoded) {
+ out.write(element);
}
out.close();
byte[] output = byteOut.toByteArray();
@@ -252,8 +252,8 @@ public class Base64OutputStreamTest {
// Now let's try decode.
byteOut = new ByteArrayOutputStream();
out = new Base64OutputStream(byteOut, false);
- for (int i = 0; i < encoded.length; i++) {
- out.write(encoded[i]);
+ for (byte element : encoded) {
+ out.write(element);
}
out.close();
output = byteOut.toByteArray();
@@ -262,8 +262,8 @@ public class Base64OutputStreamTest {
// Now let's try decode with tonnes of flushes.
byteOut = new ByteArrayOutputStream();
out = new Base64OutputStream(byteOut, false);
- for (int i = 0; i < encoded.length; i++) {
- out.write(encoded[i]);
+ for (byte element : encoded) {
+ out.write(element);
out.flush();
}
out.close();
@@ -277,8 +277,8 @@ public class Base64OutputStreamTest {
out = new Base64OutputStream(out, false);
out = new Base64OutputStream(out, true, chunkSize, seperator);
}
- for (int i = 0; i < decoded.length; i++) {
- out.write(decoded[i]);
+ for (byte element : decoded) {
+ out.write(element);
}
out.close();
output = byteOut.toByteArray();
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64TestData.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64TestData.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64TestData.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64TestData.java
Mon Jul 11 01:10:36 2011
@@ -214,8 +214,8 @@ public class Base64TestData {
* @return true if bytes contains c, false otherwise
*/
static boolean bytesContain(byte[] bytes, byte c) {
- for (int i = 0; i < bytes.length; i++) {
- if (bytes[i] == c) { return true; }
+ for (byte b : bytes) {
+ if (b == c) { return true; }
}
return false;
}
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java
Mon Jul 11 01:10:36 2011
@@ -142,8 +142,8 @@ public class ColognePhoneticTest extends
{"ganz", "Gans"},
{"ganz", "Gänse"},
{"Miyagi", "Miyako"}};
- for (int i = 0; i < data.length; i++) {
- ((ColognePhonetic)
this.getStringEncoder()).isEncodeEqual(data[i][1], data[i][0]);
+ for (String[] element : data) {
+ ((ColognePhonetic)
this.getStringEncoder()).isEncodeEqual(element[1], element[0]);
}
}
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
Mon Jul 11 01:10:36 2011
@@ -1029,9 +1029,9 @@ public class DoubleMetaphoneTest extends
public void doubleMetaphoneEqualTest(String[][] pairs, boolean
useAlternate) {
this.validateFixture(pairs);
- for (int i = 0; i < pairs.length; i++) {
- String name0 = pairs[i][0];
- String name1 = pairs[i][1];
+ for (String[] pair : pairs) {
+ String name0 = pair[0];
+ String name1 = pair[1];
String failMsg = "Expected match between " + name0 + " and " +
name1 + " (use alternate: " + useAlternate + ")";
assertTrue(failMsg,
this.getDoubleMetaphone().isDoubleMetaphoneEqual(name0, name1, useAlternate));
assertTrue(failMsg,
this.getDoubleMetaphone().isDoubleMetaphoneEqual(name1, name0, useAlternate));
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java
Mon Jul 11 01:10:36 2011
@@ -33,23 +33,23 @@ public class MetaphoneTest extends Strin
public void assertIsMetaphoneEqual(String source, String[] matches) {
// match source to all matches
- for (int i = 0; i < matches.length; i++) {
- assertTrue("Source: " + source + ", should have same Metaphone as:
" + matches[i],
- this.getMetaphone().isMetaphoneEqual(source,
matches[i]));
+ for (String matche : matches) {
+ assertTrue("Source: " + source + ", should have same Metaphone as:
" + matche,
+ this.getMetaphone().isMetaphoneEqual(source, matche));
}
// match to each other
- for (int i = 0; i < matches.length; i++) {
- for (int j = 0; j < matches.length; j++) {
- assertTrue(this.getMetaphone().isMetaphoneEqual(matches[i],
matches[j]));
+ for (String matche : matches) {
+ for (String matche2 : matches) {
+ assertTrue(this.getMetaphone().isMetaphoneEqual(matche,
matche2));
}
}
}
public void assertMetaphoneEqual(String[][] pairs) {
this.validateFixture(pairs);
- for (int i = 0; i < pairs.length; i++) {
- String name0 = pairs[i][0];
- String name1 = pairs[i][1];
+ for (String[] pair : pairs) {
+ String name0 = pair[0];
+ String name1 = pair[1];
String failMsg = "Expected match between " + name0 + " and " +
name1;
assertTrue(failMsg, this.getMetaphone().isMetaphoneEqual(name0,
name1));
assertTrue(failMsg, this.getMetaphone().isMetaphoneEqual(name1,
name0));
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/BCodecTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/BCodecTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/BCodecTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/BCodecTest.java
Mon Jul 11 01:10:36 2011
@@ -43,8 +43,8 @@ public class BCodecTest {
private String constructString(int[] unicodeChars) {
StringBuffer buffer = new StringBuffer();
if (unicodeChars != null) {
- for (int i = 0; i < unicodeChars.length; i++) {
- buffer.append((char) unicodeChars[i]);
+ for (int unicodeChar : unicodeChars) {
+ buffer.append((char) unicodeChar);
}
}
return buffer.toString();
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QCodecTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QCodecTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QCodecTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QCodecTest.java
Mon Jul 11 01:10:36 2011
@@ -49,8 +49,8 @@ public class QCodecTest {
private String constructString(int [] unicodeChars) {
StringBuffer buffer = new StringBuffer();
if (unicodeChars != null) {
- for (int i = 0; i < unicodeChars.length; i++) {
- buffer.append((char)unicodeChars[i]);
+ for (int unicodeChar : unicodeChars) {
+ buffer.append((char)unicodeChar);
}
}
return buffer.toString();
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QuotedPrintableCodecTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QuotedPrintableCodecTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QuotedPrintableCodecTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QuotedPrintableCodecTest.java
Mon Jul 11 01:10:36 2011
@@ -47,8 +47,8 @@ public class QuotedPrintableCodecTest {
private String constructString(int [] unicodeChars) {
StringBuffer buffer = new StringBuffer();
if (unicodeChars != null) {
- for (int i = 0; i < unicodeChars.length; i++) {
- buffer.append((char)unicodeChars[i]);
+ for (int unicodeChar : unicodeChars) {
+ buffer.append((char)unicodeChar);
}
}
return buffer.toString();
Modified:
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/URLCodecTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/URLCodecTest.java?rev=1145000&r1=1144999&r2=1145000&view=diff
==============================================================================
---
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/URLCodecTest.java
(original)
+++
commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/URLCodecTest.java
Mon Jul 11 01:10:36 2011
@@ -52,8 +52,8 @@ public class URLCodecTest {
private String constructString(int [] unicodeChars) {
StringBuffer buffer = new StringBuffer();
if (unicodeChars != null) {
- for (int i = 0; i < unicodeChars.length; i++) {
- buffer.append((char)unicodeChars[i]);
+ for (int unicodeChar : unicodeChars) {
+ buffer.append((char)unicodeChar);
}
}
return buffer.toString();