Bug 77761

Summary: Request for update.configurator to use only cdcFoundation APIs
Product: [Eclipse Project] Platform Reporter: Phil Loats <loats>
Component: Update (deprecated - use Eclipse>Equinox>p2)Assignee: Dorian Birsan <birsan>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dejan, jeffmcaffer, tjwatson
Version: 3.0   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch for workaround fixes for foundation
none
Better patch for suggested fix none

Description Phil Loats CLA 2004-11-03 15:50:45 EST
This bug is a request for update.configurator to use only APIs in cdcFoundation
to enable running on embedded devices.

The file
org.eclipse.update.configurator/org/eclipse/update/internal/configurator/PlatformConfiguration.java
uses several classes/methods that are not available in cdcFoundation. We have
worked around these issues and would like to get the head eclipse code changed.

The biggest change here is to avoid using the javax.xml.transform* packages. We
created our own XMLPrintHandler to write the data without requiring these packages.
Comment 1 Phil Loats CLA 2004-11-03 16:04:57 EST
Created attachment 15639 [details]
Patch for workaround fixes for foundation

This is a patch that works around the problems for foundation. Several of the
fixes do not work well for j2se.
Comment 2 Phil Loats CLA 2004-11-03 16:15:35 EST
Created attachment 15641 [details]
Better patch for suggested fix

This patch is a better fix. I borrowed the Locker class from org.eclipse.osgi
to allow lockfile support w/o java.nio.
I created a UpdateURLDecoder to pick the correct URLDecoder.decode() method.
Comment 3 Dorian Birsan CLA 2004-11-05 12:01:01 EST
Phil,

I modified the XMLPrintHandler to account for special chars. Basically, all 
the attribute values, text and comments are encoded using this:

public static StringBuffer encode(String value) {
		StringBuffer buf = new StringBuffer();
		for (int i = 0; i < value.length(); i++) {
			char c = value.charAt(i);
			switch (c) {
				case '&' :
					buf.append("&amp;"); //$NON-NLS-1$
					break;
				case '<' :
					buf.append("&lt;"); //$NON-NLS-1$
					break;
				case '>' :
					buf.append("&gt;"); //$NON-NLS-1$
					break;
				case '\'' :
					buf.append("&apos;"); //$NON-NLS-1$
					break;
				case '\"' :
					buf.append("&quot;"); //$NON-NLS-1$
					break;
				default :
					buf.append(c);
					break;
			}
		}
		return buf;
	}

I will release the code, but I would like both of us to perform more testing, 
as this is a very sensitive area, that impacts the eclipse startup.
Comment 4 Dorian Birsan CLA 2004-11-05 12:02:48 EST
fixed using the provided patch and the encoding of attrs/text/comments as 
described above.