Skip to content

Commit

Permalink
{get=>find}Resource in some tests
Browse files Browse the repository at this point in the history
This does not call the parent class loader first, which may return
different resources if they're on classpath.

fixes scala/bug#12677
  • Loading branch information
ansvonwa committed Oct 31, 2022
1 parent 5790494 commit e3ebb24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/junit/scala/reflect/io/ZipArchiveTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ZipArchiveTest {
assertThrown[IOException](_.getMessage.contains(f.toString))(fza.iterator)
}

private def manifestAt(location: URI): URL = ScalaClassLoader.fromURLs(List(location.toURL), null).getResource("META-INF/MANIFEST.MF");
private def manifestAt(location: URI): URL = ScalaClassLoader.fromURLs(List(location.toURL), null).findResource("META-INF/MANIFEST.MF");

// ZipArchive.fromManifestURL(URL)
@Test def `manifest resources just works`(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ZipAndJarFileLookupFactoryTest {
()
}
}
def manifestAt(location: URI): URL = ScalaClassLoader.fromURLs(List(location.toURL), null).getResource("META-INF/MANIFEST.MF");
def manifestAt(location: URI): URL = ScalaClassLoader.fromURLs(List(location.toURL), null).findResource("META-INF/MANIFEST.MF");

val j = createTestJar();
Using.resources(ForDeletion(j), new ManifestResources(manifestAt(j.toUri)), new CloseableRegistry) { (_, archive, closeableRegistry) =>
Expand Down

0 comments on commit e3ebb24

Please sign in to comment.