Datagram socket leak (original) (raw)
Alan Bateman Alan.Bateman at oracle.com
Fri Sep 9 06:08:37 PDT 2011
- Previous message: Datagram socket leak
- Next message: Datagram socket leak
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Michael McMahon wrote:
Yes, the regression tests picked that up as well. Well spotted.
http://cr.openjdk.java.net/~michaelm/7085981/webrev.5/ DatagramSocket looks okay to me. An alternative might be:
try { : } catch (SocketException | IllegalArgumentException | SecurityException e) { close(); throw e; }
As Socket.close can throw an IOException then maybe you could use the suppressed exception feature, ie:
try { : } catch (SocketException | IllegalArgumentException | SecurityException e) { try { close(); } catch (IOException ce) { e.addSuppressed(ce); } throw e; }
In passing, I notice in Socket L423 that it checks if address is null but at L416 it throws NPE if null.
-Alan.
- Previous message: Datagram socket leak
- Next message: Datagram socket leak
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]