camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1467165 - /camel/trunk/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java
Date Fri, 12 Apr 2013 04:13:09 GMT
Author: ningjiang
Date: Fri Apr 12 04:13:09 2013
New Revision: 1467165

URL: http://svn.apache.org/r1467165
Log:
CAMEL-6262 close the input steam inside the ServiceSupport

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java?rev=1467165&r1=1467164&r2=1467165&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java Fri
Apr 12 04:13:09 2013
@@ -16,12 +16,15 @@
  */
 package org.apache.camel.support;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.camel.ServiceStatus;
 import org.apache.camel.StatefulService;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -277,17 +280,21 @@ public abstract class ServiceSupport imp
         if (version != null) {
             return version;
         }
-
+        InputStream is = null;
         // try to load from maven properties first
         try {
             Properties p = new Properties();
-            InputStream is = getClass().getResourceAsStream("/META-INF/maven/org.apache.camel/camel-core/pom.properties");
+            is = getClass().getResourceAsStream("/META-INF/maven/org.apache.camel/camel-core/pom.properties");
             if (is != null) {
                 p.load(is);
                 version = p.getProperty("version", "");
             }
         } catch (Exception e) {
             // ignore
+        } finally {
+        	if (is != null) {
+        		IOHelper.close(is, null, null);
+        	}
         }
 
         // fallback to using Java API



Mime
View raw message