summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2013-04-12 16:32:07 (EDT)
committerIan Bull2013-04-12 16:32:07 (EDT)
commita6167da69e88b22dc13248c6a6d4efd8ee7371eb (patch)
tree5b7c875776cb751c8a2c4907f9848bf1adb6aed2
parent1a33ad63b2700f40043128a0e9fdaa69005bf249 (diff)
downloadrt.equinox.p2-a6167da69e88b22dc13248c6a6d4efd8ee7371eb.zip
rt.equinox.p2-a6167da69e88b22dc13248c6a6d4efd8ee7371eb.tar.gz
rt.equinox.p2-a6167da69e88b22dc13248c6a6d4efd8ee7371eb.tar.bz2
bug 399668: URL for p2.index is not being generated properlyI20130416-0800
Adds a test case and removes compiler warnings for the change of how we compute the p2.index URI.
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java17
2 files changed, 19 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
index 5548202..27d4950 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
@@ -719,8 +719,6 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
localStream = new FileInputStream(indexFile);
locationProperties = LocationProperties.create(localStream);
}
- } catch (URISyntaxException e) {
- LogHelper.log(new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e));
} finally {
if (localStream != null)
localStream.close();
@@ -734,12 +732,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
//Handle non local repos (i.e. not file:)
ByteArrayOutputStream index = new ByteArrayOutputStream();
IStatus indexFileStatus = null;
- try {
- indexFileStatus = getTransport().download(getIndexFileURI(location), index, monitor);
- } catch (URISyntaxException uriSyntaxException) {
- LogHelper.log(new Status(IStatus.ERROR, Activator.ID, uriSyntaxException.getMessage(), uriSyntaxException));
- indexFileStatus = null;
- }
+ indexFileStatus = getTransport().download(getIndexFileURI(location), index, monitor);
if (indexFileStatus != null && indexFileStatus.isOK())
locationProperties = LocationProperties.create(new ByteArrayInputStream(index.toByteArray()));
@@ -1184,7 +1177,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
}
}
- private static URI getIndexFileURI(URI base) throws URISyntaxException {
+ private static URI getIndexFileURI(URI base) {
final String name = INDEX_FILE;
String spec = base.toString();
if (spec.endsWith(name))
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java
index 82ee588..c1012ad 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java
@@ -262,6 +262,23 @@ public class SiteIndexFileTest extends AbstractProvisioningTest {
}
/*
+ * Adds a query parameter to the end of the URI and tests that p2 can properly
+ * find the p2.index file.
+ */
+ public void testSingleRepositoryWithQueryParams() throws Exception {
+ URI repositoryLocation = TestData.getFile("metadataRepo/multipleRepos", "test1").toURI();
+ URI repositoryLocationWithParams = new URI(repositoryLocation.toString() + "?parameter=foo");
+ PrintStream out = System.out;
+ try {
+ System.setOut(new PrintStream(new StringBufferStream()));
+ IMetadataRepository repository = getMetadataRepositoryManager().loadRepository(repositoryLocationWithParams, new NullProgressMonitor());
+ assertTrue(repository instanceof UpdateSiteMetadataRepository);
+ } finally {
+ System.setOut(out);
+ }
+ }
+
+ /*
* Tests that metadata repository manager can read a simple index.p2 file
*/
public void testSingleRepository2() throws Exception {