Menu

#1 ClientComm :: Method isConnected() :: NullPointerException (NPE)

1.0
closed
nobody
defect (2)
2016-11-17
2016-11-17
No

Symptoms:
When we execute a method ClientComm.isConnected() a NullPointerException (NPE) is thrown.

Cause
After analyzing the existing code, we've detected that this is happening when the client socket is not instantiated properly, and within the code we have the following statement:

clientSocket.isConnected()

clientSocket == null => NPE

Solution
Adding a control in all statements of the class ClientComm in which the object clientSocket is being used in order to validate that it’s instantiated properly, such as:

if(clientSocket != null){
//Do something
}

Discussion

  • João Paulo Ferreira Pires

    • labels: --> defect
     
  • João Paulo Ferreira Pires

    The correction is available in the version ES1-2016-IPLC-84-mt-comm-0.0.2.

     
  • João Paulo Ferreira Pires

    • status: open --> closed
     

Log in to post a comment.