DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25021>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25021 [PATCH] ZipArchiveSerializer does not check for non existing files [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Version|2.0.4 |Current CVS 2.0 ------- Additional Comments From [EMAIL PROTECTED] 2003-12-02 15:30 ------- Ofcourse there is a much better way of doing this : If we probe the source and inputstream before the zipentry gets created and put the whole in try/catch then the resourcenotfoundexception will do it's thing try { // Get the source and its data Source source = resolver.resolve(src); InputStream sourceInput = source.getInputStream(); // Create a new Zip entry ZipEntry entry = new ZipEntry(name); this.zipOutput.putNextEntry(entry); // Copy the source to the zip int len; while ((len = sourceInput.read(this.buffer)) > 0) { this.zipOutput.write(this.buffer, 0, len); } // and close the entry this.zipOutput.closeEntry(); }catch(ResourceNotFoundException rnfe){ //ignore, file won't be added and zipentry not created }
