commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <ebo...@apache.org>
Subject [compress] A few comments
Date Tue, 17 Jun 2008 09:02:57 GMT
I looked a bit at commons compress, I'd like to make a couple suggestions:

- FileOutputStream and FileInputStream are used in several method 
signatures, but a simple OutputStream or InputStream would do the job. 
It's limiting the API to files only for no apparent reason.

- I believe it would make sense if the exception hierarchy extend 
IOException. It could simplify some exception handling in the code, for 
example in PackableObject instead of this:

     public static PackableObject identifyByHeader(File file, List 
packables) throws PackableObjectException {
	...
         try {
             ...
         } catch (FileNotFoundException e) {
             throw new PackableObjectException("File not found", e);
         } catch (IOException e) {
             throw new PackableObjectException("Internal factory 
exception", e);
         } finally {
             try {
                 fis.close();
             } catch (IOException e1) {
                 throw new PackableObjectException("Error while closing 
InputStream to file", e1);
             }
         }
     }


we could have this:


     public static PackableObject identifyByHeader(File file, List 
packables) throws IOException {
         ...
         try {
             ...
         } finally {
             fis.close();
         }
     }


Any objection to change this ?

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message