commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: svn commit: r750313 - /commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Date Fri, 06 Mar 2009 05:26:55 GMT
On 2009-03-06, Stefan Bodewig <bodewig@apache.org> wrote:

> On 2009-03-06, sebb <sebbaz@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-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message