sshcheung / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

FeedbackServiceManager.getDevice() needs to close socket in a finally block #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I think it is good that there's no FeedbackServiceManager.close() method, and 
socket's life cycle is encapsulated in the class, if we are sure socket is 
closed when done.

In the current version, socket.close() is called at the end of the getDevice() 
method, but not in a finally block.  Any exception, such as NPE, thrown in the 
getDevice() method can cause memory leak which the caller will not be able to 
close.  

Would it be possible to move the close statement to a finally block?

Thanks,
Eric

Original issue reported on code.google.com by eric...@gmail.com on 7 Apr 2011 at 3:44

GoogleCodeExporter commented 8 years ago

Original comment by idbill.p...@gmail.com on 17 Apr 2011 at 4:31

GoogleCodeExporter commented 8 years ago
Applied to version 1.6.7

Original comment by idbill.p...@gmail.com on 22 Apr 2011 at 9:54