#fixed code
                                ChannelManager(AsteriskServerImpl server)
    {
        this.server = server;
    }
#vulnerable code 
                                void handleNewCallerIdEvent(NewCallerIdEvent event)
    {
        AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());

        if (channel == null)
        {
            // NewCallerIdEvent can occur for an existing channel that now has a different unique id (originate with Local/)
            channel = getChannelImplByNameAndActive(event.getChannel());
	          idChanged(channel, event);

            if (channel == null)
            {
                // NewCallerIdEvent can occur before NewChannelEvent
                channel = addNewChannel(
                        event.getUniqueId(), event.getChannel(), event.getDateReceived(),
                        event.getCallerIdNum(), event.getCallerIdName(),
                        ChannelState.DOWN, null /* account code not available */);
            }
        }

        synchronized (channel)
        {
            channel.setCallerId(new CallerId(event.getCallerIdName(), event.getCallerIdNum()));
        }
    } 
                            #location 9 
                            #vulnerability type THREAD_SAFETY_VIOLATION