Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-04-15 09:30:26 -0400
committerThomas Watson2014-04-15 16:08:08 -0400
commit973199c0700f30d2868c5213adae1d9404c206e6 (patch)
treebf874dd279ea7731995752aa4f523b250072897a
parent4fbd31ebe2f91a35564c55cb48915adec82ede5f (diff)
downloadrt.equinox.framework-973199c0700f30d2868c5213adae1d9404c206e6.tar.gz
rt.equinox.framework-973199c0700f30d2868c5213adae1d9404c206e6.tar.xz
rt.equinox.framework-973199c0700f30d2868c5213adae1d9404c206e6.zip
Bug 432632 - Values with Java Format Strings are not properly returned
from BundleContext.getProperty Change-Id: Ia9e5e8b9c047a8f03d2a6a5361f2e9f50272361e Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java9
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java17
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java2
3 files changed, 21 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
index d9e8f3a08..a27330349 100644
--- a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
+++ b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
@@ -2838,12 +2838,15 @@ public class Main {
// on J2ME this method does not exist
}
}
- if (prop != null)
+ if (prop != null) {
// found a value; use it
buf.append(prop);
- else
- // could not find a value append the var name w/o delims
+ } else {
+ // could not find a value append the var; keep delemiters
+ buf.append(VARIABLE_DELIM_CHAR);
buf.append(var == null ? "" : var); //$NON-NLS-1$
+ buf.append(VARIABLE_DELIM_CHAR);
+ }
varStarted = false;
var = null;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
index a196d2574..dc036cd20 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
@@ -843,6 +843,10 @@ public class EquinoxConfiguration implements EnvironmentInfo {
}
public String substituteVars(String path) {
+ return substituteVars(path, false);
+ }
+
+ public String substituteVars(String path, boolean preserveDelimiters) {
StringBuffer buf = new StringBuffer(path.length());
StringTokenizer st = new StringTokenizer(path, VARIABLE_DELIM_STRING, true);
boolean varStarted = false; // indicates we are processing a var subtitute
@@ -870,12 +874,19 @@ public class EquinoxConfiguration implements EnvironmentInfo {
// on J2ME this method does not exist
}
}
- if (prop != null)
+ if (prop != null) {
// found a value; use it
buf.append(prop);
- else
- // could not find a value append the var name w/o delims
+ } else {
+ // could not find a value append the var
+ if (preserveDelimiters) {
+ buf.append(VARIABLE_DELIM_CHAR);
+ }
buf.append(var == null ? "" : var); //$NON-NLS-1$
+ if (preserveDelimiters) {
+ buf.append(VARIABLE_DELIM_CHAR);
+ }
+ }
varStarted = false;
var = null;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
index d6634a749..31a4d37ed 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
@@ -151,7 +151,7 @@ public class EquinoxContainer implements ThreadFactory {
if (key instanceof String) {
String value = result.getProperty((String) key);
if (value != null)
- result.put(key, equinoxConfig.substituteVars(value));
+ result.put(key, equinoxConfig.substituteVars(value, true));
}
}
return result;

Back to the top