Program: 129342
Project: 129342
Buggy source:
/** 
 * DOC Administrator Comment method "validateAction".
 * @param sourceNode
 * @param targetNode
 * @return
 */
public boolean validateAction(RepositoryNode sourceNode,RepositoryNode targetNode,boolean isDnd){
  if (sourceNode == null) {
    return false;
  }
  IRepositoryViewObject objectToCopy=sourceNode.getObject();
  if (isDnd && objectToCopy != null && ProxyRepositoryFactory.getInstance().getStatus(objectToCopy) == ERepositoryStatus.DELETED) {
    return false;
  }
  if (sourceNode.getType() == ENodeType.SIMPLE_FOLDER && sourceNode.getContentType() == ERepositoryObjectType.JOB_DOC) {
    return false;
  }
  if (sourceNode.getType() == ENodeType.SIMPLE_FOLDER && sourceNode.getContentType() == ERepositoryObjectType.JOBLET_DOC) {
    return false;
  }
  if (targetNode == null) {
switch (sourceNode.getType()) {
case REPOSITORY_ELEMENT:
case SIMPLE_FOLDER:
      return true;
default :
    return false;
}
}
if (sourceNode.equals(targetNode)) {
return false;
}
sourcePath=RepositoryNodeUtilities.getPath(sourceNode);
targetPath=RepositoryNodeUtilities.getPath(targetNode);
if (sourceNode.getType() == ENodeType.REPOSITORY_ELEMENT) {
isGenericSchema=targetNode.getContentType() == ERepositoryObjectType.METADATA_GENERIC_SCHEMA && sourceNode.getProperties(EProperties.CONTENT_TYPE) != ERepositoryObjectType.METADATA_GENERIC_SCHEMA && (sourceNode.getObject() instanceof MetadataTableRepositoryObject);
if (!isGenericSchema && !ResourceUtils.isCorrectDestination(sourcePath,targetPath,false)) {
  return false;
}
switch (targetNode.getType()) {
case SYSTEM_FOLDER:
case SIMPLE_FOLDER:
  boolean booleanValue=((ERepositoryObjectType)targetNode.getProperties(EProperties.CONTENT_TYPE)) == objectToCopy.getRepositoryObjectType();
if (isGenericSchema) {
  return true;
}
 else {
  return booleanValue;
}
case STABLE_SYSTEM_FOLDER:
boolean isJoblet=sourceNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET;
boolean isBin=targetNode.isBin();
if (isBin && isJoblet) {
IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
List<JobletReferenceBean> checkRepository=DeleteAction.checkRepositoryNodeFromProcess(factory,null,sourceNode);
DeleteActionCache.getInstance().clearRecords();
if (checkRepository.size() > 0) {
JobletReferenceDialog dialog=new JobletReferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),sourceNode.getObject(),checkRepository);
dialog.open();
return false;
}
}
return isBin;
default :
return false;
}
}
 else if (sourceNode.getType() == ENodeType.SIMPLE_FOLDER) {
if (targetNode.getType() != ENodeType.SIMPLE_FOLDER && targetNode.getType() != ENodeType.SYSTEM_FOLDER) {
return false;
}
ERepositoryObjectType sourceType=(ERepositoryObjectType)sourceNode.getProperties(EProperties.CONTENT_TYPE);
if (((ERepositoryObjectType)targetNode.getProperties(EProperties.CONTENT_TYPE)) != sourceType) {
return false;
}
if (!ResourceUtils.isCorrectDestination(sourcePath,targetPath,true)) {
return false;
}
IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
try {
if (!factory.isPathValid(sourceType,targetPath,sourcePath.lastSegment())) {
return false;
}
}
 catch (PersistenceException e) {
ExceptionHandler.process(e);
return false;
}
return true;
}
 else {
return false;
}
}

Fixed version (ground truth):
/** 
 * DOC Administrator Comment method "validateAction".
 * @param sourceNode
 * @param targetNode
 * @return
 */
public boolean validateAction(RepositoryNode sourceNode,RepositoryNode targetNode,boolean isDnd){
  if (sourceNode == null) {
    return false;
  }
  IRepositoryViewObject objectToCopy=sourceNode.getObject();
  if (isDnd && objectToCopy != null && ProxyRepositoryFactory.getInstance().getStatus(objectToCopy) == ERepositoryStatus.DELETED) {
    return false;
  }
  if (isDnd && objectToCopy != null && (objectToCopy.getRepositoryObjectType().equals(ERepositoryObjectType.SERVICESOPERATION) || objectToCopy.getRepositoryObjectType().equals(ERepositoryObjectType.SERVICESPORT))) {
    return false;
  }
  if (sourceNode.getType() == ENodeType.SIMPLE_FOLDER && sourceNode.getContentType() == ERepositoryObjectType.JOB_DOC) {
    return false;
  }
  if (sourceNode.getType() == ENodeType.SIMPLE_FOLDER && sourceNode.getContentType() == ERepositoryObjectType.JOBLET_DOC) {
    return false;
  }
  if (targetNode == null) {
switch (sourceNode.getType()) {
case REPOSITORY_ELEMENT:
case SIMPLE_FOLDER:
      return true;
default :
    return false;
}
}
if (sourceNode.equals(targetNode)) {
return false;
}
sourcePath=RepositoryNodeUtilities.getPath(sourceNode);
targetPath=RepositoryNodeUtilities.getPath(targetNode);
if (sourceNode.getType() == ENodeType.REPOSITORY_ELEMENT) {
isGenericSchema=targetNode.getContentType() == ERepositoryObjectType.METADATA_GENERIC_SCHEMA && sourceNode.getProperties(EProperties.CONTENT_TYPE) != ERepositoryObjectType.METADATA_GENERIC_SCHEMA && (sourceNode.getObject() instanceof MetadataTableRepositoryObject);
if (!isGenericSchema && !ResourceUtils.isCorrectDestination(sourcePath,targetPath,false)) {
  return false;
}
switch (targetNode.getType()) {
case SYSTEM_FOLDER:
case SIMPLE_FOLDER:
  boolean booleanValue=((ERepositoryObjectType)targetNode.getProperties(EProperties.CONTENT_TYPE)) == objectToCopy.getRepositoryObjectType();
if (isGenericSchema) {
  return true;
}
 else {
  return booleanValue;
}
case STABLE_SYSTEM_FOLDER:
boolean isJoblet=sourceNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET;
boolean isBin=targetNode.isBin();
if (isBin && isJoblet) {
IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
List<JobletReferenceBean> checkRepository=DeleteAction.checkRepositoryNodeFromProcess(factory,null,sourceNode);
DeleteActionCache.getInstance().clearRecords();
if (checkRepository.size() > 0) {
JobletReferenceDialog dialog=new JobletReferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),sourceNode.getObject(),checkRepository);
dialog.open();
return false;
}
}
return isBin;
default :
return false;
}
}
 else if (sourceNode.getType() == ENodeType.SIMPLE_FOLDER) {
if (targetNode.getType() != ENodeType.SIMPLE_FOLDER && targetNode.getType() != ENodeType.SYSTEM_FOLDER) {
return false;
}
ERepositoryObjectType sourceType=(ERepositoryObjectType)sourceNode.getProperties(EProperties.CONTENT_TYPE);
if (((ERepositoryObjectType)targetNode.getProperties(EProperties.CONTENT_TYPE)) != sourceType) {
return false;
}
if (!ResourceUtils.isCorrectDestination(sourcePath,targetPath,true)) {
return false;
}
IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
try {
if (!factory.isPathValid(sourceType,targetPath,sourcePath.lastSegment())) {
return false;
}
}
 catch (PersistenceException e) {
ExceptionHandler.process(e);
return false;
}
return true;
}
 else {
return false;
}
}