Bug 32855 - Opened input strams are not closed
Summary: Opened input strams are not closed
Status: NEW
Alias: None
Product: Slide
Classification: Unclassified
Component: WebDAV client (show other bugs)
Version: 2.1
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Slide Developer List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-28 09:07 UTC by Kari M
Modified: 2004-12-28 00:07 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kari M 2004-12-28 09:07:12 UTC
The Slide WebDAV client, specifically class WebdavResource, opens input streams 
but doesn't close them. This results in errors if many files are consecutively 
copied with putMethod(). If input streams are not closed, the system resources 
will be freed only at garbage collection time.

I would suggest to change WebdavResource as follows.

Instead of doing 
	method.setRequestBody(new FileInputStream(file));

do

	FileInputStream fin=new FileInputStream(file);
	method.setRequestBody(fin);
	fin.close();

Example stack trace after copying multiple files:

java.io.FileNotFoundException: 
(Insufficient system resources exist to complete the requested service)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at org.apache.webdav.lib.WebdavResource.putMethod
(WebdavResource.java:2553)