diff options
author | Tomasz Zarna | 2013-09-18 11:39:17 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2013-10-17 04:01:08 +0000 |
commit | 29bab1d77c5c8997b40b66a16897497d077cc7f9 (patch) | |
tree | a7210e252a8aeac4f4153bcb1eca858650b8e159 /bundles/org.eclipse.equinox.p2.discovery.compatibility | |
parent | d0fea6d8c375c9a92388d4410eff486dcaf9177c (diff) | |
download | rt.equinox.p2-29bab1d77c5c8997b40b66a16897497d077cc7f9.tar.gz rt.equinox.p2-29bab1d77c5c8997b40b66a16897497d077cc7f9.tar.xz rt.equinox.p2-29bab1d77c5c8997b40b66a16897497d077cc7f9.zip |
Bug 417458: Remote bundle discovery is broken on JDK 7u40I20131023-2000I20131022-1300I20131022-0800
Change-Id: I8112dd677bb97b3ce2bdb7880054ff15815b80c0
Signed-off-by: Tomasz Zarna <tomasz.zarna@tasktop.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.discovery.compatibility')
2 files changed, 13 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java index 3af499c7e..2c02cb01e 100644 --- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java +++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Tasktop Technologies and others. + * Copyright (c) 2009, 2013 Tasktop Technologies 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 @@ -193,8 +193,7 @@ public class RemoteBundleDiscoveryStrategy extends BundleDiscoveryStrategy { String bundleUrl = entry.getLocation(); for (int attemptCount = 0; attemptCount < maxDiscoveryJarDownloadAttempts; ++attemptCount) { try { - String lastPathElement = bundleUrl.lastIndexOf('/') == -1 ? bundleUrl : bundleUrl.substring(bundleUrl.lastIndexOf('/')); - File target = File.createTempFile(lastPathElement.replaceAll("^[a-zA-Z0-9_.]", "_") + "_", ".jar", temporaryStorage); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ + File target = File.createTempFile(TransportUtil.getFileNameFor(bundleUrl) + "_", ".jar", temporaryStorage); //$NON-NLS-1$ //$NON-NLS-2$ if (monitor.isCanceled()) { break; diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java index 06968dfff..61e16563e 100644 --- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java +++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Tasktop Technologies and others. + * Copyright (c) 2009, 2013 Tasktop Technologies 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 @@ -147,4 +147,14 @@ public class TransportUtil { return countFound == locations.size(); } + public static String getFileNameFor(String bundleUrl) { + if (bundleUrl.charAt(bundleUrl.length() - 1) == '/') { + bundleUrl = bundleUrl.substring(0, bundleUrl.length() - 1); + } + if (bundleUrl.lastIndexOf('/') != -1) { + bundleUrl = bundleUrl.substring(bundleUrl.lastIndexOf('/') + 1); + } + return bundleUrl.replaceAll("[^a-zA-Z0-9_\\.]", "_"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } |