Program: 126965
Project: 126965
Buggy source:
public boolean validateAction(RepositoryNode sourceNode,RepositoryNode targetNode){
  if (sourceNode == null) {
    return false;
  }
  if (sourceNode.getType() != ENodeType.REPOSITORY_ELEMENT) {
    return false;
  }
  IRepositoryViewObject objectToCopy=sourceNode.getObject();
  if (objectToCopy.getId() == null) {
    return false;
  }
  try {
    if (ProxyRepositoryFactory.getInstance().getLastVersion(objectToCopy.getId()) == null) {
      return false;
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
  if (objectToCopy != null && objectToCopy.getId() == null) {
    return false;
  }
  if (objectToCopy == null || objectToCopy.getRepositoryStatus() == ERepositoryStatus.DELETED || ProxyRepositoryFactory.getInstance().getStatus(sourceNode.getObject()) == ERepositoryStatus.DELETED) {
    return false;
  }
  if (objectToCopy.getRepositoryObjectType() == ERepositoryObjectType.ROUTINES) {
    Property property=objectToCopy.getProperty();
    RoutineItem item=(RoutineItem)property.getItem();
    return !item.isBuiltIn();
  }
  if (objectToCopy.getRepositoryObjectType() == ERepositoryObjectType.SQLPATTERNS) {
    Property property=objectToCopy.getProperty();
    SQLPatternItem item=(SQLPatternItem)property.getItem();
    return !item.isSystem();
  }
  if (PluginChecker.isCDCPluginLoaded()) {
    ICDCProviderService cdcService=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
    if (cdcService != null && (cdcService.isSubscriberTableNode(sourceNode) || cdcService.isSystemSubscriberTable(sourceNode))) {
      return false;
    }
  }
  if (targetNode == null) {
    return true;
  }
  if (targetNode.getType() == ENodeType.REPOSITORY_ELEMENT || targetNode.getType() == ENodeType.SIMPLE_FOLDER || targetNode.getType() == ENodeType.SYSTEM_FOLDER) {
    return ((ERepositoryObjectType)targetNode.getProperties(EProperties.CONTENT_TYPE)) == objectToCopy.getRepositoryObjectType();
  }
  return false;
}

Fixed version (ground truth):
public boolean validateAction(RepositoryNode sourceNode,RepositoryNode targetNode){
  if (sourceNode == null) {
    return false;
  }
  if (targetNode != null && targetNode.getType() == ENodeType.REPOSITORY_ELEMENT && targetNode.getContentType() != ERepositoryObjectType.METADATA_VALIDATION_RULES) {
    targetNode=targetNode.getParent();
  }
  if (sourceNode.getType() != ENodeType.REPOSITORY_ELEMENT) {
    return false;
  }
  IRepositoryViewObject objectToCopy=sourceNode.getObject();
  if (objectToCopy.getId() == null) {
    return false;
  }
  try {
    if (ProxyRepositoryFactory.getInstance().getLastVersion(objectToCopy.getId()) == null) {
      return false;
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
  if (objectToCopy != null && objectToCopy.getId() == null) {
    return false;
  }
  if (objectToCopy == null || objectToCopy.getRepositoryStatus() == ERepositoryStatus.DELETED || ProxyRepositoryFactory.getInstance().getStatus(sourceNode.getObject()) == ERepositoryStatus.DELETED) {
    return false;
  }
  if (objectToCopy.getRepositoryObjectType() == ERepositoryObjectType.ROUTINES) {
    Property property=objectToCopy.getProperty();
    RoutineItem item=(RoutineItem)property.getItem();
    return !item.isBuiltIn();
  }
  if (objectToCopy.getRepositoryObjectType() == ERepositoryObjectType.SQLPATTERNS) {
    Property property=objectToCopy.getProperty();
    SQLPatternItem item=(SQLPatternItem)property.getItem();
    return !item.isSystem();
  }
  if (PluginChecker.isCDCPluginLoaded()) {
    ICDCProviderService cdcService=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
    if (cdcService != null && (cdcService.isSubscriberTableNode(sourceNode) || cdcService.isSystemSubscriberTable(sourceNode))) {
      return false;
    }
  }
  if (targetNode == null) {
    return true;
  }
  if (targetNode.getType() == ENodeType.REPOSITORY_ELEMENT || targetNode.getType() == ENodeType.SIMPLE_FOLDER || targetNode.getType() == ENodeType.SYSTEM_FOLDER) {
    return ((ERepositoryObjectType)targetNode.getProperties(EProperties.CONTENT_TYPE)) == objectToCopy.getRepositoryObjectType();
  }
  return false;
}