You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2011/09/02 11:46:18 UTC
svn commit: r1164447 - in /camel/branches/camel-2.8.x: ./
camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
Author: davsclaus
Date: Fri Sep 2 09:46:18 2011
New Revision: 1164447
URL: http://svn.apache.org/viewvc?rev=1164447&view=rev
Log:
Merged revisions 1151000 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
Modified:
camel/branches/camel-2.8.x/ (props changed)
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 2 09:46:18 2011
@@ -1 +1 @@
-/camel/trunk:1150651,1151054,1152170,1152755,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395
+/camel/trunk:1150651,1151000,1151054,1152170,1152755,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java?rev=1164447&r1=1164446&r2=1164447&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java Fri Sep 2 09:46:18 2011
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.Properties;
import org.apache.camel.CamelContext;
+import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
/**
@@ -61,25 +62,42 @@ public class DefaultPropertiesResolver i
}
protected Properties loadPropertiesFromFilePath(CamelContext context, String path) throws IOException {
+ Properties answer = null;
+
if (path.startsWith("file:")) {
path = ObjectHelper.after(path, "file:");
}
+
InputStream is = new FileInputStream(path);
- Properties answer = new Properties();
- answer.load(is);
+ try {
+ answer = new Properties();
+ answer.load(is);
+ } finally {
+ IOHelper.close(is);
+ }
+
return answer;
}
protected Properties loadPropertiesFromClasspath(CamelContext context, String path) throws IOException {
+ Properties answer = null;
+
if (path.startsWith("classpath:")) {
path = ObjectHelper.after(path, "classpath:");
}
+
InputStream is = context.getClassResolver().loadResourceAsStream(path);
if (is == null) {
throw new FileNotFoundException("Properties file " + path + " not found in classpath");
}
- Properties answer = new Properties();
- answer.load(is);
+
+ try {
+ answer = new Properties();
+ answer.load(is);
+ } finally {
+ IOHelper.close(is);
+ }
+
return answer;
}