Bug 40074 - get task for apache ant discards parts of files
Summary: get task for apache ant discards parts of files
Status: NEW
Alias: None
Product: Slide
Classification: Unclassified
Component: WebDAV client (show other bugs)
Version: 2.1
Hardware: All All
: P1 critical (vote)
Target Milestone: ---
Assignee: Slide Developer List
URL:
Keywords: APIBug, PatchAvailable
Depends on:
Blocks:
 
Reported: 2006-07-19 12:40 UTC by wheyboer
Modified: 2006-07-19 05:40 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wheyboer 2006-07-19 12:40:54 UTC
The ant task to get files from a webdav repository discards parts of files. 
This has something to do with the InputStream.available which might 0 whenever
there's still data available in the stream so the remaining data is discarded.
I created a fix by using WebdavResource, which works fine but, because I was in
a hurry, it's a little dirty. Below you'll find the fix.



	private void getAndStoreResource(HttpURL url, File target)throws
IOException,IOException,FileNotFoundException{
		File directory = target.getParentFile();
		if(!directory.exists())
			directory.mkdirs();
		url.setUserinfo(userid,password);
		WebdavResource webdavResource = Utils.getWebdavResource(url);
        log("Downloading  '" +url.getURI());
        if (webdavResource.getMethod(target)) {
           log("succeeded.");
           countWrittenFiles++;
        } else {
           log("failed.");
           log(webdavResource.getStatusMessage());
		}
        webdavResource.close();
	}