DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=40835>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40835 Summary: Unclosed FileInputStream in WebdavResource.putMethod Product: Slide Version: 2.1 Platform: Other OS/Version: other Status: NEW Severity: normal Priority: P2 Component: WebDAV client AssignedTo: slide-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] A FileInputStream in the putMethod(String path, File file) method of WebdavResource is not closed. On Windows (and any other OS that blocks writing to open files) this will prevent editing of any file uploaded via this method until the application that uploaded the file is exited. See below for the simple fix (one can simply comment-out the old version of the method and paste-in this one in its entirety). Cheers! Michael N. Christoff [EMAIL PROTECTED] /** * Execute the PUT method for the given path. * * October 22, 2006 * Fixed error where FileInputStream not closed. * * @param path the server relative path to put the given file * @param file the filename to get on local. * @return true if the method is succeeded. * @exception HttpException * @exception IOException */ public boolean putMethod(String path, File file) throws HttpException, IOException { setClient(); PutMethod method = new PutMethod(URIUtil.encodePathQuery(path)); generateIfHeader(method); if (getGetContentType() != null && !getGetContentType().equals("")) method.setRequestHeader("Content-Type", getGetContentType()); long fileLength = file.length(); method.setRequestContentLength(fileLength <= Integer.MAX_VALUE ? (int) fileLength : PutMethod.CONTENT_LENGTH_CHUNKED); FileInputStream fis = new FileInputStream(file); method.setRequestBody(fis); generateTransactionHeader(method); int statusCode = client.executeMethod(method); setStatusCode(statusCode); fis.close(); // <--- simple update to code return (statusCode >= 200 && statusCode < 300) ? true : false; } -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]