You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by km...@apache.org on 2006/11/03 16:10:58 UTC

svn commit: r470848 - in /incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src: main/java/org/apache/cayenne/tools/CayenneGeneratorUtil.java test/java/org/apache/cayenne/unit/CayenneTestResources.java

Author: kmenard
Date: Fri Nov  3 07:10:57 2006
New Revision: 470848

URL: http://svn.apache.org/viewvc?view=rev&rev=470848
Log:
Fixed URL related issues on Windows, so all the tests should run properly now.  Incidentally, these changes seem like they'd also fix the problem described at http://www.objectstyle.org/cayenne/lists/cayenne-user/2006/07/0044.html. 

Modified:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/tools/CayenneGeneratorUtil.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneTestResources.java

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/tools/CayenneGeneratorUtil.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/tools/CayenneGeneratorUtil.java?view=diff&rev=470848&r1=470847&r2=470848
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/tools/CayenneGeneratorUtil.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/tools/CayenneGeneratorUtil.java Fri Nov  3 07:10:57 2006
@@ -54,7 +54,7 @@
     
     /** Loads and returns a DataMap by File. */
     public DataMap loadDataMap(File mapName) throws Exception {
-        InputSource in = new InputSource(mapName.getCanonicalPath());
+        InputSource in = new InputSource(mapName.toURL().toString());
         return new MapLoader().loadDataMap(in);
     }
 

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneTestResources.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneTestResources.java?view=diff&rev=470848&r1=470847&r2=470848
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneTestResources.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneTestResources.java Fri Nov  3 07:10:57 2006
@@ -21,6 +21,7 @@
 
 import java.io.File;
 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Map;
 
@@ -140,7 +141,16 @@
      */
     public static URL getResourceURL(String name) {
         URL in = Thread.currentThread().getContextClassLoader().getResource(name);
-
+        
+        // Fix for the issue described at https://issues.apache.org/struts/browse/SB-35
+        // Basically, spaces in filenames make maven cry.
+        try {
+            in = new URL(in.toExternalForm().replaceAll(" ", "%20"));
+        }
+        catch (MalformedURLException e) {
+            throw new CayenneRuntimeException("Error constructing URL.", e);
+        }
+        
         if (in == null) {
             throw new CayenneRuntimeException("Resource not found: " + name);
         }