Buggy code:
private SipConnector sipConnector ; public SipProtocolHandler ( ) { } public SipProtocolHandler ( SipConnector connector ) { } @ Override public void destroy ( ) throws Exception { } public Adapter getAdapter ( ) { } public Object getAttribute ( String attribute ) { } public Iterator getAttributeNames ( ) { } public void init ( ) throws Exception { } public void pause ( ) throws Exception { } public void resume ( ) throws Exception { } public void setAdapter ( Adapter adapter ) { } public void setAttribute ( String arg0 , Object arg1 ) { } @ Override public void start ( ) throws Exception { if ( SipProtocolHandler . logger . isDebugEnabled ( ) ) { SipProtocolHandler . logger . debug ( "Starting<seq2seq4repair_space>a<seq2seq4repair_space>sip<seq2seq4repair_space>protocol<seq2seq4repair_space>handler" ) ; } Integer portFromConfig = sipConnector . getPort ( ) ; String set = System . getProperty ( "jboss.service.binding.set" ) ; int setIncrememt = 0 ; if ( set != null ) { int setNumber = ( set . charAt ( ( ( set . length ( ) ) - 1 ) ) ) - '0' ; if ( ( setNumber > 0 ) && ( setNumber < 10 ) ) { setIncrememt = setNumber * 100 ; } SipProtocolHandler . logger . info ( ( ( ( "Computed<seq2seq4repair_space>port<seq2seq4repair_space>increment<seq2seq4repair_space>for<seq2seq4repair_space>MSS<seq2seq4repair_space>SIP<seq2seq4repair_space>ports<seq2seq4repair_space>is<seq2seq4repair_space>" + setIncrememt ) + "<seq2seq4repair_space>from<seq2seq4repair_space>" ) + set ) ) ; } portFromConfig += setIncrememt ; sipConnector . setPort ( portFromConfig ) ; final String ipAddress = sipConnector . getIpAddress ( ) ; final int port = sipConnector . getPort ( ) ; final String signalingTransport = sipConnector . getTransport ( ) ; try { String globalIpAddress = null ; int globalPort = - 1 ; boolean useStun = sipConnector . isUseStun ( ) ; if ( useStun ) { if ( InetAddress . getByName ( ipAddress ) . isLoopbackAddress ( ) ) { SipProtocolHandler . logger . warn ( "The<seq2seq4repair_space>Ip<seq2seq4repair_space>address<seq2seq4repair_space>provided<seq2seq4repair_space>is<seq2seq4repair_space>the<seq2seq4repair_space>loopback<seq2seq4repair_space>address,<seq2seq4repair_space>stun<seq2seq4repair_space>won't<seq2seq4repair_space>be<seq2seq4repair_space>enabled<seq2seq4repair_space>for<seq2seq4repair_space>it" ) ; } else { DatagramSocket randomSocket = initRandomPortSocket ( ) ; int randomPort = randomSocket . getLocalPort ( ) ; randomSocket . disconnect ( ) ; randomSocket . close ( ) ; randomSocket = null ; StunAddress localStunAddress = new StunAddress ( ipAddress , randomPort ) ; StunAddress serverStunAddress = new StunAddress ( sipConnector . getStunServerAddress ( ) , sipConnector . getStunServerPort ( ) ) ; NetworkConfigurationDiscoveryProcess addressDiscovery = new NetworkConfigurationDiscoveryProcess ( localStunAddress , serverStunAddress ) ; addressDiscovery . start ( ) ; StunDiscoveryReport report = addressDiscovery . determineAddress ( ) ; if ( ( report . getPublicAddress ( ) ) != null ) { globalIpAddress = report . getPublicAddress ( ) . getSocketAddress ( ) . getAddress ( ) . getHostAddress ( ) ; globalPort = report . getPublicAddress ( ) . getPort ( ) ; } else { useStun = false ; SipProtocolHandler . logger . error ( "Stun<seq2seq4repair_space>discovery<seq2seq4repair_space>failed<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>a<seq2seq4repair_space>valid<seq2seq4repair_space>public<seq2seq4repair_space>ip<seq2seq4repair_space>address,<seq2seq4repair_space>disabling<seq2seq4repair_space>stun<seq2seq4repair_space>!" ) ; } SipProtocolHandler . logger . info ( ( "Stun<seq2seq4repair_space>report<seq2seq4repair_space>=<seq2seq4repair_space>" + report ) ) ; addressDiscovery . shutDown ( ) ; } } ListeningPointExt listeningPoint = ( ( ListeningPointExt ) ( sipStack . createListeningPoint ( ipAddress , port , signalingTransport ) ) ) ; if ( useStun ) { listeningPoint . setSentBy ( ( ( globalIpAddress + ":" ) + port ) ) ; } boolean createSipProvider = false ; SipProvider sipProvider = null ; <START_BUG> if ( sipStack . getSipProviders ( ) . hasNext ( ) ) { <END_BUG> sipProvider = ( ( SipProvider ) ( sipStack . getSipProviders ( ) . next ( ) ) ) ; for ( ListeningPoint listeningPointTemp : sipProvider . getListeningPoints ( ) ) { if ( ! ( ( listeningPointTemp . getIPAddress ( ) . equalsIgnoreCase ( listeningPoint . getIPAddress ( ) ) ) && ( ( listeningPointTemp . getPort ( ) ) == ( listeningPoint . getPort ( ) ) ) ) ) { createSipProvider = true ; break ; } } } else { createSipProvider = true ; } if ( createSipProvider ) { sipProvider = sipStack . createSipProvider ( listeningPoint ) ; } else { sipProvider . addListeningPoint ( listeningPoint ) ; } extendedListeningPoint = new ExtendedListeningPoint ( sipProvider , listeningPoint , sipConnector ) ; extendedListeningPoint . setUseStaticAddress ( false ) ; extendedListeningPoint . setGlobalIpAddress ( globalIpAddress ) ; extendedListeningPoint . setGlobalPort ( globalPort ) ; setAttribute ( ExtendedListeningPoint . class . getSimpleName ( ) , extendedListeningPoint ) ; SipApplicationDispatcher sipApplicationDispatcher = ( ( SipApplicationDispatcher ) ( getAttribute ( SipApplicationDispatcher . class . getSimpleName ( ) ) ) ) ; if ( sipApplicationDispatcher != null ) { if ( ( sipConnector . getStaticServerAddress ( ) ) != null ) { sipApplicationDispatcher . addHostName ( ( ( ( sipConnector . getStaticServerAddress ( ) ) + ":" ) + ( sipConnector . getStaticServerPort ( ) ) ) ) ; if ( SipProtocolHandler . logger . isDebugEnabled ( ) ) { SipProtocolHandler . logger . debug ( ( "Adding<seq2seq4repair_space>hostname<seq2seq4repair_space>for<seq2seq4repair_space>IP<seq2seq4repair_space>load<seq2seq4repair_space>balancer<seq2seq4repair_space>" + ( sipConnector . getStaticServerAddress ( ) ) ) ) ; } } if ( SipProtocolHandler . logger . isDebugEnabled ( ) ) { SipProtocolHandler . logger . debug ( ( "Adding<seq2seq4repair_space>the<seq2seq4repair_space>Sip<seq2seq4repair_space>Application<seq2seq4repair_space>Dispatcher<seq2seq4repair_space>as<seq2seq4repair_space>a<seq2seq4repair_space>sip<seq2seq4repair_space>listener<seq2seq4repair_space>for<seq2seq4repair_space>connector<seq2seq4repair_space>listening<seq2seq4repair_space>on<seq2seq4repair_space>port<seq2seq4repair_space>" + port ) ) ; } sipProvider . addSipListener ( sipApplicationDispatcher ) ; sipApplicationDispatcher . getSipNetworkInterfaceManager ( ) . addExtendedListeningPoint ( extendedListeningPoint ) ; } SipProtocolHandler . logger . info ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "Sip<seq2seq4repair_space>Connector<seq2seq4repair_space>started<seq2seq4repair_space>on<seq2seq4repair_space>ip<seq2seq4repair_space>address:<seq2seq4repair_space>" + ipAddress ) + ",<seq2seq4repair_space>port<seq2seq4repair_space>" ) + port ) + ",<seq2seq4repair_space>transport<seq2seq4repair_space>" ) + signalingTransport ) + ",<seq2seq4repair_space>useStun<seq2seq4repair_space>" ) + ( sipConnector . isUseStun ( ) ) ) + ",<seq2seq4repair_space>stunAddress<seq2seq4repair_space>" ) + ( sipConnector . getStunServerAddress ( ) ) ) + ",<seq2seq4repair_space>stunPort<seq2seq4repair_space>:<seq2seq4repair_space>" ) + ( sipConnector . getStunServerPort ( ) ) ) + ",<seq2seq4repair_space>useStaticAddress:<seq2seq4repair_space>" ) + ( sipConnector . isUseStaticAddress ( ) ) ) + ",<seq2seq4repair_space>staticServerAddress<seq2seq4repair_space>" ) + ( sipConnector . getStaticServerAddress ( ) ) ) + ",<seq2seq4repair_space>staticServerPort<seq2seq4repair_space>" ) + ( sipConnector . getStaticServerPort ( ) ) ) ) ;

Fix:
if ( ( ( sipStack . getSipProviders ( ) ) != null ) && ( sipStack . getSipProviders ( ) . hasNext ( ) ) ) {