This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
     new d67c88e6d3 GROOVY-10663: Fixed issue in 
PackageHelperImpl#getPackageNames (tweak for 2_5_X)
d67c88e6d3 is described below

commit d67c88e6d3dc76a703e6e0c17d29786555d678cd
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Jun 22 22:16:24 2022 +1000

    GROOVY-10663: Fixed issue in PackageHelperImpl#getPackageNames (tweak for 
2_5_X)
---
 .../tools/shell/util/PackageHelperImplTest.groovy  | 30 +++++++++++-----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git 
a/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/util/PackageHelperImplTest.groovy
 
b/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/util/PackageHelperImplTest.groovy
index 52fc46d202..bc288292f2 100644
--- 
a/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/util/PackageHelperImplTest.groovy
+++ 
b/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/util/PackageHelperImplTest.groovy
@@ -27,9 +27,7 @@ import java.util.jar.Manifest
 /**
  * Unit tests for the {@link PackageHelperImpl} class.
  */
-class PackageHelperImplTest
-    extends GroovyTestCase
-{
+class PackageHelperImplTest extends GroovyTestCase {
 
     void testLoadAndGetPackagesEmpty() {
         PackageHelperImpl helper = new PackageHelperImpl(null)
@@ -72,17 +70,18 @@ class PackageHelperImplTest
         Path dummyFilePath = 
folderWithSign.resolve('dummypackage1').resolve('Dummy.class')
         Files.createDirectories(dummyFilePath.getParent())
         File dummyFile = dummyFilePath.toFile()
-        try (FileOutputStream fos = new FileOutputStream(dummyFile)) {
+        dummyFile.withOutputStream { fos ->
             fos.write(0)
         }
         assert dummyFile.exists()
 
         Path jarWithSignPath = folderWithSign.resolve("dummy+lib++1%23%%.jar")
-        try (FileOutputStream fos = new 
FileOutputStream(jarWithSignPath.toFile())
-             JarOutputStream jos = new JarOutputStream(fos, new Manifest())) {
-            JarEntry jarEntry = new JarEntry("dummypackage2/Dummy.class")
-            jos.putNextEntry(jarEntry)
-            jos.write(0)
+        jarWithSignPath.toFile().withOutputStream { fos ->
+            new JarOutputStream(fos, new Manifest()).withStream { jos ->
+                JarEntry jarEntry = new JarEntry("dummypackage2/Dummy.class")
+                jos.putNextEntry(jarEntry)
+                jos.write(0)
+            }
         }
         assert jarWithSignPath.toFile().exists()
 
@@ -102,17 +101,18 @@ class PackageHelperImplTest
         Path dummyFilePath = 
folderWithSpacePath.resolve('dummypackage1').resolve('Dummy.class')
         Files.createDirectories(dummyFilePath.getParent())
         File dummyFile = dummyFilePath.toFile()
-        try (FileOutputStream fos = new FileOutputStream(dummyFile)) {
+        dummyFile.withOutputStream { fos ->
             fos.write(0)
         }
         assert dummyFile.exists()
 
         Path jarWithSpacePath = folderWithSpacePath.resolve("dummy lib 2.jar")
-        try (FileOutputStream fos = new 
FileOutputStream(jarWithSpacePath.toFile())
-             JarOutputStream jos = new JarOutputStream(fos, new Manifest())) {
-            JarEntry jarEntry = new JarEntry("dummypackage2/Dummy.class")
-            jos.putNextEntry(jarEntry)
-            jos.write(0)
+        jarWithSpacePath.toFile().withOutputStream { fos ->
+            new JarOutputStream(fos, new Manifest()).withStream { jos ->
+                JarEntry jarEntry = new JarEntry("dummypackage2/Dummy.class")
+                jos.putNextEntry(jarEntry)
+                jos.write(0)
+            }
         }
         assert jarWithSpacePath.toFile().exists()
 

Reply via email to