#vulnerable code 
                                void checkIfFinishedUp()
    {
        if (State.FINISHING_UP.equals(this.state))
        {
            synchronized (this.participants)
            {
                for (Participant participant : participants.values())
                {
                    if (!participant.isCompleted())
                    {
                        return;
                    }
                }
            }

            if (logger.isDebugEnabled())
                logger.debug(getDebugName() + ": transcriber is now finished");

            this.state = State.FINISHED;
            for (TranscriptionListener listener : listeners)
            {
                listener.completed();
            }
        }
    } 
                            #location 3 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                void checkIfFinishedUp()
    {
        if (State.FINISHING_UP.equals(this.state))
        {
            synchronized (this.participants)
            {
                for (Participant participant : participants.values())
                {
                    if (!participant.isCompleted())
                    {
                        logger.debug(
                            participant.getDebugName()
                                + " is still not finished");
                        return;
                    }
                }
            }

            if (logger.isDebugEnabled())
                logger.debug(getDebugName() + ": transcriber is now finished");

            this.state = State.FINISHED;
            for (TranscriptionListener listener : listeners)
            {
                listener.completed();
            }
        }
    }