On Thu, Nov 10, 2011 at 8:53 AM, Shai Erera <[email protected]> wrote:
> Hi
>
> I use Lucene's test-framework and I did this:
>
> File f = _TestUtil.createTempFile("test", "tmp", TEMP_DIR);
> registerTempFile(f);
>
> However, the test fails on NPE thrown from
> _TestUtil.rmDirjava.lang.RuntimeException: java.lang.NullPointerException
>
I think we could improve the javadocs here:
registerTempFile should be renamed to registerTempDir (and probably be
package-private).
The usual idiom is to do:
File tmpDir = _TestUtil.getTempDir("work"); // this 'registers' it for
deletion, but does not make it
// make the directory
// put stuff in it
if you then really need a unique temp file within that directory you
would just call _TestUtil.createTempFile(..., tmpDir)
so that it creates it in your already registered dir.
--
lucidimagination.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]