Skip to content

Commit c714697

Browse files
committed
Fix FindBugs issues.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1153502 13f79535-47bb-0310-9956-ffa450edef68
1 parent 54f7ca3 commit c714697

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/test/org/apache/commons/codec/StringEncoderComparatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void testComparatorWithDoubleMetaphoneAndInvalidInput() throws Exception
6969
StringEncoderComparator sCompare =
7070
new StringEncoderComparator( new DoubleMetaphone() );
7171

72-
int compare = sCompare.compare(new Double(3.0), new Long(3));
72+
int compare = sCompare.compare(new Double(3.0), Long.valueOf(3));
7373
assertEquals( "Trying to compare objects that make no sense to the underlying encoder should return a zero compare code",
7474
0, compare);
7575
}

src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ public class Base32InputStreamTest {
4141
@Test
4242
public void testCodec105() throws IOException {
4343
Base32InputStream in = new Base32InputStream(new Codec105ErrorInputStream(), true, 0, null);
44-
for (int i = 0; i < 5; i++) {
45-
in.read();
44+
try {
45+
for (int i = 0; i < 5; i++) {
46+
in.read();
47+
}
48+
} finally {
49+
in.close();
4650
}
4751
}
4852

src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ public class Base64InputStreamTest {
5151
@Test
5252
public void testCodec105() throws IOException {
5353
Base64InputStream in = new Base64InputStream(new Codec105ErrorInputStream(), true, 0, null);
54-
for (int i = 0; i < 5; i++) {
55-
in.read();
54+
try {
55+
for (int i = 0; i < 5; i++) {
56+
in.read();
57+
}
58+
} finally {
59+
in.close();
5660
}
5761
}
5862

src/test/org/apache/commons/codec/binary/Base64Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ public void testObjectDecodeWithInvalidParameter() throws Exception {
469469
Base64 b64 = new Base64();
470470

471471
try {
472-
b64.decode(new Integer(5));
472+
b64.decode(Integer.valueOf(5));
473473
fail("decode(Object) didn't throw an exception when passed an Integer object");
474474
} catch (DecoderException e) {
475475
// ignored

0 commit comments

Comments
 (0)