The code
public static void copy(java.io.File src, java.io.File target) throws IOException{
java.io.FileInputStream fin = new java.io.FileInputStream( src );
try {
java.io.FileOutputStream fout = new java.io.FileOutputStream( target );
try {
fin.getChannel().transferTo( 0, src.length(), fout.getChannel());
} finally {
fout.close();
}
} finally {
fin.close();
}
}
sporadically fails if the file "target" resides on a remote filesystem which is available through a SMB share.
The failure is twofold:
1. On the target SMB share files of size 0 are created (either correct size or 0 size!)
2. The target machine (Windows XP) runs out of FileDescriptors depending on the configured max value because files are not properly closed from a Windows viewpoint.