Hi

In shapefile datastore I have had to add some hacks to work around the operating system. Essentially what I do is I try to rename the file and if that fails I copy the file. I remember I had to file a bug for EMF because they were relying on renameTo as well.
Here's a code snippet from ShapefileDatastore's copyAndDelete method.

            if (storage.exists() && !storage.renameTo(dest)) {
                in = new FileInputStream(storage).getChannel();
                out = new FileOutputStream(dest).getChannel();

                long len = in.size();
                long copied = out.transferFrom(in, 0, in.size());

                if (len != copied) {
                    throw new IOException("unable to complete write");
                }
                          }

Jesse


On 5-Mar-07, at 4:18 PM, Jody Garnett wrote:

Hi Andrea - I think this is back to the dreaded windows file lock
problem that was a long standing shapefile bug.
Currently this test always fails on maven, and can pass 4 out 5 times in
eclipse ... I think this is a case where machines
have gotten faster and reveal a problem.

The sad part is that the test is single threaded, and the problem is
operating system specific :-(
Jody

Jody Garnett wrote:
Hi Andrea - I was able to reproduce the problem on Java 1.4, Java 5
(friday) and using Java 6 (over the weekend):

As promissed here is the test case, can I ask for a quick eyeball test
to make sure what I am testing is correct:



---------------------------------------------------------------------- ---
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php? page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to