fixing a wrong use of Document.isDownloadDone(). use Document.getDownloadStatus() == DOWNLOAD_DONE will be safer.
fixing ant build script under windows.