Program: 5515
Project: 5515
Buggy source:
/** 
 * Deletes specified dataset module
 * @param datasetModuleId {@link DatasetModuleId} of the dataset module to delete
 * @return true if deleted successfully, false if module didn't exist: nothing to delete
 * @throws DatasetModuleConflictException when there are other modules depend on the specified one, in which casedeletion does NOT happen
 */
public boolean deleteModule(final DatasetModuleId datasetModuleId) throws DatasetModuleConflictException {
  LOG.info("String_Node_Str",datasetModuleId);
  try {
    final DatasetTypeMDS datasetTypeMDS=datasetCache.getDataset(DatasetMetaTableUtil.META_TABLE_NAME);
    final DatasetInstanceMDS datasetInstanceMDS=datasetCache.getDataset(DatasetMetaTableUtil.INSTANCE_TABLE_NAME);
    return txExecutorFactory.createExecutor(datasetCache).execute(new Callable<Boolean>(){
      @Override public Boolean call() throws DatasetModuleConflictException, IOException {
        final DatasetModuleMeta module=datasetTypeMDS.getModule(datasetModuleId);
        if (module == null) {
          return false;
        }
        if (module.getUsedByModules().size() > 0) {
          String msg=String.format("String_Node_Str",module);
          throw new DatasetModuleConflictException(msg);
        }
        Collection<DatasetSpecification> instances=datasetInstanceMDS.getByTypes(datasetModuleId.getParent(),ImmutableSet.copyOf(module.getTypes()));
        if (!instances.isEmpty()) {
          String msg=String.format("String_Node_Str",module);
          throw new DatasetModuleConflictException(msg);
        }
        for (        String usedModuleName : module.getUsesModules()) {
          DatasetModuleId usedModuleId=new DatasetModuleId(datasetModuleId.getNamespace(),usedModuleName);
          DatasetModuleMeta usedModule=datasetTypeMDS.getModule(usedModuleId);
          if (usedModule == null) {
            usedModuleId=NamespaceId.SYSTEM.datasetModule(usedModuleName);
            usedModule=datasetTypeMDS.getModule(usedModuleId);
            Preconditions.checkState(usedModule != null,"String_Node_Str",usedModuleName,datasetModuleId.getEntityName());
          }
          usedModule.removeUsedByModule(datasetModuleId.getEntityName());
          datasetTypeMDS.writeModule(usedModuleId.getParent(),usedModule);
        }
        datasetTypeMDS.deleteModule(datasetModuleId);
        try {
          Location moduleJarLocation=impersonator.doAs(datasetModuleId.getParent(),new Callable<Location>(){
            @Override public Location call() throws Exception {
              return locationFactory.create(module.getJarLocation());
            }
          }
);
          if (!moduleJarLocation.delete()) {
            LOG.debug("String_Node_Str");
          }
        }
 catch (        Exception e) {
          Throwables.propagateIfInstanceOf(e,IOException.class);
          Throwables.propagate(e);
        }
        return true;
      }
    }
);
  }
 catch (  TransactionFailureException e) {
    if (e.getCause() != null && e.getCause() instanceof DatasetModuleConflictException) {
      throw (DatasetModuleConflictException)e.getCause();
    }
    throw Throwables.propagate(e);
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
/** 
 * Deletes specified dataset module
 * @param datasetModuleId {@link DatasetModuleId} of the dataset module to delete
 * @return true if deleted successfully, false if module didn't exist: nothing to delete
 * @throws DatasetModuleConflictException when there are other modules depend on the specified one, in which casedeletion does NOT happen
 */
public boolean deleteModule(final DatasetModuleId datasetModuleId) throws DatasetModuleConflictException {
  LOG.info("String_Node_Str",datasetModuleId);
  try {
    final DatasetTypeMDS datasetTypeMDS=datasetCache.getDataset(DatasetMetaTableUtil.META_TABLE_NAME);
    final DatasetInstanceMDS datasetInstanceMDS=datasetCache.getDataset(DatasetMetaTableUtil.INSTANCE_TABLE_NAME);
    return txExecutorFactory.createExecutor(datasetCache).execute(new Callable<Boolean>(){
      @Override public Boolean call() throws DatasetModuleConflictException, IOException {
        final DatasetModuleMeta module=datasetTypeMDS.getModule(datasetModuleId);
        if (module == null) {
          return false;
        }
        if (module.getUsedByModules().size() > 0) {
          String msg=String.format("String_Node_Str",module);
          throw new DatasetModuleConflictException(msg);
        }
        Collection<DatasetSpecification> instances=datasetInstanceMDS.getByTypes(datasetModuleId.getParent(),ImmutableSet.copyOf(module.getTypes()));
        if (!instances.isEmpty()) {
          String msg=String.format("String_Node_Str",module);
          throw new DatasetModuleConflictException(msg);
        }
        for (        String usedModuleName : module.getUsesModules()) {
          DatasetModuleId usedModuleId=new DatasetModuleId(datasetModuleId.getNamespace(),usedModuleName);
          DatasetModuleMeta usedModule=datasetTypeMDS.getModule(usedModuleId);
          if (usedModule == null) {
            usedModuleId=NamespaceId.SYSTEM.datasetModule(usedModuleName);
            usedModule=datasetTypeMDS.getModule(usedModuleId);
            Preconditions.checkState(usedModule != null,"String_Node_Str",usedModuleName,datasetModuleId.getEntityName());
          }
          usedModule.removeUsedByModule(datasetModuleId.getEntityName());
          datasetTypeMDS.writeModule(usedModuleId.getParent(),usedModule);
        }
        datasetTypeMDS.deleteModule(datasetModuleId);
        try {
          Location moduleJarLocation=impersonator.doAs(datasetModuleId.getParent(),new Callable<Location>(){
            @Override public Location call() throws Exception {
              return Locations.getLocationFromAbsolutePath(locationFactory,module.getJarLocationPath());
            }
          }
);
          if (!moduleJarLocation.delete()) {
            LOG.debug("String_Node_Str");
          }
        }
 catch (        Exception e) {
          Throwables.propagateIfInstanceOf(e,IOException.class);
          Throwables.propagate(e);
        }
        return true;
      }
    }
);
  }
 catch (  TransactionFailureException e) {
    if (e.getCause() != null && e.getCause() instanceof DatasetModuleConflictException) {
      throw (DatasetModuleConflictException)e.getCause();
    }
    throw Throwables.propagate(e);
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw Throwables.propagate(e);
  }
}