On 2009-03-06, Stefan Bodewig <bode...@apache.org> wrote:

> On 2009-03-06, sebb <seb...@gmail.com> wrote:

>> I'm not sure that getResource() is the correct method to use here.

> Well, it works great for files that don't contain spaces in their name
> 8-)

Looking into AbstractTestCase it explicitly adds src/test/resources to
the classloader to make the getFile method work later.  If getFile
simply returned new File("src/test/resources", path) it works fine for
running mvn from the command line - but a comment in the addURL method
indicates the current approach was necessary in Eclipse.

Could anybody using Eclipse please check whether the appended trivial
patch causes problems there?

Stefan

Index: src/test/java/org/apache/commons/compress/AbstractTestCase.java
===================================================================
--- src/test/java/org/apache/commons/compress/AbstractTestCase.java     
(Revision 750769)
+++ src/test/java/org/apache/commons/compress/AbstractTestCase.java     
(Arbeitskopie)
@@ -50,10 +50,12 @@
         dir.delete();
         dir.mkdir();
 
-        addURL(new File("src/test/resources").toURL());
+        //addURL(new File("src/test/resources").toURL());
     }
 
     protected File getFile(String path) throws IOException {
+        return new File("src/test/resources", path);
+        /*
         URL url = getClass().getResource(path);
         if (url == null) {
             throw new java.io.FileNotFoundException(path + " doesn't exist");
@@ -64,6 +66,7 @@
             // impossible since URL.toString() should always yield a valid URI
             throw new IOException(ex.getMessage());
         }
+        */
     }
 
     protected void tearDown() throws Exception {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to