Bug 77761 - Request for update.configurator to use only cdcFoundation APIs
Summary: Request for update.configurator to use only cdcFoundation APIs
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Update (deprecated - use Eclipse>Equinox>p2) (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Dorian Birsan CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-03 15:44 EST by Phil Loats CLA
Modified: 2004-11-05 12:02 EST (History)
3 users (show)

See Also:


Attachments
Patch for workaround fixes for foundation (10.70 KB, patch)
2004-11-03 16:04 EST, Phil Loats CLA
no flags Details | Diff
Better patch for suggested fix (17.34 KB, patch)
2004-11-03 16:15 EST, Phil Loats CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.