Author: maartenc
Date: Fri Mar 23 23:11:41 2012
New Revision: 1304651
URL: http://svn.apache.org/viewvc?rev=1304651&view=rev
Log:
FIX: Ivy didn't properly handle some file: URLs (IVY-1340)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1304651&r1=1304650&r2=1304651&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Mar 23 23:11:41 2012
@@ -145,6 +145,7 @@ for detailed view of each issue, please
- IMPROVEMENT: ivy:retrieve can now convert 'dotted'-organisation names into a
directory tree.
- IMPROVEMENT: ivy:retrieve now accepts a nested mapper type.
+- FIX: Ivy didn't properly handle some file: URLs (IVY-1340)
- FIX: fallback mechanism didn't work properly for private configurations
- FIX: /localivy target does not work when building Ivy jar (IVY-1338) (thanks
to Ben Schmidt)
- FIX: The showprogress=false attribute of ivy:resolve doesn't do what it
should (IVY-1052) (thanks to Joseph Boyd)
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java?rev=1304651&r1=1304650&r2=1304651&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java
Fri Mar 23 23:11:41 2012
@@ -109,7 +109,12 @@ public class URLRepository extends Abstr
} else if (parent.startsWith("file")) {
String path;
try {
- path = new URI(parent).getPath();
+ URI uri = new URI(parent);
+ if (uri.isOpaque()) {
+ path = uri.getSchemeSpecificPart();
+ } else {
+ path = uri.getPath();
+ }
} catch (URISyntaxException e) {
IOException ioe = new IOException("Couldn't list content of '"
+ parent + "'");
ioe.initCause(e);
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java?rev=1304651&r1=1304650&r2=1304651&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
Fri Mar 23 23:11:41 2012
@@ -138,6 +138,27 @@ public class URLResolverTest extends Abs
assertEquals(pubdate, rmr.getPublicationDate());
}
+ public void testLatestFileWithOpaqueURL() throws Exception {
+ URLResolver resolver = new URLResolver();
+ resolver.setSettings(_settings);
+// String rootpath = new
File("test/repositories/1").toURI().toURL().toExternalForm();
+ String rootpath = new File("test/repositories/1").getAbsolutePath();
+ resolver.addIvyPattern("file:" + rootpath +
"/[organisation]/[module]/ivys/ivy-[revision].xml");
+ resolver.addArtifactPattern("file:" + rootpath +
"/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
+ resolver.setName("test");
+ assertEquals("test", resolver.getName());
+
+ ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1",
"2.0");
+ ResolvedModuleRevision rmr = resolver
+ .getDependency(new
DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org1",
+ "mod1.1", "latest.integration"), false), _data);
+ assertNotNull(rmr);
+
+ assertEquals(mrid, rmr.getId());
+ Date pubdate = new GregorianCalendar(2005, 1, 15, 11, 0, 0).getTime();
+ assertEquals(pubdate, rmr.getPublicationDate());
+ }
+
public void testIBiblio() throws Exception {
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
if (ibiblioRoot == null) {