core-libs-dev Digest, Vol 29, Issue 40

Paulo Levi i30817 at
Wed Sep 16 15:55:15 UTC 2009

This won't be used anyway, now with arm, but the more general way, you
method his more useful in this variation. The exception are oddball
classes like Sockets and all the SQL classes, images (dispose()) that
are not closeable, even if the acquire native resources.

   static List<IOException> close(Closeable ... s) {
       if (s != null) {
           List <IOException> exceptions = new ArrayList();
           for(Closeable s1 : s){
           try { s.close(); }
           catch (IOException e) { exceptions.add(e); }
           return exceptions;
       return Collections.emptyList();

More information about the core-libs-dev mailing list