Program: 132106
Project: 132106
Buggy source:
/** 
 * This method is called whenever there is change in a SF Schedule Type. Before doing any changes it takes a global lock in order to ensure it is the only writer.
 * @param change
 */
@Override public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>,DataObject> change){
  printTraceStart(LOG);
  if (SfcConcurrencyAPI.getLock()) {
    try {
      Map<InstanceIdentifier<?>,DataObject> dataOriginalDataObject=change.getOriginalData();
      for (      Map.Entry<InstanceIdentifier<?>,DataObject> entry : dataOriginalDataObject.entrySet()) {
        if (entry.getValue() instanceof ServiceFunctionSchedulerType) {
          ServiceFunctionSchedulerType origServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)entry.getValue();
          LOG.debug("String_Node_Str",origServiceFunctionSchedulerType.getType(),origServiceFunctionSchedulerType.getName());
        }
      }
      Map<InstanceIdentifier<?>,DataObject> dataCreatedObject=change.getCreatedData();
      for (      Map.Entry<InstanceIdentifier<?>,DataObject> entry : dataCreatedObject.entrySet()) {
        if (entry.getValue() instanceof ServiceFunctionSchedulerType) {
          ServiceFunctionSchedulerType createdServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)entry.getValue();
          Object[] serviceFunctionSchedulerTypeObj={createdServiceFunctionSchedulerType};
          Class[] serviceFunctionSchedulerTypeClass={ServiceFunctionSchedulerType.class};
          Future future=odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI.getPut(serviceFunctionSchedulerTypeObj,serviceFunctionSchedulerTypeClass));
          try {
            LOG.debug("String_Node_Str",future.get());
          }
 catch (          InterruptedException e) {
            LOG.warn("String_Node_Str",e);
          }
catch (          ExecutionException e) {
            LOG.warn("String_Node_Str",e);
          }
        }
      }
      Set<InstanceIdentifier<?>> dataRemovedConfigurationIID=change.getRemovedPaths();
      for (      InstanceIdentifier instanceIdentifier : dataRemovedConfigurationIID) {
        DataObject dataObject=dataOriginalDataObject.get(instanceIdentifier);
        if (dataObject instanceof ServiceFunctionSchedulerType) {
          ServiceFunctionSchedulerType origServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)dataObject;
          Object[] serviceFunctionSchedulerTypeObj={origServiceFunctionSchedulerType};
          Class[] serviceFunctionSchedulerTypeClass={ServiceFunctionSchedulerType.class};
          Future future=odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI.getDelete(serviceFunctionSchedulerTypeObj,serviceFunctionSchedulerTypeClass));
          try {
            LOG.debug("String_Node_Str",future.get());
          }
 catch (          InterruptedException e) {
            LOG.warn("String_Node_Str",e);
          }
catch (          ExecutionException e) {
            LOG.warn("String_Node_Str",e);
          }
        }
      }
      Map<InstanceIdentifier<?>,DataObject> dataUpdatedConfigurationObject=change.getUpdatedData();
      for (      Map.Entry<InstanceIdentifier<?>,DataObject> entry : dataUpdatedConfigurationObject.entrySet()) {
        if ((entry.getValue() instanceof ServiceFunctionSchedulerType) && (!(dataCreatedObject.containsKey(entry.getKey())))) {
          DataObject dataObject=dataOriginalDataObject.get(entry.getKey());
          ServiceFunctionSchedulerType origServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)dataObject;
          Object[] serviceFunctionSchedulerTypeObj={origServiceFunctionSchedulerType};
          Class[] serviceFunctionSchedulerTypeClass={ServiceFunctionSchedulerType.class};
          ServiceFunctionSchedulerType updatedServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)entry.getValue();
          if (!updatedServiceFunctionSchedulerType.isEnabled() == true) {
            Object[] serviceFunctionSchedulerTypesObj={};
            Class[] serviceFunctionSchedulerTypesClass={};
            Future future=odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI.getReadAll(serviceFunctionSchedulerTypesObj,serviceFunctionSchedulerTypesClass));
            try {
              LOG.debug("String_Node_Str",future.get());
              ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes=(ServiceFunctionSchedulerTypes)future.get();
              List<ServiceFunctionSchedulerType> sfScheduleTypeList=serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
              for (              ServiceFunctionSchedulerType sfst : sfScheduleTypeList) {
                if (sfst.isEnabled() == true) {
                  break;
                }
              }
            }
 catch (            InterruptedException e) {
              LOG.warn("String_Node_Str",e);
            }
catch (            ExecutionException e) {
              LOG.warn("String_Node_Str",e);
            }
            future=odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI.getDelete(serviceFunctionSchedulerTypeObj,serviceFunctionSchedulerTypeClass));
            try {
              LOG.debug("String_Node_Str",future.get());
            }
 catch (            InterruptedException e) {
              LOG.warn("String_Node_Str",e);
            }
catch (            ExecutionException e) {
              LOG.warn("String_Node_Str",e);
            }
            serviceFunctionSchedulerTypeObj[0]=updatedServiceFunctionSchedulerType;
            serviceFunctionSchedulerTypeClass[0]=ServiceFunctionSchedulerType.class;
            future=odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI.getPut(serviceFunctionSchedulerTypeObj,serviceFunctionSchedulerTypeClass));
            try {
              LOG.debug("String_Node_Str",future.get());
            }
 catch (            InterruptedException e) {
              LOG.warn("String_Node_Str",e);
            }
catch (            ExecutionException e) {
              LOG.warn("String_Node_Str",e);
            }
          }
        }
      }
    }
  finally {
      SfcConcurrencyAPI.releaseLock();
    }
  }
 else {
    LOG.error("String_Node_Str",Thread.currentThread().getStackTrace()[1]);
  }
  printTraceStop(LOG);
}

Fixed version (ground truth):
/** 
 * This method is called whenever there is change in a SF Schedule Type. Before doing any changes it takes a global lock in order to ensure it is the only writer.
 * @param change
 */
@Override public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>,DataObject> change){
  printTraceStart(LOG);
  if (SfcConcurrencyAPI.getLock()) {
    try {
      Map<InstanceIdentifier<?>,DataObject> dataOriginalDataObject=change.getOriginalData();
      for (      Map.Entry<InstanceIdentifier<?>,DataObject> entry : dataOriginalDataObject.entrySet()) {
        if (entry.getValue() instanceof ServiceFunctionSchedulerType) {
          ServiceFunctionSchedulerType origServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)entry.getValue();
          LOG.debug("String_Node_Str",origServiceFunctionSchedulerType.getType(),origServiceFunctionSchedulerType.getName());
        }
      }
      Map<InstanceIdentifier<?>,DataObject> dataCreatedObject=change.getCreatedData();
      for (      Map.Entry<InstanceIdentifier<?>,DataObject> entry : dataCreatedObject.entrySet()) {
        if (entry.getValue() instanceof ServiceFunctionSchedulerType) {
          ServiceFunctionSchedulerType createdServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)entry.getValue();
          LOG.debug("String_Node_Str",createdServiceFunctionSchedulerType.getType(),createdServiceFunctionSchedulerType.getName());
          try {
            if (createdServiceFunctionSchedulerType.isEnabled() == true) {
              isCreateTrue=true;
              Object[] sfstObj={};
              Class[] sfstClass={};
              SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI=SfcProviderScheduleTypeAPI.getReadAll(sfstObj,sfstClass);
              Future future=odlSfc.getExecutor().submit(sfcProviderScheduleTypeAPI);
              if (future.get() != null) {
                ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes=(ServiceFunctionSchedulerTypes)future.get();
                List<ServiceFunctionSchedulerType> sfScheduleTypeList=serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
                for (                ServiceFunctionSchedulerType sfst : sfScheduleTypeList) {
                  if (sfst.isEnabled() == true) {
                    if (!(sfst.getType().equals(createdServiceFunctionSchedulerType.getType()))) {
                      ServiceFunctionSchedulerType sfstUpdate=new ServiceFunctionSchedulerTypeBuilder().setName(sfst.getName()).setType(sfst.getType()).setEnabled(false).build();
                      Object[] sfstObjUpdate={sfstUpdate};
                      Class[] sfstClassUpdate={ServiceFunctionSchedulerType.class};
                      future=odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI.getPut(sfstObjUpdate,sfstClassUpdate));
                      break;
                    }
                  }
                }
              }
            }
          }
 catch (          InterruptedException e) {
            LOG.warn("String_Node_Str",e);
          }
catch (          ExecutionException e) {
            LOG.warn("String_Node_Str",e);
          }
        }
      }
      Set<InstanceIdentifier<?>> dataRemovedConfigurationIID=change.getRemovedPaths();
      for (      InstanceIdentifier instanceIdentifier : dataRemovedConfigurationIID) {
        DataObject dataObject=dataOriginalDataObject.get(instanceIdentifier);
        if (dataObject instanceof ServiceFunctionSchedulerType) {
          ServiceFunctionSchedulerType origServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)dataObject;
          LOG.debug("String_Node_Str",origServiceFunctionSchedulerType.getType(),origServiceFunctionSchedulerType.getName());
        }
      }
      Map<InstanceIdentifier<?>,DataObject> dataUpdatedConfigurationObject=change.getUpdatedData();
      for (      Map.Entry<InstanceIdentifier<?>,DataObject> entry : dataUpdatedConfigurationObject.entrySet()) {
        if ((entry.getValue() instanceof ServiceFunctionSchedulerType) && (!(dataCreatedObject.containsKey(entry.getKey())))) {
          ServiceFunctionSchedulerType updatedServiceFunctionSchedulerType=(ServiceFunctionSchedulerType)entry.getValue();
          LOG.debug("String_Node_Str",updatedServiceFunctionSchedulerType.getType(),updatedServiceFunctionSchedulerType.getName());
          try {
            if (isCreateTrue == false) {
              if (updatedServiceFunctionSchedulerType.isEnabled() == true) {
                Object[] sfstObj={};
                Class[] sfstClass={};
                SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI=SfcProviderScheduleTypeAPI.getReadAll(sfstObj,sfstClass);
                Future future=odlSfc.getExecutor().submit(sfcProviderScheduleTypeAPI);
                if (future.get() != null) {
                  ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes=(ServiceFunctionSchedulerTypes)future.get();
                  List<ServiceFunctionSchedulerType> sfScheduleTypeList=serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
                  for (                  ServiceFunctionSchedulerType sfst : sfScheduleTypeList) {
                    if (sfst.isEnabled() == true) {
                      if (!(sfst.getType().equals(updatedServiceFunctionSchedulerType.getType()))) {
                        ServiceFunctionSchedulerType sfstUpdate=new ServiceFunctionSchedulerTypeBuilder().setName(sfst.getName()).setType(sfst.getType()).setEnabled(false).build();
                        Object[] serviceFunctionSchedulerTypeObj={sfstUpdate};
                        Class[] serviceFunctionSchedulerTypeClass={ServiceFunctionSchedulerType.class};
                        future=odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI.getPut(serviceFunctionSchedulerTypeObj,serviceFunctionSchedulerTypeClass));
                        break;
                      }
                    }
                  }
                }
              }
            }
 else             if (isCreateTrue == true) {
              isCreateTrue=false;
            }
          }
 catch (          InterruptedException e) {
            LOG.warn("String_Node_Str",e);
          }
catch (          ExecutionException e) {
            LOG.warn("String_Node_Str",e);
          }
        }
      }
    }
  finally {
      SfcConcurrencyAPI.releaseLock();
    }
  }
 else {
    LOG.error("String_Node_Str",Thread.currentThread().getStackTrace()[1]);
  }
  printTraceStop(LOG);
}