Author: maartenc
Date: Thu Jul 31 14:41:11 2008
New Revision: 681508
URL: http://svn.apache.org/viewvc?rev=681508&view=rev
Log:
FIX: Config files with # in path can't be read (IVY-868) (thanks to Simon
Steiner)
Added:
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-macro#2.xml
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCheck.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConvertPom.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInfo.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/RelativeUrlResolver.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Jul 31 14:41:11 2008
@@ -60,9 +60,10 @@
Geoff Reedy
Christian Riege
Andreas Sahlbach
- Adrian Sandor
+ Adrian Sandor
Ruslan Shevchenko
John Shields
+ Simon Steiner
Johan Stuyts
Jason Trump
Tjeerd Verhagen
@@ -100,6 +101,7 @@
- IMPROVEMENT: Smarter determination if an expression is exact or not for
RegexpPatternMatcher and GlobPatternMatcher
- IMPROVEMENT: Check branch consistency during resolve (IVY-858)
+- FIX: Config files with # in path can't be read (IVY-868) (thanks to Simon
Steiner)
- FIX: Cache can't distinguish artifacts with classifiers (IVY-803) (thanks to
James P. White)
- FIX: Reports showing double dependencies in certain cases (IVY-578)
- FIX: Dynamic revision resolve does not throw error when configuration is
missing (IVY-861)
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java Thu Jul 31 14:41:11
2008
@@ -228,7 +228,7 @@
}
ResolveOptions resolveOptions = new
ResolveOptions().setConfs(confs)
.setValidate(validate);
- ResolveReport report = ivy.resolve(ivyfile.toURL(),
resolveOptions);
+ ResolveReport report = ivy.resolve(ivyfile.toURI().toURL(),
resolveOptions);
if (report.hasError()) {
System.exit(1);
}
@@ -416,7 +416,7 @@
for (Iterator iter = fileList.iterator(); iter.hasNext();) {
File file = (File) iter.next();
try {
- urls.add(file.toURL());
+ urls.add(file.toURI().toURL());
} catch (MalformedURLException e) {
// Should not happen, just ignore.
}
@@ -438,7 +438,7 @@
ArtifactDownloadReport artifact = (ArtifactDownloadReport)
iter.next();
if (artifact.getLocalFile() != null) {
- urls.add(artifact.getLocalFile().toURL());
+ urls.add(artifact.getLocalFile().toURI().toURL());
}
}
} catch (Exception ex) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java Thu Jul 31
14:41:11 2008
@@ -205,7 +205,7 @@
} else {
try {
ModuleDescriptor md =
ModuleDescriptorParserRegistry.getInstance()
- .parseDescriptor(settings, ivyFile.toURL(),
doValidate(settings));
+ .parseDescriptor(settings,
ivyFile.toURI().toURL(), doValidate(settings));
buildFiles.put(md, buildFile);
mds.add(md);
Message.debug("Add " +
md.getModuleRevisionId().getModuleId());
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCheck.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCheck.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCheck.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCheck.java Thu Jul 31
14:41:11 2008
@@ -72,7 +72,7 @@
try {
Ivy ivy = getIvyInstance();
if (file != null) {
- if (ivy.check(file.toURL(), resolvername)) {
+ if (ivy.check(file.toURI().toURL(), resolvername)) {
Message.verbose("checked " + file + ": OK");
}
}
@@ -85,7 +85,7 @@
String[] srcFiles = ds.getIncludedFiles();
for (int j = 0; j < srcFiles.length; j++) {
File file = new File(fromDir, srcFiles[j]);
- if (ivy.check(file.toURL(), resolvername)) {
+ if (ivy.check(file.toURI().toURL(), resolvername)) {
Message.verbose("checked " + file + ": OK");
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConvertPom.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConvertPom.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConvertPom.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConvertPom.java Thu Jul
31 14:41:11 2008
@@ -60,9 +60,9 @@
throw new BuildException("destination ivy file is required for
convertpom task");
}
ModuleDescriptor md =
PomModuleDescriptorParser.getInstance().parseDescriptor(
- getSettings(), pomFile.toURL(), false);
-
PomModuleDescriptorParser.getInstance().toIvyFile(pomFile.toURL().openStream(),
- new URLResource(pomFile.toURL()), getIvyFile(), md);
+ getSettings(), pomFile.toURI().toURL(), false);
+
PomModuleDescriptorParser.getInstance().toIvyFile(pomFile.toURI().toURL().openStream(),
+ new URLResource(pomFile.toURI().toURL()), getIvyFile(), md);
} catch (MalformedURLException e) {
throw new BuildException("unable to convert given pom file to url:
" + pomFile + ": "
+ e, e);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInfo.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInfo.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInfo.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInfo.java Thu Jul 31
14:41:11 2008
@@ -133,7 +133,7 @@
file = getProject().resolveFile(getProperty(settings,
"ivy.dep.file"));
}
ModuleDescriptor md =
ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
- settings, file.toURL(), doValidate(settings));
+ settings, file.toURI().toURL(), doValidate(settings));
ModuleRevisionId mrid = md.getModuleRevisionId();
setProperties(md, mrid);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java Thu Jul 31
14:41:11 2008
@@ -102,7 +102,7 @@
throw new BuildException("destination pom file is required for
makepom task");
}
ModuleDescriptor md =
XmlModuleDescriptorParser.getInstance().parseDescriptor(
- getSettings(), ivyFile.toURL(), false);
+ getSettings(), ivyFile.toURI().toURL(), false);
PomModuleDescriptorWriter.write(md,
headerFile == null ? null :
FileUtil.readEntirely(getHeaderFile()),
mappings.isEmpty()
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java Thu Jul 31
14:41:11 2008
@@ -229,7 +229,7 @@
if (file == null) {
file = getProject().resolveFile(getProperty(settings,
"ivy.dep.file"));
}
- report = ivy.resolve(file.toURL(), getResolveOptions(ivy,
confs, settings));
+ report = ivy.resolve(file.toURI().toURL(),
getResolveOptions(ivy, confs, settings));
}
if (report.hasError()) {
if (failureProperty != null) {
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/RelativeUrlResolver.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/RelativeUrlResolver.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/RelativeUrlResolver.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/RelativeUrlResolver.java
Thu Jul 31 14:41:11 2008
@@ -47,7 +47,7 @@
if (file != null) {
File f = new File(file);
if (f.isAbsolute()) {
- return f.toURL();
+ return f.toURI().toURL();
} else {
return getURL(context, file);
}
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Thu Jul 31 14:41:11 2008
@@ -543,7 +543,7 @@
// found in cache !
try {
ModuleDescriptor depMD =
XmlModuleDescriptorParser.getInstance()
- .parseDescriptor(settings, ivyFile.toURL(),
options.isValidate());
+ .parseDescriptor(settings, ivyFile.toURI().toURL(),
options.isValidate());
String resolverName = getSavedResolverName(depMD);
String artResolverName = getSavedArtResolverName(depMD);
DependencyResolver resolver =
settings.getResolver(resolverName);
@@ -889,7 +889,7 @@
URL cachedMDURL = null;
try {
- cachedMDURL = report.getLocalFile().toURL();
+ cachedMDURL = report.getLocalFile().toURI().toURL();
} catch (MalformedURLException ex) {
Message.warn("malformed url exception for original in cache
file: "
+ report.getLocalFile() + ": " + ex.getMessage());
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
Thu Jul 31 14:41:11 2008
@@ -115,7 +115,7 @@
ModuleDescriptor md = null;
URL ivyFileURL = null;
try {
- ivyFileURL = ivyFile.toURL();
+ ivyFileURL = ivyFile.toURI().toURL();
md =
XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, ivyFileURL,
options.isValidate());
md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(mrid,
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
Thu Jul 31 14:41:11 2008
@@ -111,7 +111,7 @@
ModuleDescriptor md = null;
URL ivyFileURL = null;
try {
- ivyFileURL = ivyFile.toURL();
+ ivyFileURL = ivyFile.toURI().toURL();
md =
XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, ivyFileURL,
false);
if (options.getSrcIvyPattern() != null) {
@@ -138,7 +138,7 @@
ivyFile = tmp;
// we parse the new file to get updated module
descriptor
md =
XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
- ivyFile.toURL(), false);
+ ivyFile.toURI().toURL(), false);
options.setSrcIvyPattern(ivyFile.getAbsolutePath());
} catch (SAXException e) {
throw new IllegalStateException("bad ivy file for " +
mrid + ": " + ivyFile
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
Thu Jul 31 14:41:11 2008
@@ -128,7 +128,7 @@
}
public ResolveReport resolve(File ivySource) throws ParseException,
IOException {
- return resolve(ivySource.toURL());
+ return resolve(ivySource.toURI().toURL());
}
public ResolveReport resolve(URL ivySource) throws ParseException,
IOException {
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
Thu Jul 31 14:41:11 2008
@@ -202,7 +202,7 @@
try {
File ivyFile = getCache().getResolvedIvyFileInCache(mrid);
Message.verbose("no explicit confs given for retrieve, using
ivy file: " + ivyFile);
- URL ivySource = ivyFile.toURL();
+ URL ivySource = ivyFile.toURI().toURL();
URLResource res = new URLResource(ivySource);
ModuleDescriptorParser parser =
ModuleDescriptorParserRegistry.getInstance()
.getParser(res);
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
Thu Jul 31 14:41:11 2008
@@ -368,7 +368,7 @@
loadDefaultProperties();
try {
- new XmlSettingsParser(this).parse(settingsFile.toURL());
+ new XmlSettingsParser(this).parse(settingsFile.toURI().toURL());
} catch (MalformedURLException e) {
IllegalArgumentException iae = new IllegalArgumentException(
"given file cannot be transformed to url: " +
settingsFile);
@@ -458,7 +458,7 @@
setDeprecatedVariable("ivy.conf.dir", "ivy.settings.dir");
setVariable("ivy.settings.file", settingsFile.getAbsolutePath());
setDeprecatedVariable("ivy.conf.file", "ivy.settings.file");
- setVariable("ivy.settings.url",
settingsFile.toURL().toExternalForm());
+ setVariable("ivy.settings.url",
settingsFile.toURI().toURL().toExternalForm());
setDeprecatedVariable("ivy.conf.url", "ivy.settings.url");
} catch (MalformedURLException e) {
IllegalArgumentException iae = new IllegalArgumentException(
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
Thu Jul 31 14:41:11 2008
@@ -21,6 +21,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.util.Arrays;
@@ -397,12 +399,25 @@
* to the URL of the current settings file (can be local file or remote
URL).
*/
private URL urlFromFileAttribute(String filePath) throws
MalformedURLException {
+ try {
+ return new URL(filePath);
+ } catch (MalformedURLException e) {
+ // ignore, we'll try to create a correct URL below
+ }
+
File incFile = new File(filePath);
if (incFile.isAbsolute()) {
return incFile.toURI().toURL();
+ } else if ("file".equals(this.settings.getProtocol())) {
+ try {
+ File settingsFile = new File(new
URI(this.settings.toExternalForm()));
+ return new File(settingsFile.getParentFile(),
filePath).toURI().toURL();
+ } catch (URISyntaxException e) {
+ return new URL(this.settings , filePath);
+ }
} else {
return new URL(this.settings , filePath);
- }
+ }
}
private void propertiesStarted(Map attributes) throws IOException {
@@ -454,7 +469,7 @@
throw new IllegalArgumentException(
"either url or file should be given for classpath
element");
} else {
- url = new File(file).toURL();
+ url = new File(file).toURI().toURL();
}
} else {
url = new URL(urlStr);
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
Thu Jul 31 14:41:11 2008
@@ -133,7 +133,7 @@
if (res instanceof URLResource) {
inputStreamContext = ((URLResource) res).getURL();
} else if (res instanceof FileResource) {
- inputStreamContext = ((FileResource) res).getFile().toURL();
+ inputStreamContext = ((FileResource)
res).getFile().toURI().toURL();
}
update(inputStreamContext, in, fos, options);
} finally {
@@ -445,7 +445,7 @@
String urlStr = attributes.getValue("url");
url = new URL(urlStr);
} else {
- url = new File(fileName).toURL();
+ url = new File(fileName).toURI().toURL();
}
}
XMLHelper.parse(url, null, new DefaultHandler() {
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java
Thu Jul 31 14:41:11 2008
@@ -41,7 +41,7 @@
return new File(res.getName()).equals(f);
} else if (res instanceof URLResource) {
try {
- return f.toURL().toExternalForm().equals(res.getName());
+ return
f.toURI().toURL().toExternalForm().equals(res.getName());
} catch (MalformedURLException e) {
return false;
}
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
Thu Jul 31 14:41:11 2008
@@ -100,7 +100,7 @@
ModuleDescriptorParser parser =
ModuleDescriptorParserRegistry.getInstance().getParser(res);
ModuleDescriptor md =
- parser.parseDescriptor(getSettings(),
temp.toURL(), res, false);
+ parser.parseDescriptor(getSettings(),
temp.toURI().toURL(), res, false);
revision = md.getRevision();
if ((revision == null) || (revision.length() ==
0)) {
revision = "working@" + name;
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java?rev=681508&r1=681507&r2=681508&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
Thu Jul 31 14:41:11 2008
@@ -473,7 +473,48 @@
//An exception must be throwed
}
}
+
+ public void testIncludeSpecialCharInName() throws Exception {
+ IvySettings settings = new IvySettings();
+ XmlSettingsParser parser = new XmlSettingsParser(settings);
+
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-include-special.xml"));
+ DependencyResolver def = settings.getResolver("default");
+ assertNotNull(def);
+ assertTrue(def instanceof ChainResolver);
+ ChainResolver chain = (ChainResolver) def;
+ List subresolvers = chain.getResolvers();
+ assertNotNull(subresolvers);
+ assertEquals(2, subresolvers.size());
+ FileSystemResolver fsInt1 = (FileSystemResolver) subresolvers.get(0);
+ assertEquals("default-fs1", fsInt1.getName());
+
+ List ivyPatterns = fsInt1.getIvyPatterns();
+ assertNotNull(ivyPatterns);
+ assertEquals(1, ivyPatterns.size());
+
assertEquals("path/to/myrep/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]",
+ ivyPatterns.get(0));
+
+ DependencyResolver inc = settings.getResolver("includeworks");
+ assertNotNull(inc);
+ assertTrue(inc instanceof ChainResolver);
+ chain = (ChainResolver) inc;
+ subresolvers = chain.getResolvers();
+ assertNotNull(subresolvers);
+ assertEquals(2, subresolvers.size());
+
+ fsInt1 = (FileSystemResolver) subresolvers.get(0);
+ assertEquals("includeworks-fs1", fsInt1.getName());
+
+ ivyPatterns = fsInt1.getIvyPatterns();
+ assertNotNull(ivyPatterns);
+ assertEquals(1, ivyPatterns.size());
+
assertEquals("included/myrep/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]",
+ ivyPatterns.get(0));
+
+ // properties defined in included file should be available to
including file (IVY-780)
+ assertEquals("myvalue", settings.getVariable("ivy.test.prop"));
+ }
public void testRelativePropertiesFile() throws Exception {
IvySettings settings = new IvySettings();
Added:
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml?rev=681508&view=auto
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml
(added)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml
Thu Jul 31 14:41:11 2008
@@ -0,0 +1,24 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ivysettings>
+ <include file="ivysettings-macro#2.xml"/>
+ <resolvers>
+ <mymacro name="includeworks" mymainrep="included/myrep"
mysecondrep="included/secondrep"/>
+ </resolvers>
+</ivysettings>
Added:
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-macro#2.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-macro%232.xml?rev=681508&view=auto
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-macro#2.xml
(added)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-macro#2.xml
Thu Jul 31 14:41:11 2008
@@ -0,0 +1,44 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ivysettings>
+ <property name="ivy.test.prop" value="myvalue" />
+ <macrodef name="mymacro">
+ <attribute name="mymainrep"/>
+ <attribute name="mysecondrep"/>
+ <attribute name="myseconddirlayout"
default="[organisation]/[module]/[type]s"/>
+ <chain>
+ <filesystem name="fs1">
+ <ivy
pattern="@{mymainrep}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
+ <artifact
pattern="@{mymainrep}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
+ </filesystem>
+ <filesystem name="fs2" latest="latest-time">
+ <ivy
pattern="@{mysecondrep}/@{myseconddirlayout}/ivy-[revision].xml"/>
+ <artifact
pattern="@{mysecondrep}/@{myseconddirlayout}/[artifact]-[revision].[ext]"/>
+ </filesystem>
+ </chain>
+ </macrodef>
+
+ <resolvers>
+ <mymacro name="default" mymainrep="path/to/myrep"
mysecondrep="path/to/secondrep"/>
+ <mymacro name="other"
+ mymainrep="path/to/myrep"
+ mysecondrep="path/to/secondrep"
+ myseconddirlayout="[module]/[type]s"/>
+ </resolvers>
+</ivysettings>