#vulnerable code 
                                public void create( Session session ) {
        assignId( session );
        Serializable id = session.getSessionId();
        if ( id == null ) {
            String msg = "session must be assigned an id.  Please check assignId( Session s ) " +
                         "implementation.";
            throw new IllegalStateException( msg );
        }

        if ( activeSessions.containsKey( id ) || stoppedSessions.containsKey( id ) ) {
            String msg = "There is an existing session already created with session id [" +
                         id + "].  Session Id's must be unique.";
            throw new IllegalArgumentException( msg );
        }

        synchronized ( activeSessions ) {
            activeSessions.put( id, session );
        }
    } 
                            #location 2 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public void create( Session session ) {

        Serializable id = session.getSessionId();
        if ( id == null ) {
            String msg = "session must be assigned an id.  Please check assignId( Session s ) " +
                         "implementation.";
            throw new IllegalStateException( msg );
        }

        if ( activeSessions.containsKey( id ) || stoppedSessions.containsKey( id ) ) {
            String msg = "There is an existing session already created with session id [" +
                         id + "].  Session Id's must be unique.";
            throw new IllegalArgumentException( msg );
        }

        synchronized ( activeSessions ) {
            activeSessions.put( id, session );
        }
    }