Author: maartenc
Date: Tue Jan 12 10:09:16 2010
New Revision: 898269

URL: http://svn.apache.org/viewvc?rev=898269&view=rev
Log:
FIX: ivy.settings.dir space escaping problem (IVY-1162)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=898269&r1=898268&r2=898269&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Jan 12 10:09:16 2010
@@ -105,6 +105,7 @@
 - IMPROVEMENT: Trace a message when a property file referenced from the 
settings doesn't exixts (IVY-1074)
 - IMPROVEMENT: use defaultconf in combination with defaultconfmapping 
(IVY-1135) (thanks to Jon Schneider)
 
+- FIX: ivy.settings.dir space escaping problem (IVY-1162)
 - FIX: Ivy cannot parse alternate format for Maven MD5 files (IVY-1155)
 - FIX: Ivy does not close URL connection to ivy-report.xsl properly (IVY-1152)
 - FIX: Artifact report throws NPE when artifact is not in cache (IVY-1150) 
(thanks to Steve Jones)

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=898269&r1=898268&r2=898269&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 
Tue Jan 12 10:09:16 2010
@@ -415,9 +415,17 @@
                 settingsURL = urlFromFileAttribute(propFilePath);
                 Message.verbose("including file: " + settingsURL);
                 if ("file".equals(settingsURL.getProtocol())) {
-                    ivy.setSettingsVariables(
-                        Checks.checkAbsolute(settingsURL.getPath(), 
-                        "settings include path"));
+                    try {
+                        File settingsFile = new File(new 
URI(settingsURL.toExternalForm()));
+                        ivy.setSettingsVariables(
+                            Checks.checkAbsolute(settingsFile, 
+                            "settings include path"));
+                    } catch (URISyntaxException e) {
+                        // try to make the best of it...
+                        ivy.setSettingsVariables(
+                            Checks.checkAbsolute(settingsURL.getPath(), 
+                            "settings include path"));
+                    }
                 } else {
                     ivy.setSettingsVariables(settingsURL);
                 }
@@ -442,14 +450,14 @@
         File incFile = new File(filePath);
         if (incFile.isAbsolute()) {
             if (!incFile.exists()) {
-                throw new FileNotFoundException();
+                throw new FileNotFoundException(incFile.getAbsolutePath());
             }
             return incFile.toURI().toURL();
         } else if ("file".equals(this.settings.getProtocol())) {
             try {
                 File settingsFile = new File(new 
URI(this.settings.toExternalForm()));
                 if (!settingsFile.exists()) {
-                    throw new FileNotFoundException();
+                    throw new 
FileNotFoundException(settingsFile.getAbsolutePath());
                 }
                 return new File(settingsFile.getParentFile(), 
filePath).toURI().toURL();
             } catch (URISyntaxException e) {
@@ -504,7 +512,7 @@
         configurator.typeDef(name, clazz);
     }
 
-    private void classpathStarted(Map attributes) throws MalformedURLException 
{
+    private void classpathStarted(Map attributes) throws IOException {
         String urlStr = (String) attributes.get("url");
         URL url = null;
         if (urlStr == null) {
@@ -513,7 +521,7 @@
                 throw new IllegalArgumentException(
                         "either url or file should be given for classpath 
element");
             } else {
-                url = Checks.checkAbsolute(file, "classpath").toURI().toURL();
+                url = urlFromFileAttribute(file);
             }
         } else {
             url = new URL(urlStr);


Reply via email to