#vulnerable code 
                                @Override
    public void subscribed(int id, Subscription s) {
        if (subscriptionsBCM.contains(s)) {
            /* Check if the ID was already subscribed in any subscription */
            if(!subscribedIDs.contains(id)) {
                subscribedIDs.add(id);
                if (bcmConnection != null && bcmConnection.isConnected()) {
                    bcmConnection.subscribeTo(id, 0, 0);
                } else {
                    logger.log(Level.WARNING, "A BCM subscription was made but no BCM connection is present");
                }
            }
        }
    } 
                            #location 7 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                @Override
    public void subscribed(int id, Subscription s) {
        if (subscriptionsBCM.contains(s)) {
            /* Check if the ID was already subscribed in any subscription */
            synchronized(subscribedIDs) {
                if(!subscribedIDs.contains(id)) {
                    subscribedIDs.add(id);
                    if (bcmConnection != null && bcmConnection.isConnected()) {
                        bcmConnection.subscribeTo(id, 0, 0);
                    } else {
                        logger.log(Level.WARNING, "A BCM subscription was made but no BCM connection is present");
                    }
                }
            }
        } else {
            logger.log(Level.WARNING, "Unregistered subscription tried to subscribe!");
        }
    }