This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-logging.git
commit c4d0dca4611d04cd809fd868e4b215945fc0d31c Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Jun 30 10:46:52 2024 -0400 Move declarations --- .../apache/commons/logging/pathable/ParentFirstTestCase.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java b/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java index f68414c..91048ad 100644 --- a/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java +++ b/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java @@ -18,6 +18,7 @@ package org.apache.commons.logging.pathable; import static org.junit.Assert.assertNotEquals; +import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; @@ -236,8 +237,6 @@ public class ParentFirstTestCase extends TestCase { * Test that getResourceAsStream works. */ public void testResourceAsStream() throws Exception { - java.io.InputStream is; - // verify the class loader hierarchy final ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); final ClassLoader childLoader = contextLoader.getParent(); @@ -246,7 +245,7 @@ public class ParentFirstTestCase extends TestCase { assertNull("Unexpected class loader hierarchy", bootLoader); // getResourceAsStream where no instances exist - is = childLoader.getResourceAsStream("nosuchfile"); + InputStream is = childLoader.getResourceAsStream("nosuchfile"); assertNull("Invalid resource returned non-null stream", is); // getResourceAsStream where resource does exist @@ -264,9 +263,6 @@ public class ParentFirstTestCase extends TestCase { * Test that the various flavors of ClassLoader.getResources work as expected. */ public void testResources() throws Exception { - Enumeration<URL> resources; - URL[] urls; - // verify the class loader hierarchy final ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); final ClassLoader childLoader = contextLoader.getParent(); @@ -275,8 +271,8 @@ public class ParentFirstTestCase extends TestCase { assertNull("Unexpected class loader hierarchy", bootLoader); // getResources where no instances exist - resources = childLoader.getResources("nosuchfile"); - urls = toURLArray(resources); + Enumeration<URL> resources = childLoader.getResources("nosuchfile"); + URL[] urls = toURLArray(resources); assertEquals("Non-null URL returned for invalid resource name", 0, urls.length); // getResources where the resource only exists in the parent