#48 UDPMasterTerminal may throw NullPointerException

Transport (27)
Julie Haugh

UDPMasterTerminal.activate() contains debug code which may throw a NullPointerException if the local address was not specified when the UDPMasterTerminal was instantiated.

The activate() method can create a UDP connection either with or without a previously initialized local address. The is the common behavior for Modbus/UDP masters since an ephemeral port and local interface will typically be allocated for the DatagramSocket when it is created. The debug code in question references m_LocalAddress.toString() to print out the address. Note that ".toString()" is redundant as it will automatically be invoked when an object is converted to a String(), such as when printed.

Although this is debug code, having debug functionality cause its own failures can prevent debugging from happening.


    • labels: --> Transport
    • assigned_to: nobody --> wimpi
    • status: open --> closed-fixed