You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2009/09/10 14:49:04 UTC
svn commit: r813408 -
/james/server/trunk/core-library/src/test/java/org/apache/james/test/mock/james/MockFileSystem.java
Author: norman
Date: Thu Sep 10 12:49:04 2009
New Revision: 813408
URL: http://svn.apache.org/viewvc?rev=813408&view=rev
Log:
correctly handle path with whitespaces.. I love windows..
Modified:
james/server/trunk/core-library/src/test/java/org/apache/james/test/mock/james/MockFileSystem.java
Modified: james/server/trunk/core-library/src/test/java/org/apache/james/test/mock/james/MockFileSystem.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/test/java/org/apache/james/test/mock/james/MockFileSystem.java?rev=813408&r1=813407&r2=813408&view=diff
==============================================================================
--- james/server/trunk/core-library/src/test/java/org/apache/james/test/mock/james/MockFileSystem.java (original)
+++ james/server/trunk/core-library/src/test/java/org/apache/james/test/mock/james/MockFileSystem.java Thu Sep 10 12:49:04 2009
@@ -26,6 +26,9 @@
import java.io.InputStream;
import java.io.IOException;
import java.io.FileInputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
public class MockFileSystem implements FileSystem {
public File getBasedir() throws FileNotFoundException {
@@ -40,7 +43,12 @@
try {
if (fileURL.startsWith("file://")) {
if (fileURL.startsWith("file://conf/")) {
- return new File(MockFileSystem.class.getClassLoader().getResource("./"+fileURL.substring(12)).getFile());
+ URL url = MockFileSystem.class.getClassLoader().getResource("./"+fileURL.substring(12));
+ try {
+ return new File(new URI(url.toString()));
+ } catch (URISyntaxException e) {
+ throw new FileNotFoundException("Unable to load file");
+ }
// return new File("./src"+fileURL.substring(6));
} else {
throw new UnsupportedOperationException("getFile: "+fileURL);
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org