Community
Participate
Working Groups
Build Identifier: 3.5 When trying to open a zip file (e.g., when loading resources) which cannot be opened, the ZipException which is thrown does not contain the name of the file. Reproducible: Always Steps to Reproduce: A sample bundle which reproduces the problem is attached. 1. Install the bundle 2. Start the bundle 3. Check the log file to see that the exception does not contain the name of the file
Created attachment 163093 [details] Sample bundle to reproduce the problem.
Created attachment 163095 [details] Source code of the sample bundle.
Created attachment 163096 [details] Patch which fixes the message of the ZipException in SecureAction The patch adds to the message of the ZipException the name of the file, which cannot be opened.
Created attachment 163438 [details] Updatd patch Thanks for the patch. Here is an updated patch that catches all IOExceptions. Seems like we would want the file name in all IOException cases, not just for ZipExceptions. I also used the File.getPath method instead to give a path to the file that could not be opened.
Updated patch released.
Comment on attachment 163096 [details] Patch which fixes the message of the ZipException in SecureAction Thanks for the patch Lazar!
Thanks for the timely response and the update of the patch!
My only concern regarding the updated patch is that it wraps in ZipExceptions all IOExceptions - if, for example, a FileNotFoundException is thrown, it will be wrapped in ZipException. Probably ZipExceptions and the other IOExceptions may be processed separately. In both cases the name of the problematic file will be added to the exception, and the difference will be only in the type of the exception thrown. In this way, if a caller is interested only in real ZipExceptions, he will not receive other exceptions, disguised as ZipExceptions.
Created attachment 163514 [details] Proposed patch, diferentiating ZipExceptions from other IOExceptions Here I propose a small change regarding my concern.
Thanks I agree. I did not mean to wrap the exception in a ZipException. Good catch!
Comment on attachment 163514 [details] Proposed patch, diferentiating ZipExceptions from other IOExceptions Thanks for the patch!
patch released.