summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Austin2012-04-24 10:39:34 (EDT)
committer Thomas Watson2012-04-24 10:39:34 (EDT)
commitf3110a4c2281782a42a9da31a51185de3d760b76 (patch)
tree325d0be5098d0badd9d5e0b3affd019b632e5fe9
parent52a7f6d48eacc72506ba42a6216246d2b4e441e8 (diff)
downloadrt.equinox.bundles-f3110a4c2281782a42a9da31a51185de3d760b76.zip
rt.equinox.bundles-f3110a4c2281782a42a9da31a51185de3d760b76.tar.gz
rt.equinox.bundles-f3110a4c2281782a42a9da31a51185de3d760b76.tar.bz2
Bug 356950 - Allow eclipse config style variables in thev20120424-1439
-eclipse.keyring command line argument
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java
index 7057610..5fce190 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,6 +38,8 @@ public class SecurePreferencesMapper {
static private Map preferences = new HashMap(); // URL.toString() -> SecurePreferencesRoot
+ final public static String USER_HOME = "user.home"; //$NON-NLS-1$
+
static public ISecurePreferences getDefault() {
if (defaultPreferences == null) {
try {
@@ -72,7 +74,7 @@ public class SecurePreferencesMapper {
if (args[i + 1].startsWith(("-"))) //$NON-NLS-1$
continue;
if (location == null && KEYRING_ARGUMENT.equalsIgnoreCase(args[i])) {
- location = new File(args[i + 1]).toURL(); // don't use File.toURI().toURL()
+ location = getKeyringFile(args[i + 1]).toURL(); // don't use File.toURI().toURL()
continue;
}
if (PASSWORD_ARGUMENT.equalsIgnoreCase(args[i])) {
@@ -145,6 +147,14 @@ public class SecurePreferencesMapper {
}
}
+ // Replace any @user.home variables found in eclipse.keyring path arg
+ static private File getKeyringFile(String path) {
+ if (path.startsWith('@' + USER_HOME))
+ return new File(System.getProperty(USER_HOME), path.substring(USER_HOME.length() + 1));
+
+ return new File(path);
+ }
+
static private Map processPassword(Map options, String arg) {
if (arg == null || arg.length() == 0)
return options;