cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject git commit: Close the classloader if it's a closeable (java7+)
Date Wed, 22 Oct 2014 15:01:07 GMT
Repository: cxf-xjc-utils
Updated Branches:
  refs/heads/master 95eb1fd5c -> f942adb8d


Close the classloader if it's a closeable (java7+)


Project: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/commit/f942adb8
Tree: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/tree/f942adb8
Diff: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/diff/f942adb8

Branch: refs/heads/master
Commit: f942adb8dabd3f5cc05872afea1b8fe06589a471
Parents: 95eb1fd
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Oct 22 11:00:48 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Oct 22 11:00:48 2014 -0400

----------------------------------------------------------------------
 .../org/apache/cxf/maven_plugin/XSDToJavaRunner.java   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/blob/f942adb8/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
----------------------------------------------------------------------
diff --git a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
index ef4e2a1..3130428 100644
--- a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
+++ b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.maven_plugin;
 
+import java.io.Closeable;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -134,11 +135,17 @@ public class XSDToJavaRunner {
         Model model = loadModel(opt); 
         if (model == null) {
             listener.message(xsdFile, "Failed to create model");
+            if (loader instanceof Closeable) {
+                ((Closeable)loader).close();
+            }
             return -1;
         }
         Outline outline = model.generateCode(opt, listener);
         if (outline == null) {
             listener.message(xsdFile, "Failed to generate code");
+            if (loader instanceof Closeable) {
+                ((Closeable)loader).close();
+            }
             return -1;
         }
 
@@ -148,8 +155,14 @@ public class XSDToJavaRunner {
             model.codeModel.build(cw);
         } catch (IOException e) {
             listener.error(e);
+            if (loader instanceof Closeable) {
+                ((Closeable)loader).close();
+            }
             return -1;
         }
+        if (loader instanceof Closeable) {
+            ((Closeable)loader).close();
+        }
         return 0;        
     }
     


Mime
View raw message