### Eclipse Workspace Patch 1.0 #P org.eclipse.update.ui Index: src/org/eclipse/update/internal/ui/UpdateUI.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/UpdateUI.java,v retrieving revision 1.44 diff -u -r1.44 UpdateUI.java --- src/org/eclipse/update/internal/ui/UpdateUI.java 11 Apr 2006 15:47:38 -0000 1.44 +++ src/org/eclipse/update/internal/ui/UpdateUI.java 2 May 2006 15:49:05 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2006 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,10 +10,9 @@ *******************************************************************************/ package org.eclipse.update.internal.ui; -import java.io.*; +import java.io.UnsupportedEncodingException; import java.lang.reflect.*; import java.net.*; -import java.net.URLEncoder; import java.util.Vector; import org.eclipse.core.runtime.*; @@ -334,7 +333,7 @@ + WEB_APP_ID + "/install"; //$NON-NLS-1$ try { - value = URLEncoder.encode(value, "UTF-8"); //$NON-NLS-1$ + value = URLCoder.encode(value); } catch (UnsupportedEncodingException e) { } return value; Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.update.ui/META-INF/MANIFEST.MF,v retrieving revision 1.6 diff -u -r1.6 MANIFEST.MF --- META-INF/MANIFEST.MF 17 Apr 2006 20:35:56 -0000 1.6 +++ META-INF/MANIFEST.MF 2 May 2006 15:49:05 -0000 @@ -21,3 +21,9 @@ org.eclipse.update.configurator;bundle-version="[3.1.0,4.0.0)", org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)" Eclipse-AutoStart: true +Bundle-RequiredExecutionEnvironment: J2SE-1.4, + CDC-1.0/Foundation-1.0, + J2SE-1.3 +Import-Package: javax.xml.parsers, + org.w3c.dom, + org.xml.sax Index: .classpath =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.update.ui/.classpath,v retrieving revision 1.28 diff -u -r1.28 .classpath --- .classpath 27 Nov 2003 01:58:16 -0000 1.28 +++ .classpath 2 May 2006 15:49:05 -0000 @@ -1,7 +1,7 @@ + - Index: src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java,v retrieving revision 1.17 diff -u -r1.17 UpdateManagerAuthenticator.java --- src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java 28 Apr 2005 18:22:31 -0000 1.17 +++ src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java 2 May 2006 15:49:05 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2006 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 @@ -23,15 +23,16 @@ */ protected PasswordAuthentication getPasswordAuthentication() { // String protocol = getRequestingProtocol(); - String host = getRequestingHost(); // can be null; InetAddress address = getRequestingSite(); // can be null; // int port = getRequestingPort(); String prompt = getRequestingPrompt(); // realm or message, not documented that can be null // String scheme = getRequestingScheme(); // not documented that can be null - String hostString = host; - if (hostString == null && address != null) { - address.getHostName(); + // get the host name from the address since #getRequestingHost + // is not available in the foundation 1.0 class libraries + String hostString = null; + if (address != null) { + hostString = address.getHostName(); } if (hostString == null) { hostString = ""; //$NON-NLS-1$ Index: src/org/eclipse/update/internal/ui/wizards/NewUpdateSiteDialog.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/NewUpdateSiteDialog.java,v retrieving revision 1.13 diff -u -r1.13 NewUpdateSiteDialog.java --- src/org/eclipse/update/internal/ui/wizards/NewUpdateSiteDialog.java 22 Apr 2005 19:02:46 -0000 1.13 +++ src/org/eclipse/update/internal/ui/wizards/NewUpdateSiteDialog.java 2 May 2006 15:49:05 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2006 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 @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; -import java.net.URLDecoder; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -31,6 +30,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import org.eclipse.update.internal.ui.URLCoder; import org.eclipse.update.internal.ui.UpdateUI; import org.eclipse.update.internal.ui.UpdateUIMessages; import org.eclipse.update.internal.ui.model.SiteBookmark; @@ -155,7 +155,7 @@ } try { - URL newURL = new URL(URLDecoder.decode(url.getText().trim(), "UTF-8")); //$NON-NLS-1$ + URL newURL = new URL(URLCoder.decode(url.getText().trim())); if (url.getEditable()) { okButton.setEnabled(!newURL.getProtocol().equals("file")); //$NON-NLS-1$ if (newURL.getProtocol().equals("file")) { //$NON-NLS-1$ Index: src/org/eclipse/update/internal/ui/properties/FeatureGeneralPropertyPage.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/properties/FeatureGeneralPropertyPage.java,v retrieving revision 1.9 diff -u -r1.9 FeatureGeneralPropertyPage.java --- src/org/eclipse/update/internal/ui/properties/FeatureGeneralPropertyPage.java 14 Jun 2005 19:17:46 -0000 1.9 +++ src/org/eclipse/update/internal/ui/properties/FeatureGeneralPropertyPage.java 2 May 2006 15:49:05 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2006 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 @@ -160,6 +160,15 @@ } private String getEscapedString(String value) { - return value.replaceAll("&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$ + StringBuffer result = new StringBuffer(value.length() + 10); + for (int i = 0; i < value.length(); ++i) { + char c = value.charAt(i); + if ('&' == c) { + result.append("&&"); + } else { + result.append(c); + } + } + return result.toString(); } } Index: .settings/org.eclipse.jdt.core.prefs =================================================================== RCS file: .settings/org.eclipse.jdt.core.prefs diff -N .settings/org.eclipse.jdt.core.prefs --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .settings/org.eclipse.jdt.core.prefs 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,7 @@ +#Tue May 02 11:46:27 EDT 2006 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 Index: src/org/eclipse/update/internal/ui/URLCoder.java =================================================================== RCS file: src/org/eclipse/update/internal/ui/URLCoder.java diff -N src/org/eclipse/update/internal/ui/URLCoder.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/update/internal/ui/URLCoder.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2006 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.update.internal.ui; + +import java.io.ByteArrayOutputStream; +import java.io.UnsupportedEncodingException; + +public class URLCoder { + + public static String encode(String s) throws UnsupportedEncodingException { + return urlEncode(s.getBytes("UTF8")); //$NON-NLS-1$ + } + + public static String decode(String s) throws UnsupportedEncodingException { + return new String(urlDecode(s), "UTF8"); //$NON-NLS-1$ + } + + private static String urlEncode(byte[] data) { + StringBuffer buf = new StringBuffer(data.length); + for (int i = 0; i < data.length; i++) { + buf.append('%'); + buf.append(Character.forDigit((data[i] & 240) >>> 4, 16)); + buf.append(Character.forDigit(data[i] & 15, 16)); + } + return buf.toString(); + } + + private static byte[] urlDecode(String encodedURL) { + int len = encodedURL.length(); + ByteArrayOutputStream os = new ByteArrayOutputStream(len); + for (int i = 0; i < len;) { + switch (encodedURL.charAt(i)) { + case '%': + if (len >= i + 3) { + os.write(Integer.parseInt(encodedURL.substring(i + 1, i + 3), 16)); + } + i += 3; + break; + case '+': // exception from standard + os.write(' '); + i++; + break; + default: + os.write(encodedURL.charAt(i++)); + break; + } + + } + return os.toByteArray(); + } +}