You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/11/17 08:54:12 UTC

[groovy] 17/18: Improve the robustness of closing resources

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

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

commit 9f9ea84aa24e5b7381fd482a0d6855d1339c04e4
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Nov 17 15:24:03 2019 +0800

    Improve the robustness of closing resources
    
    (cherry picked from commit 148d14fb9c5642fe9a30d16630766470033d702c)
---
 src/main/java/groovy/lang/GroovyClassLoader.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/groovy/lang/GroovyClassLoader.java b/src/main/java/groovy/lang/GroovyClassLoader.java
index afc52ff..cd44d74 100644
--- a/src/main/java/groovy/lang/GroovyClassLoader.java
+++ b/src/main/java/groovy/lang/GroovyClassLoader.java
@@ -630,8 +630,11 @@ public class GroovyClassLoader extends URLClassLoader {
 
         @Override
         public void close() throws IOException {
-            super.close();
-            delegate.close();
+            try {
+                super.close();
+            } finally {
+                delegate.close();
+            }
         }
 
         public long getTimeStamp() {