Program: 151520
Project: 151520
Buggy source:
@Override public Forge start(ClassLoader loader){
  assertNotAlive();
  this.loader=loader;
  for (  ContainerLifecycleListener listener : ServiceLoader.load(ContainerLifecycleListener.class,loader)) {
    ListenerRegistration<ContainerLifecycleListener> registration=addContainerLifecycleListener(listener);
    loadedListenerRegistrations.add(registration);
  }
  fireBeforeContainerStartedEvent(loader);
  if (!alive) {
    try {
      alive=true;
      do {
        boolean dirty=false;
        if (!isStartingAddons()) {
          for (          AddonRepository repository : repositories) {
            int repoVersion=repository.getVersion();
            if (repoVersion > lastRepoVersionSeen.get(repository)) {
              lastRepoVersionSeen.put(repository,repoVersion);
              dirty=true;
              for (              Addon addon : registry.getAddons()) {
                boolean enabled=false;
                if (repository.isEnabled(addon.getId())) {
                  enabled=true;
                }
                if (!enabled && addon.getStatus().isStarted()) {
                  try {
                    registry.stop(addon);
                  }
 catch (                  Exception e) {
                    logger.log(Level.SEVERE,"String_Node_Str",e);
                  }
                }
              }
            }
          }
          if (dirty) {
            try {
              registry.startAll();
            }
 catch (            Exception e) {
              logger.log(Level.SEVERE,"String_Node_Str",e);
            }
          }
        }
        Thread.sleep(100);
      }
 while (alive && serverMode);
      while (alive && isStartingAddons()) {
        Thread.sleep(100);
      }
    }
 catch (    Exception e) {
      logger.log(Level.SEVERE,"String_Node_Str",e);
    }
 finally {
      fireBeforeContainerStoppedEvent(loader);
      registry.stopAll();
    }
  }
  fireAfterContainerStoppedEvent(loader);
  for (  ListenerRegistration<ContainerLifecycleListener> registation : loadedListenerRegistrations) {
    registation.removeListener();
  }
  return this;
}

Fixed version (ground truth):
@Override public Forge start(ClassLoader loader){
  assertNotAlive();
  this.loader=loader;
  for (  ContainerLifecycleListener listener : ServiceLoader.load(ContainerLifecycleListener.class,loader)) {
    ListenerRegistration<ContainerLifecycleListener> registration=addContainerLifecycleListener(listener);
    loadedListenerRegistrations.add(registration);
  }
  fireBeforeContainerStartedEvent(loader);
  if (!alive) {
    try {
      alive=true;
      do {
        boolean dirty=false;
        if (!isStartingAddons()) {
          Set<AddonId> enabled=new HashSet<AddonId>();
          for (          AddonRepository repository : repositories) {
            int repoVersion=repository.getVersion();
            if (repoVersion > lastRepoVersionSeen.get(repository)) {
              logger.log(Level.INFO,"String_Node_Str" + repository + "String_Node_Str");
              lastRepoVersionSeen.put(repository,repoVersion);
              dirty=true;
            }
            enabled.addAll(repository.listEnabled());
          }
          if (dirty) {
            for (            Addon addon : registry.getAddons()) {
              if (!enabled.contains(addon.getId()) && addon.getStatus().isStarted()) {
                try {
                  registry.stop(addon);
                }
 catch (                Exception e) {
                  logger.log(Level.SEVERE,"String_Node_Str",e);
                }
              }
            }
            try {
              registry.startAll();
            }
 catch (            Exception e) {
              logger.log(Level.SEVERE,"String_Node_Str",e);
            }
          }
        }
        Thread.sleep(100);
      }
 while (alive && serverMode);
      while (alive && isStartingAddons()) {
        Thread.sleep(100);
      }
    }
 catch (    Exception e) {
      logger.log(Level.SEVERE,"String_Node_Str",e);
    }
 finally {
      fireBeforeContainerStoppedEvent(loader);
      registry.stopAll();
    }
  }
  fireAfterContainerStoppedEvent(loader);
  for (  ListenerRegistration<ContainerLifecycleListener> registation : loadedListenerRegistrations) {
    registation.removeListener();
  }
  return this;
}