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 156032 Details for
Bug 299533
[publisher] Category not exported from update wizard with IBM 1.6 VM
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]
patch
299533.txt (text/plain), 6.62 KB, created by
Andrew Niefer
on 2010-01-13 14:26:23 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Andrew Niefer
Created:
2010-01-13 14:26:23 EST
Size:
6.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.metadata.generator >Index: src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteFeature.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteFeature.java,v >retrieving revision 1.2 >diff -u -r1.2 SiteFeature.java >--- src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteFeature.java 28 Nov 2007 20:31:00 -0000 1.2 >+++ src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteFeature.java 13 Jan 2010 19:25:01 -0000 >@@ -46,30 +46,42 @@ > * Return false if one of them is null > */ > public static boolean sameURL(URL url1, URL url2) { >- >- if (url1 == null || url2 == null) >- return false; > if (url1 == url2) > return true; >- if (url1.equals(url2)) >- return true; >+ if (url1 == null ^ url2 == null) >+ return false; > > // check if URL are file: URL as we may > // have 2 URL pointing to the same featureReference > // but with different representation > // (i.e. file:/C;/ and file:C:/) >- if (!"file".equalsIgnoreCase(url1.getProtocol())) //$NON-NLS-1$ >- return false; >- if (!"file".equalsIgnoreCase(url2.getProtocol())) //$NON-NLS-1$ >- return false; >- >- File file1 = new File(url1.getFile()); >- File file2 = new File(url2.getFile()); >- >- if (file1 == null) >+ final boolean isFile1 = "file".equalsIgnoreCase(url1.getProtocol());//$NON-NLS-1$ >+ final boolean isFile2 = "file".equalsIgnoreCase(url2.getProtocol());//$NON-NLS-1$ >+ if (isFile1 && isFile2) { >+ File file1 = new File(url1.getFile()); >+ File file2 = new File(url2.getFile()); >+ return file1.equals(file2); >+ } >+ // URL1 xor URL2 is a file, return false. (They either both need to be files, or neither) >+ if (isFile1 ^ isFile2) > return false; >+ return getExternalForm(url1).equals(getExternalForm(url2)); >+ } > >- return (file1.equals(file2)); >+ /** >+ * Gets the external form of this URL. In particular, it trims any white space, >+ * removes a trailing slash and creates a lower case string. >+ */ >+ private static String getExternalForm(URL url) { >+ String externalForm = url.toExternalForm(); >+ if (externalForm == null) >+ return ""; //$NON-NLS-1$ >+ externalForm = externalForm.trim(); >+ if (externalForm.endsWith("/")) { //$NON-NLS-1$ >+ // Remove the trailing slash >+ externalForm = externalForm.substring(0, externalForm.length() - 1); >+ } >+ return externalForm.toLowerCase(); > } > > /** >@@ -114,18 +126,49 @@ > * <code>false</code> otherwise > */ > public boolean equals(Object object) { >- > if (object == null) > return false; >- if (getURL() == null) >- return false; >- > if (!(object instanceof SiteFeature)) > return false; >+ SiteFeature that = (SiteFeature) object; >+ if (this.featureId == null) { >+ if (that.featureId != null) >+ return false; >+ } else if (!this.featureId.equals(that.featureId)) >+ return false; >+ if (this.featureVersion == null) { >+ if (that.featureVersion != null) >+ return false; >+ } else if (!this.featureVersion.equals(that.featureVersion)) >+ return false; >+ if (this.label == null) { >+ if (that.label != null) >+ return false; >+ } else if (!this.label.equals(that.label)) >+ return false; >+ return sameURL(this.getURL(), that.getURL()); >+ } > >- SiteFeature f = (SiteFeature) object; >- >- return sameURL(getURL(), f.getURL()); >+ /* (non-Javadoc) >+ * @see java.lang.Object#hashCode() >+ */ >+ public int hashCode() { >+ final int prime = 31; >+ int result = 1; >+ result = prime * result + (featureId == null ? 0 : featureId.hashCode()); >+ result = prime * result + (featureVersion == null ? 0 : featureVersion.hashCode()); >+ if (this.getURL() == null) >+ return result; >+ >+ if ("file".equalsIgnoreCase(getURL().getProtocol())) {//$NON-NLS-1$ >+ // If the URL is a file, then create the HashCode from the file >+ File f = new File(getURL().getFile()); >+ if (f != null) >+ result = prime * result + f.hashCode(); >+ } else >+ // Otherwise create it from the External form of the URL (in lower case) >+ result = prime * result + getExternalForm(this.getURL()).hashCode(); >+ return result; > } > > /** >#P org.eclipse.equinox.p2.tests >Index: src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java,v >retrieving revision 1.10.2.2 >diff -u -r1.10.2.2 UpdateSiteTest.java >--- src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java 12 Aug 2008 17:13:43 -0000 1.10.2.2 >+++ src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java 13 Jan 2010 19:25:02 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.p2.metadata.generator.features.SiteFeature; > import org.eclipse.equinox.internal.p2.updatesite.UpdateSite; > import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository; > import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager; >@@ -481,6 +482,37 @@ > } > } > >+ public void testSiteFeatureFileURL() { >+ SiteFeature a = new SiteFeature(); >+ SiteFeature b = new SiteFeature(); >+ assertEquals("1.0", a, b); >+ a.setURLString("file:/c:/foo"); >+ b.setURLString("file:/c:/FOO"); >+ if (a.equals(b)) >+ assertEquals("1.1", a.hashCode(), b.hashCode()); >+ a.setURLString("FILE:/c:/foo"); >+ b.setURLString("file:/c:/FOO"); >+ if (a.equals(b)) >+ assertEquals("1.2", a.hashCode(), b.hashCode()); >+ a.setURLString("HTTP://example.com"); >+ b.setURLString("HTtP://example.com"); >+ if (a.equals(b)) >+ assertEquals("1.3", a.hashCode(), b.hashCode()); >+ a.setURLString("HTTP://eXaMpLe.com"); >+ b.setURLString("HTtP://example.com"); >+ if (a.equals(b)) >+ assertEquals("1.4", a.hashCode(), b.hashCode()); >+ a.setURLString("HTTP://eXaMpLe.com/"); >+ b.setURLString("HTtP://example.com"); >+ assertEquals(a, b); >+ if (a.equals(b)) >+ assertEquals("1.5", a.hashCode(), b.hashCode()); >+ a.setURLString("http://localhost"); >+ b.setURLString("http://127.0.0.1"); >+ if (a.equals(b)) >+ assertEquals("1.6", a.hashCode(), b.hashCode()); >+ } >+ > public void testMirrors() { > // TODO test the case where the site.xml points to a mirror location > }
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 299533
: 156032 |
156038