View | Details | Raw Unified | Return to bug 138942
Collapse All | Expand All

(-)src/org/eclipse/update/internal/ui/UpdateUI.java (-4 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.update.internal.ui;
11
package org.eclipse.update.internal.ui;
12
12
13
import java.io.*;
13
import java.io.UnsupportedEncodingException;
14
import java.lang.reflect.*;
14
import java.lang.reflect.*;
15
import java.net.*;
15
import java.net.*;
16
import java.net.URLEncoder;
17
import java.util.Vector;
16
import java.util.Vector;
18
17
19
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
Lines 334-340 Link Here
334
					+ WEB_APP_ID
333
					+ WEB_APP_ID
335
					+ "/install"; //$NON-NLS-1$
334
					+ "/install"; //$NON-NLS-1$
336
			try {
335
			try {
337
				value = URLEncoder.encode(value, "UTF-8"); //$NON-NLS-1$
336
				value = URLCoder.encode(value);
338
			} catch (UnsupportedEncodingException e) {
337
			} catch (UnsupportedEncodingException e) {
339
			}
338
			}
340
			return value;
339
			return value;
(-)META-INF/MANIFEST.MF (+6 lines)
Lines 21-23 Link Here
21
 org.eclipse.update.configurator;bundle-version="[3.1.0,4.0.0)",
21
 org.eclipse.update.configurator;bundle-version="[3.1.0,4.0.0)",
22
 org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)"
22
 org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)"
23
Eclipse-AutoStart: true
23
Eclipse-AutoStart: true
24
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
25
 CDC-1.0/Foundation-1.0,
26
 J2SE-1.3
27
Import-Package: javax.xml.parsers,
28
 org.w3c.dom,
29
 org.xml.sax
(-).classpath (-1 / +1 lines)
Lines 1-7 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6
	<classpathentry kind="output" path="bin"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
7
</classpath>
(-)src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java (-5 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 23-37 Link Here
23
	 */
23
	 */
24
	protected PasswordAuthentication getPasswordAuthentication() {
24
	protected PasswordAuthentication getPasswordAuthentication() {
25
		// String protocol = getRequestingProtocol();
25
		// String protocol = getRequestingProtocol();
26
		String host = getRequestingHost(); // can be null;
27
		InetAddress address = getRequestingSite(); // can be null;
26
		InetAddress address = getRequestingSite(); // can be null;
28
		// int port = getRequestingPort();
27
		// int port = getRequestingPort();
29
		String prompt = getRequestingPrompt(); // realm or message, not documented that can be null
28
		String prompt = getRequestingPrompt(); // realm or message, not documented that can be null
30
		// String scheme = getRequestingScheme(); // not documented that can be null
29
		// String scheme = getRequestingScheme(); // not documented that can be null
31
30
32
		String hostString = host;
31
		 // get the host name from the address since #getRequestingHost
33
		if (hostString == null && address != null) {
32
		 // is not available in the foundation 1.0 class libraries
34
			address.getHostName();
33
		String hostString = null;
34
		if (address != null) {
35
			hostString = address.getHostName();
35
		}
36
		}
36
		if (hostString == null) {
37
		if (hostString == null) {
37
			hostString = ""; //$NON-NLS-1$
38
			hostString = ""; //$NON-NLS-1$
(-)src/org/eclipse/update/internal/ui/wizards/NewUpdateSiteDialog.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 12-18 Link Here
12
12
13
import java.net.MalformedURLException;
13
import java.net.MalformedURLException;
14
import java.net.URL;
14
import java.net.URL;
15
import java.net.URLDecoder;
16
15
17
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.Status;
17
import org.eclipse.core.runtime.Status;
Lines 31-36 Link Here
31
import org.eclipse.swt.widgets.Label;
30
import org.eclipse.swt.widgets.Label;
32
import org.eclipse.swt.widgets.Shell;
31
import org.eclipse.swt.widgets.Shell;
33
import org.eclipse.swt.widgets.Text;
32
import org.eclipse.swt.widgets.Text;
33
import org.eclipse.update.internal.ui.URLCoder;
34
import org.eclipse.update.internal.ui.UpdateUI;
34
import org.eclipse.update.internal.ui.UpdateUI;
35
import org.eclipse.update.internal.ui.UpdateUIMessages;
35
import org.eclipse.update.internal.ui.UpdateUIMessages;
36
import org.eclipse.update.internal.ui.model.SiteBookmark;
36
import org.eclipse.update.internal.ui.model.SiteBookmark;
Lines 155-161 Link Here
155
		}
155
		}
156
	
156
	
157
		try {
157
		try {
158
			URL newURL = new URL(URLDecoder.decode(url.getText().trim(), "UTF-8")); //$NON-NLS-1$
158
			URL newURL = new URL(URLCoder.decode(url.getText().trim()));
159
			if (url.getEditable()) {
159
			if (url.getEditable()) {
160
				okButton.setEnabled(!newURL.getProtocol().equals("file")); //$NON-NLS-1$
160
				okButton.setEnabled(!newURL.getProtocol().equals("file")); //$NON-NLS-1$
161
				if (newURL.getProtocol().equals("file")) { //$NON-NLS-1$
161
				if (newURL.getProtocol().equals("file")) { //$NON-NLS-1$
(-)src/org/eclipse/update/internal/ui/properties/FeatureGeneralPropertyPage.java (-2 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 160-165 Link Here
160
	}
160
	}
161
	
161
	
162
	private String getEscapedString(String value) {
162
	private String getEscapedString(String value) {
163
		return value.replaceAll("&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
163
		StringBuffer result = new StringBuffer(value.length() + 10);
164
		for (int i = 0; i < value.length(); ++i) {
165
			char c = value.charAt(i);
166
			if ('&' == c) {
167
				result.append("&&");
168
			} else {
169
				result.append(c);
170
			}
171
		}
172
		return result.toString();
164
	}
173
	}
165
}
174
}
(-).settings/org.eclipse.jdt.core.prefs (+7 lines)
Added Link Here
1
#Tue May 02 11:46:27 EDT 2006
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
4
org.eclipse.jdt.core.compiler.compliance=1.4
5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
6
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
7
org.eclipse.jdt.core.compiler.source=1.3
(-)src/org/eclipse/update/internal/ui/URLCoder.java (+59 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.update.internal.ui;
12
13
import java.io.ByteArrayOutputStream;
14
import java.io.UnsupportedEncodingException;
15
16
public class URLCoder {
17
18
	public static String encode(String s) throws UnsupportedEncodingException {
19
		return urlEncode(s.getBytes("UTF8")); //$NON-NLS-1$
20
	}
21
22
	public static String decode(String s) throws UnsupportedEncodingException {
23
		return new String(urlDecode(s), "UTF8"); //$NON-NLS-1$
24
	}
25
26
	private static String urlEncode(byte[] data) {
27
		StringBuffer buf = new StringBuffer(data.length);
28
		for (int i = 0; i < data.length; i++) {
29
			buf.append('%');
30
			buf.append(Character.forDigit((data[i] & 240) >>> 4, 16));
31
			buf.append(Character.forDigit(data[i] & 15, 16));
32
		}
33
		return buf.toString();
34
	}
35
36
	private static byte[] urlDecode(String encodedURL) {
37
		int len = encodedURL.length();
38
		ByteArrayOutputStream os = new ByteArrayOutputStream(len);
39
		for (int i = 0; i < len;) {
40
			switch (encodedURL.charAt(i)) {
41
			case '%':
42
				if (len >= i + 3) {
43
					os.write(Integer.parseInt(encodedURL.substring(i + 1, i + 3), 16));
44
				}
45
				i += 3;
46
				break;
47
			case '+': // exception from standard
48
				os.write(' ');
49
				i++;
50
				break;
51
			default:
52
				os.write(encodedURL.charAt(i++));
53
				break;
54
			}
55
56
		}
57
		return os.toByteArray();
58
	}
59
}

Return to bug 138942