[ 
http://issues.apache.org/jira/browse/DERBY-1965?page=comments#action_12443046 ] 
            
Knut Anders Hatlen commented on DERBY-1965:
-------------------------------------------

I'm not sure that's the best use of try/finally. Take this code for example:

  try {
      setUpSocket();
      ...
  } finally {
      closeSocket();
  }

If an exception (say, IOException) is raised by setUpSocket(), closeSocket() is 
invoked but will probably raise a NullPointerException. Then, the IOException 
won't be seen because it is masked by the NullPointerException.

> NetworkServerControlImpl never closes the socket or streams it opens in 
> setUpSocket.
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-1965
>                 URL: http://issues.apache.org/jira/browse/DERBY-1965
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>            Reporter: Daniel John Debrunner
>         Assigned To: Daniel John Debrunner
>            Priority: Minor
>         Attachments: derby1965_diff.txt
>
>
> Every method that calls setUpSocket should have a  call to a new 
> closeSocket() method.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to