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 93619 Details for
Bug 224125
Clean up target platform helper stripPathInformation method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch
CleanUpTargetPlatformHelper.patch (text/plain), 5.93 KB, created by
Curtis Windatt
on 2008-03-26 11:36:29 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2008-03-26 11:36:29 EDT
Size:
5.93 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui.tests >Index: src/org/eclipse/pde/ui/tests/target/AllTargetTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/AllTargetTests.java,v >retrieving revision 1.3 >diff -u -r1.3 AllTargetTests.java >--- src/org/eclipse/pde/ui/tests/target/AllTargetTests.java 4 Jan 2008 20:05:37 -0000 1.3 >+++ src/org/eclipse/pde/ui/tests/target/AllTargetTests.java 26 Mar 2008 15:31:26 -0000 >@@ -18,6 +18,7 @@ > public static Test suite() { > TestSuite suite = new TestSuite("Test Suite for testing targets"); //$NON-NLS-1$ > suite.addTest(TargetEnvironmentTestCase.suite()); >+ suite.addTest(TargetPlatformHelperTests.suite()); > return suite; > } > >Index: src/org/eclipse/pde/ui/tests/target/TargetPlatformHelperTests.java >=================================================================== >RCS file: src/org/eclipse/pde/ui/tests/target/TargetPlatformHelperTests.java >diff -N src/org/eclipse/pde/ui/tests/target/TargetPlatformHelperTests.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/ui/tests/target/TargetPlatformHelperTests.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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.pde.ui.tests.target; >+ >+import junit.framework.*; >+import org.eclipse.pde.internal.core.TargetPlatformHelper; >+ >+/** >+ * Tests TargetPlatformHelper.java convenience methods >+ * @since 3.4 >+ */ >+public class TargetPlatformHelperTests extends TestCase { >+ >+ public static Test suite() { >+ return new TestSuite(TargetPlatformHelperTests.class); >+ } >+ >+ public void testStripPathInformation(){ >+ String[] bundleStrings = new String[]{ >+ "org.eclipse.osgi", >+ "org.eclipse.osgi.jar", >+ "org.eclipse.osgi_3.4.0.v20080310.jar", >+ "file:plugins\\org.eclipse.osgi_3.4.0.v20080310.jar", >+ "file\\:plugins\\\\org.eclipse.osgi_3.4.0.v20080310.jar", >+ "reference:file:plugins\\org.eclipse.osgi_3.4.0.v20080310.jar", >+ "osgi.framework=file\\:plugins\\\\org.eclipse.osgi_3.4.0.v20080310.jar", >+ "platform:\\file\\:plugins\\\\org.eclipse.osgi_3.4.0.v20080310.jar", >+ "org.eclipse.osgi@1:start", >+ "org.eclipse.osgi.jar@1\\:start", >+ "platform\\:file\\:C\\:/Eclipse/eclipse-SDK-N20080312-2000-win32/eclipse/plugins/org.eclipse.osgi_0.1.0.N20080312-2000.jar@1\\:start", >+ "reference\\:file\\:C\\:/Eclipse/eclipse-SDK-N20080312-2000-win32/eclipse/plugins/org.eclipse.osgi_0.1.0.N20080312-2000.jar@1\\:start", >+ }; >+ >+ for (int i = 0; i < bundleStrings.length; i++) { >+ System.out.println(TargetPlatformHelper.stripPathInformation(bundleStrings[i])); >+ if (i <= 7){ >+ assertEquals("Bundle path was not stripped properly", "org.eclipse.osgi", TargetPlatformHelper.stripPathInformation(bundleStrings[i])); >+ } else { >+ assertEquals("Bundle path was not stripped properly", "org.eclipse.osgi@1:start", TargetPlatformHelper.stripPathInformation(bundleStrings[i])); >+ } >+ } >+ >+ } >+ >+ >+} >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/TargetPlatformHelper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/TargetPlatformHelper.java,v >retrieving revision 1.19 >diff -u -r1.19 TargetPlatformHelper.java >--- src/org/eclipse/pde/internal/core/TargetPlatformHelper.java 23 Mar 2008 19:34:19 -0000 1.19 >+++ src/org/eclipse/pde/internal/core/TargetPlatformHelper.java 26 Mar 2008 15:31:27 -0000 >@@ -27,9 +27,10 @@ > > public class TargetPlatformHelper { > >- public static String REFERENCE_PREFIX = "reference:"; //$NON-NLS-1$ >- public static String PLATFORM_PREFIX = "platform:"; //$NON-NLS-1$ >- public static String FILE_URL_PREFIX = "file:"; //$NON-NLS-1$ >+ public static final String REFERENCE_PREFIX = "reference:"; //$NON-NLS-1$ >+ public static final String PLATFORM_PREFIX = "platform:"; //$NON-NLS-1$ >+ public static final String FILE_URL_PREFIX = "file:"; //$NON-NLS-1$ >+ public static final String JAR_EXTENSION = ".jar"; //$NON-NLS-1$ > > private static Map fCachedLocations; > >@@ -82,7 +83,7 @@ > } > > /** >- * Removed path information from the given string containing one or more comma separated >+ * Removes path information from the given string containing one or more comma separated > * osgi bundles. Replaces escaped '\:' with ':'. Removes, reference, platform and file > * prefixes. Removes any other path information converting the location or the last > * segment to a bundle id. >@@ -112,10 +113,21 @@ > // if the path is relative, the last segment is the bundle symbolic name > // Otherwise, we need to retrieve the bundle symbolic name ourselves > IPath path = new Path(bundle); >- String id = path.isAbsolute() ? getSymbolicName(bundle) : path.lastSegment(); >- int underscoreIndex = id.indexOf('_'); >- if (underscoreIndex >= 0) { >- id = id.substring(0, underscoreIndex); >+ String id = null; >+ if (path.isAbsolute()) { >+ id = getSymbolicName(bundle); >+ } >+ if (id == null) { >+ id = path.lastSegment(); >+ } >+ if (id != null) { >+ int underscoreIndex = id.indexOf('_'); >+ if (underscoreIndex >= 0) { >+ id = id.substring(0, underscoreIndex); >+ } >+ if (id.endsWith(JAR_EXTENSION)) { >+ id = id.substring(0, id.length() - 4); >+ } > } > if (result.length() > 0) > result.append(","); //$NON-NLS-1$
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 224125
: 93619 |
94154