Program: 29329
Project: 29329
Buggy source:
private void sortAndDispatch(final List<PropertyChangeEvent> events,final long whenChanged){
  final List<ConfigBean> newConfigBeans=new ArrayList<ConfigBean>();
  final List<PropertyChangeEvent> remainingEvents=new ArrayList<PropertyChangeEvent>();
  for (  final PropertyChangeEvent event : events) {
    final Object oldValue=event.getOldValue();
    final Object newValue=event.getNewValue();
    final Object source=event.getSource();
    final String propertyName=event.getPropertyName();
    if (oldValue == null && newValue instanceof ConfigBeanProxy) {
      final ConfigBeanProxy cbp=(ConfigBeanProxy)newValue;
      final ConfigBean cb=asConfigBean(ConfigBean.unwrap(cbp));
      final Class<? extends ConfigBeanProxy> proxyClass=cb.getProxyType();
      final boolean doWait=amxIsRunning();
      if (handleConfigBean(cb,doWait)) {
        newConfigBeans.add(cb);
      }
    }
 else     if (newValue == null && oldValue instanceof ConfigBeanProxy && amxIsRunning()) {
      final ConfigBeanProxy cbp=(ConfigBeanProxy)oldValue;
      final ConfigBean cb=asConfigBean(ConfigBean.unwrap(cbp));
      configBeanRemoved(cb);
    }
 else {
      remainingEvents.add(event);
    }
  }
  if (amxIsRunning()) {
    for (    final PropertyChangeEvent event : remainingEvents) {
      final Object oldValue=event.getOldValue();
      final Object newValue=event.getNewValue();
      final Object source=event.getSource();
      final String propertyName=event.getPropertyName();
      if (source instanceof ConfigBeanProxy) {
        final ConfigBeanProxy cbp=(ConfigBeanProxy)source;
        final ConfigBean cb=asConfigBean(ConfigBean.unwrap(cbp));
        if (mRegistry.getObjectName(cb) == null) {
          if (!newConfigBeans.contains(cb)) {
            if (handleConfigBean(cb,false)) {
              newConfigBeans.add(cb);
            }
          }
        }
 else {
          issueAttributeChange(cb,propertyName,oldValue,newValue,whenChanged);
        }
      }
 else {
        debug("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void sortAndDispatch(final List<PropertyChangeEvent> events,final long whenChanged){
  final List<ConfigBean> newConfigBeans=new ArrayList<ConfigBean>();
  final List<PropertyChangeEvent> remainingEvents=new ArrayList<PropertyChangeEvent>();
  for (  final PropertyChangeEvent event : events) {
    final Object oldValue=event.getOldValue();
    final Object newValue=event.getNewValue();
    if (oldValue == null && newValue instanceof ConfigBeanProxy) {
      final ConfigBeanProxy cbp=(ConfigBeanProxy)newValue;
      final ConfigBean cb=asConfigBean(ConfigBean.unwrap(cbp));
      final boolean doWait=amxIsRunning();
      if (handleConfigBean(cb,doWait)) {
        newConfigBeans.add(cb);
      }
    }
 else     if (newValue == null && oldValue instanceof ConfigBeanProxy && amxIsRunning()) {
      final ConfigBeanProxy cbp=(ConfigBeanProxy)oldValue;
      final ConfigBean cb=asConfigBean(ConfigBean.unwrap(cbp));
      configBeanRemoved(cb);
    }
 else {
      remainingEvents.add(event);
    }
  }
  if (amxIsRunning()) {
    for (    final PropertyChangeEvent event : remainingEvents) {
      final Object oldValue=event.getOldValue();
      final Object newValue=event.getNewValue();
      final Object source=event.getSource();
      final String propertyName=event.getPropertyName();
      if (source instanceof ConfigBeanProxy) {
        final ConfigBeanProxy cbp=(ConfigBeanProxy)source;
        final ConfigBean cb=asConfigBean(ConfigBean.unwrap(cbp));
        if (mRegistry.getObjectName(cb) == null) {
          if (!newConfigBeans.contains(cb)) {
            if (handleConfigBean(cb,false)) {
              newConfigBeans.add(cb);
            }
          }
        }
 else {
          issueAttributeChange(cb,propertyName,oldValue,newValue,whenChanged);
        }
      }
 else {
        debug("String_Node_Str");
      }
    }
  }
}