Skip to content

Commit d40e1a1

Browse files
committed
Try fix Windows CI
1 parent 7e9a652 commit d40e1a1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

compiler/test/dotty/tools/io/ZipArchiveTest.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ class ZipArchiveTest {
6969
private def manifestAt(location: URI): URL = classLoader(location).getResource("META-INF/MANIFEST.MF")
7070

7171

72-
// ZipArchive.fromManifestURL(URL)
7372
@Test def `manifest resources just works`(): Unit = {
7473
val jar = createTestJar()
7574
val archive = new ManifestResources(manifestAt(jar.toUri))
@@ -79,23 +78,26 @@ class ZipArchiveTest {
7978
val f = it.next()
8079
assertFalse(it.hasNext)
8180
assertEquals("foo.class", f.name)
82-
}
83-
finally {
81+
} finally {
8482
archive.close()
8583
Files.delete(jar)
8684
}
8785
}
8886

89-
private def createTestJar(): Path = Files.createTempFile("junit", ".jar").tap { f =>
87+
private def createTestJar(): JPath = {
88+
val f = Files.createTempFile("junit", ".jar")
9089
val man = new Manifest()
9190
man.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0")
9291
man.getEntries().put("foo.class", new Attributes(0))
93-
Using.resource(new JarOutputStream(Files.newOutputStream(f), man)) { jout =>
92+
val jout = new JarOutputStream(Files.newOutputStream(f), man)
93+
try {
9494
jout.putNextEntry(new JarEntry("foo.class"))
9595
val bytes = "hello, world".getBytes
9696
jout.write(bytes, 0, bytes.length)
97-
()
97+
} finally {
98+
jout.close()
9899
}
100+
f
99101
}
100102

101103
private def createTestZip(): Path = Files.createTempFile("junit", ".zip").tap { f =>

0 commit comments

Comments
 (0)