Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 96057 Details for
Bug 214796
[Proxy] org.eclipse.core.net bundle should not require org.eclipse.core.runtime
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Sample approach fix slightly modified
214796_20080415.txt (text/plain), 6.67 KB, created by
Szymon Brandys
on 2008-04-15 07:24:55 EDT
(
hide
)
Description:
Sample approach fix slightly modified
Filename:
MIME Type:
Creator:
Szymon Brandys
Created:
2008-04-15 07:24:55 EDT
Size:
6.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.net >Index: src/org/eclipse/core/internal/net/ProxyType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java,v >retrieving revision 1.10 >diff -u -r1.10 ProxyType.java >--- src/org/eclipse/core/internal/net/ProxyType.java 19 Feb 2008 21:06:25 -0000 1.10 >+++ src/org/eclipse/core/internal/net/ProxyType.java 15 Apr 2008 11:24:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >+ * Copyright (c) 2007, 2008 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 >@@ -10,14 +10,19 @@ > *******************************************************************************/ > package org.eclipse.core.internal.net; > >-import java.net.MalformedURLException; >-import java.net.URL; >-import java.util.*; >+import java.io.IOException; >+import java.util.Properties; > > import org.eclipse.core.net.proxy.IProxyData; >-import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; >-import org.eclipse.core.runtime.preferences.IEclipsePreferences.*; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; >+import org.eclipse.equinox.security.storage.ISecurePreferences; >+import org.eclipse.equinox.security.storage.SecurePreferencesFactory; >+import org.eclipse.equinox.security.storage.StorageException; > import org.eclipse.osgi.util.NLS; > import org.osgi.service.prefs.BackingStoreException; > import org.osgi.service.prefs.Preferences; >@@ -48,20 +53,16 @@ > public static final int NEVER_SET = 2; > public static int socksSystemPropertySetting; > >+ /** >+ * Absolute path to the node for the cached proxy information >+ */ >+ private static final String PREFERENCES_CONTEXT = "/org.eclipse.core.net.proxy.auth"; //$NON-NLS-1$ > /* > * Fields used to cache authentication information in the keyring > */ > private static final String INFO_PROXY_USER = "user"; //$NON-NLS-1$ > private static final String INFO_PROXY_PASS = "pass"; //$NON-NLS-1$ >- private static final URL FAKE_URL; > static { >- URL temp = null; >- try { >- temp = new URL("http://org.eclipse.core.net.proxy.auth");//$NON-NLS-1$ >- } catch (MalformedURLException e) { >- // Should never fail >- } >- FAKE_URL = temp; > String value = System.getProperty(PROP_SOCKS_SYSTEM_PROPERTY_HANDLING); > if (value == null) { > socksSystemPropertySetting = ONLY_SET_FOR_1_5_OR_LATER; >@@ -476,46 +477,56 @@ > ((IEclipsePreferences)getPreferenceNode()).addPreferenceChangeListener(this); > } > >- private Map getAuthInfo() { >- // Retrieve username and password from keyring. >- Map authInfo = Platform.getAuthorizationInfo(FAKE_URL, getName(), ""); //$NON-NLS-1$ >- return authInfo != null ? authInfo : Collections.EMPTY_MAP; >+ private ISecurePreferences getNode() { >+ ISecurePreferences root = SecurePreferencesFactory.getDefault(); >+ if (root == null) >+ return null; >+ ISecurePreferences node = root.node(PREFERENCES_CONTEXT); >+ if (getName() != null) >+ return node.node(getName()); >+ return node; > } > > private void loadProxyAuth(IProxyData data) { >- Map authInfo = getAuthInfo(); >- data.setUserid((String)authInfo.get(INFO_PROXY_USER)); >- data.setPassword((String)authInfo.get(INFO_PROXY_PASS)); >+ ISecurePreferences node = getNode(); >+ if (node == null) >+ return; >+ try { >+ data.setUserid(node.get(INFO_PROXY_USER, null)); >+ data.setPassword(node.get(INFO_PROXY_PASS, null)); >+ } catch (StorageException e) { >+ Activator.logError(e.getMessage(), e); >+ } > } >- >+ > private void saveProxyAuth(IProxyData data) { >- Map authInfo = getAuthInfo(); >- if (authInfo.size() == 0) { >- authInfo = new java.util.HashMap(4); >- } >- String proxyUser = data.getUserId(); >- if (proxyUser != null && data.getHost() != null) { >- authInfo.put(INFO_PROXY_USER, proxyUser); >- } else { >- authInfo.remove(INFO_PROXY_USER); >- } >- String proxyPass = data.getPassword(); >- if (proxyPass != null && data.getHost() != null) { >- authInfo.put(INFO_PROXY_PASS, proxyPass); >- } else { >- authInfo.remove(INFO_PROXY_PASS); >+ ISecurePreferences node= getNode(); >+ if (node == null) >+ return; >+ try { >+ if (data.getUserId() != null) >+ node.put(INFO_PROXY_USER, data.getUserId(), true /* store encrypted */); >+ else >+ node.remove(INFO_PROXY_USER); >+ >+ if (data.getPassword() != null) >+ node.put(INFO_PROXY_PASS, data.getPassword(), true /* store encrypted */); >+ else >+ node.remove(INFO_PROXY_PASS); >+ } catch (StorageException e) { >+ Activator.logError(e.getMessage(), e); >+ return; > } >+ >+ // optional: save it right away in case something crashes later > try { >- if (authInfo.isEmpty()) { >- Platform.flushAuthorizationInfo(FAKE_URL, getName(), ""); //$NON-NLS-1$ >- } else { >- Platform.addAuthorizationInfo(FAKE_URL, getName(), "", authInfo); //$NON-NLS-1$ >- } >- } catch (CoreException e) { >+ node.flush(); >+ } catch (IOException e) { > Activator.logError(e.getMessage(), e); >+ return; > } > } >- >+ > private synchronized boolean hasJavaNetProxyClass() { > try { > Class proxyClass = Class.forName("java.net.Proxy"); //$NON-NLS-1$ >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/META-INF/MANIFEST.MF,v >retrieving revision 1.7 >diff -u -r1.7 MANIFEST.MF >--- META-INF/MANIFEST.MF 10 Apr 2008 10:18:22 -0000 1.7 >+++ META-INF/MANIFEST.MF 15 Apr 2008 11:24:07 -0000 >@@ -6,7 +6,8 @@ > Bundle-Activator: org.eclipse.core.internal.net.Activator > Bundle-Vendor: %PLUGIN_PROVIDER > Bundle-Localization: plugin >-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)" >+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)", >+ org.eclipse.equinox.security;bundle-version="[1.0.0,2.0.0)" > Bundle-ActivationPolicy: lazy > Export-Package: org.eclipse.core.internal.net;x-internal:=true, > org.eclipse.core.net.proxy
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 214796
:
86498
|
93623
|
93624
|
94562
| 96057 |
96079
|
96575