karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [karaf] branch karaf-4.1.x updated: [KARAF-5440] Allow for overrides to values in system.properties.
Date Mon, 23 Oct 2017 11:51:45 GMT
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch karaf-4.1.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.1.x by this push:
     new 4c7e813  [KARAF-5440] Allow for overrides to values in system.properties.
4c7e813 is described below

commit 4c7e81304779e9b59208992f059e64655ec53ef4
Author: Tom Quarendon <tom.quarendon@worldprogramming.com>
AuthorDate: Mon Oct 23 08:44:10 2017 +0100

    [KARAF-5440] Allow for overrides to values in system.properties.
---
 .../src/main/resources/resources/etc/system.properties     |  3 +++
 .../src/main/resources/resources/etc/system.properties     |  3 +++
 .../apache/karaf/instance/resources/etc/system.properties  |  3 +++
 .../org/apache/karaf/util/config/PropertiesLoader.java     | 14 +++++++-------
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/assemblies/features/base/src/main/resources/resources/etc/system.properties b/assemblies/features/base/src/main/resources/resources/etc/system.properties
index be76d42..77c316d 100644
--- a/assemblies/features/base/src/main/resources/resources/etc/system.properties
+++ b/assemblies/features/base/src/main/resources/resources/etc/system.properties
@@ -22,6 +22,9 @@
 # properties at the very beginning of the Karaf's boot process.
 #
 
+# Properties file inclusions (as a space separated list of relative paths)
+# Included files will override the values specified in this file
+${optionals} = custom.system.properties
 
 # Log level when the pax-logging service is not available
 # This level will only be used while the pax-logging service bundle
diff --git a/assemblies/features/static/src/main/resources/resources/etc/system.properties
b/assemblies/features/static/src/main/resources/resources/etc/system.properties
index c5f8b4b..a696c0f 100644
--- a/assemblies/features/static/src/main/resources/resources/etc/system.properties
+++ b/assemblies/features/static/src/main/resources/resources/etc/system.properties
@@ -22,6 +22,9 @@
 # properties at the very beginning of the Karaf's boot process.
 #
 
+# Properties file inclusions (as a space separated list of relative paths)
+# Included files will override the values specified in this file
+${optionals} = custom.system.properties
 
 # Log level when the pax-logging service is not available
 # This level will only be used while the pax-logging service bundle
diff --git a/instance/src/main/resources/org/apache/karaf/instance/resources/etc/system.properties
b/instance/src/main/resources/org/apache/karaf/instance/resources/etc/system.properties
index 0835bbb..4301400 100644
--- a/instance/src/main/resources/org/apache/karaf/instance/resources/etc/system.properties
+++ b/instance/src/main/resources/org/apache/karaf/instance/resources/etc/system.properties
@@ -22,6 +22,9 @@
 # properties at the very beginning of the Karaf's boot process.
 #
 
+# Properties file inclusions (as a space separated list of relative paths)
+# Included files will override the values specified in this file
+${optionals} = custom.system.properties
 
 # Log level when the pax-logging service is not available
 # This level will only be used while the pax-logging service bundle
diff --git a/util/src/main/java/org/apache/karaf/util/config/PropertiesLoader.java b/util/src/main/java/org/apache/karaf/util/config/PropertiesLoader.java
index cf9a201..a24990a 100644
--- a/util/src/main/java/org/apache/karaf/util/config/PropertiesLoader.java
+++ b/util/src/main/java/org/apache/karaf/util/config/PropertiesLoader.java
@@ -101,15 +101,15 @@ public class PropertiesLoader {
      * @throws IOException if the system file can't be loaded.
      */
     public static void loadSystemProperties(File file) throws IOException {
-        Properties props = new Properties(false);
+        Properties props = null;
         try {
-            InputStream is = new FileInputStream(file);
-            props.load(is);
-            is.close();
-        } catch (Exception e1) {
-            // Ignore
+        	URL configPropURL = file.toURI().toURL();
+        	props = loadPropertiesFile(configPropURL, true);
+        } catch (Exception ex) {
+        	// Ignore
+        	return;
         }
-
+        
         for (Enumeration<?> e = props.propertyNames(); e.hasMoreElements();) {
             String name = (String) e.nextElement();
             if (name.startsWith(OVERRIDE_PREFIX)) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@karaf.apache.org" <commits@karaf.apache.org>'].

Mime
View raw message