[sip-comm-dev] NPE during Sip unregister


#1

Hi,
I found that bug that I can reproduce everytime :

I have a sip account with an unsaved password.
I click to connect it.
The Authenticate sip dialog appear.
The state is "Registering"
But instead of giving a password or cancelling, I ignore this dialog
and click in the Account list to Unregister.
Here it will unregister then remove the securityAuthority :

ProtocolProviderServiceSipImpl line 439
sipRegistrarConnection.unregister();
sipSecurityManager.setSecurityAuthority(null);

The problem is that I receive after that an authentication challenge
for unregister (because of the unregister). And since there is no
securityAuthority anymore, I have this NPE.

I think that in that case we must not send the unregister request
since the registration was not completed :
That's what I understand of this this in RFC 3261 chapter 10.2

UAs MUST NOT send a new registration (that is, containing new Contact
header field values, as opposed to a retransmission) until they have
received a final response from the registrar for the previous one or
the previous REGISTER request has timed out.

http://www.rfc-ref.org/RFC-TEXTS/3261/chapter10.html#sub2

So I suggest is that in unregister() method, if the state is not
Registered, cancel registration and only set the new state to
Unregistered and without sending an unregister message

Matthieu

     [java] java.lang.NullPointerException
     [java] at
net.java.sip.communicator.impl.protocol.sip.security.SipSecurityManager.createCcEntryWithNewCredentials(SipSecurityManager.java:669)
     [java] at
net.java.sip.communicator.impl.protocol.sip.security.SipSecurityManager.handleChallenge(SipSecurityManager.java:180)
     [java] at
net.java.sip.communicator.impl.protocol.sip.SipRegistrarConnection.processAuthenticationChallenge(SipRegistrarConnection.java:821)
     [java] at
net.java.sip.communicator.impl.protocol.sip.SipRegistrarConnection.processResponse(SipRegistrarConnection.java:774)
     [java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.processResponse(ProtocolProviderServiceSipImpl.java:713)
     [java] at
net.java.sip.communicator.impl.protocol.sip.SipStackSharing.processResponse(SipStackSharing.java:695)
     [java] at
gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:292)
     [java] at
gov.nist.javax.sip.SipProviderImpl.handleEvent(SipProviderImpl.java:193)
     [java] at
gov.nist.javax.sip.DialogFilter.processResponse(DialogFilter.java:1433)
     [java] at
gov.nist.javax.sip.stack.SIPClientTransaction.nonInviteClientTransaction(SIPClientTransaction.java:614)
     [java] at
gov.nist.javax.sip.stack.SIPClientTransaction.processResponse(SIPClientTransaction.java:527)
     [java] at
gov.nist.javax.sip.stack.SIPClientTransaction.processResponse(SIPClientTransaction.java:1469)
     [java] at
gov.nist.javax.sip.stack.UDPMessageChannel.processMessage(UDPMessageChannel.java:550)
     [java] at
gov.nist.javax.sip.stack.UDPMessageChannel.processIncomingDataPacket(UDPMessageChannel.java:468)
     [java] at
gov.nist.javax.sip.stack.UDPMessageChannel.run(UDPMessageChannel.java:304)
     [java] at java.lang.Thread.run(Thread.java:619)

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net