You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/02/05 14:46:00 UTC
karaf git commit: [KARAF-3494] Escape reference to other properties
when client tries to load etc/org.apache.karaf.shell.cfg
Repository: karaf
Updated Branches:
refs/heads/master decd74c5c -> 2579c8335
[KARAF-3494] Escape reference to other properties when client tries to load etc/org.apache.karaf.shell.cfg
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/2579c833
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/2579c833
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/2579c833
Branch: refs/heads/master
Commit: 2579c8335858171802a31657780729bdea9cbaf3
Parents: decd74c
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Thu Feb 5 14:44:25 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Thu Feb 5 14:44:25 2015 +0100
----------------------------------------------------------------------
.../java/org/apache/karaf/client/ClientConfig.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/2579c833/client/src/main/java/org/apache/karaf/client/ClientConfig.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/ClientConfig.java b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
index 444849d..a409a07 100644
--- a/client/src/main/java/org/apache/karaf/client/ClientConfig.java
+++ b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
@@ -43,7 +43,18 @@ public class ClientConfig {
Properties shellCfg = loadProps(new File(System.getProperty("karaf.etc"), "org.apache.karaf.shell.cfg"));
host = shellCfg.getProperty("sshHost", "localhost");
- port = Integer.parseInt(shellCfg.getProperty("sshPort", "8101"));
+ if (host.contains("${")) {
+ // if sshHost property contains a reference to another property (coming from etc/config.properties
+ // or etc/custom.properties), we fall back to "localhost" default value
+ host = "localhost";
+ }
+ String portString = shellCfg.getProperty("sshPort", "8101");
+ if (portString.contains("${")) {
+ // if sshPort property contains a reference to another property (coming from etc/config.properties
+ // or etc/custom.properties), we fall back to "8101" default value
+ portString = "8101";
+ }
+ port = Integer.parseInt(portString);
level = SimpleLogger.WARN;
retryAttempts = 0;
retryDelay = 2;
@@ -162,7 +173,7 @@ public class ClientConfig {
}
} catch (Exception e) {
- System.err.println("Could not load properties from: " + file + ", Reason: " + e.getMessage());
+ System.err.println("Warning: could not load properties from: " + file + ", Reason: " + e.getMessage());
} finally {
if (is != null) {
try {