kusuzhu / sipdroid

Automatically exported from code.google.com/p/sipdroid
GNU General Public License v3.0
0 stars 0 forks source link

Null pointer exception in private sendMessage(...) #679

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
  I can not currently reproduce this problem

What is the expected output? What do you see instead?
  On occasion, I saw a null pointer exception occur in private sendMessage

What version of the product are you using? On what device/operating system?
  Sipdroid 1.5; Android 2.1 & 2.2; various devices (e.g. Droid, Droidx & Nexus 1)

Which SIP server are you using? What happens with PBXes?
  Proprietary; not related

Which type of network are you using?
  Wifi (802.n)

Please provide any additional information below.
  Although I do not have a scenrio to readily produce this problem, I occasionally saw a null pointer exception occurring in the private version of sendMessage(...) in sipProvider.java.  The exception occurs in the code below if "connections" is null.

The exception can be easily prevented by checking "connections" prior to using 
it.  This fix is submitted in the attached file.

-----------------

    /**
     * Sends a Message, specifing the transport portocol, nexthop address and
     * port.
     */
    private ConnectionIdentifier sendMessage(Message msg, String proto,
            IpAddress dest_ipaddr, int dest_port, int ttl) {
        ConnectionIdentifier conn_id = new ConnectionIdentifier(proto,
                dest_ipaddr, dest_port);
        if (log_all_packets || msg.getLength() > MIN_MESSAGE_LENGTH)
            printLog("Sending message to " + conn_id, LogLevel.MEDIUM);

        if (transport_udp && proto.equals(PROTO_UDP)) { // UDP
            // printLog("using UDP",LogLevel.LOW);
            conn_id = null;
            try { // if (ttl>0 && multicast_address) do something?
                udp.sendMessage(msg, dest_ipaddr, dest_port);
            } catch (IOException e) {
                printException(e, LogLevel.HIGH);
                return null;
            }
        } else if (transport_tcp && proto.equals(PROTO_TCP)) { // TCP
            // printLog("using TCP",LogLevel.LOW);
            if (!connections.containsKey(conn_id)) {
                ...
                ...

Original issue reported on code.google.com by krcb...@gmail.com on 6 Oct 2010 at 5:37

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by pmerl...@googlemail.com on 7 Oct 2010 at 10:14

GoogleCodeExporter commented 9 years ago

Original comment by pmerl...@googlemail.com on 14 Oct 2010 at 8:50