Bug 470390 - Fix paths in Ant "Additional Tasks & Support"
Change-Id: I6ada9601f3637c01b4c2e98d2ab9e799cbdc903e
Signed-off-by: Julian Enoch <julian.enoch@gmail.com>
diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/ContributedClasspathEntriesEntry.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/ContributedClasspathEntriesEntry.java
index 5d02a60..7711ee7 100644
--- a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/ContributedClasspathEntriesEntry.java
+++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/ContributedClasspathEntriesEntry.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Ericsson AB, Hamdan Msheik - Bug 389564
+ * Ericsson AB, Julian Enoch - Bug 470390
*******************************************************************************/
package org.eclipse.ant.internal.launching.launchConfigurations;
@@ -15,6 +16,7 @@
import java.io.FilenameFilter;
import java.io.IOException;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
@@ -192,14 +194,19 @@
if (urlFileName.startsWith(IAntCoreConstants.FILE_PROTOCOL)) {
try {
try {
- urlFileName = URIUtil.toURL(URIUtil.toURI(new URL(urlFileName))).getFile();
+ URI uri = URIUtil.toURI(new URL(urlFileName));
+ // fix bug 470390 using toFile() instead of toURL()
+ urlFileName = URIUtil.toFile(uri).getAbsolutePath();
}
catch (URISyntaxException e) {
AntLaunching.log(e);
}
- if (urlFileName.endsWith("!/")) { //$NON-NLS-1$
+ if (urlFileName.endsWith("!/") || urlFileName.endsWith("!\\")) { //$NON-NLS-1$ //$NON-NLS-2$
urlFileName = urlFileName.substring(0, urlFileName.length() - 2);
}
+ if (urlFileName.endsWith("!")) { //$NON-NLS-1$
+ urlFileName = urlFileName.substring(0, urlFileName.length() - 1);
+ }
}
catch (MalformedURLException e) {
AntLaunching.log(e);