Program: 172236
Project: 172236
Buggy source:
/** 
 * @see org.alfresco.repo.action.executer.ActionExecuter#execute(org.alfresco.service.cmr.repository.NodeRef,NodeRef)
 */
public void executeImpl(Action ruleAction,NodeRef actionedUponNodeRef){
  if (!nodeService.exists(actionedUponNodeRef)) {
    return;
  }
  ContentReader reader=contentService.getReader(actionedUponNodeRef,ContentModel.PROP_CONTENT);
  if (reader == null || reader.getMimetype() == null) {
    return;
  }
  String mimetype=reader.getMimetype();
  MetadataExtracter extracter=metadataExtracterRegistry.getExtracter(mimetype);
  if (extracter == null) {
    return;
  }
  Map<QName,Serializable> nodeProperties=nodeService.getProperties(actionedUponNodeRef);
  Map<QName,Serializable> modifiedProperties=extracter.extract(reader,nodeProperties);
  if (modifiedProperties.size() == 0) {
    return;
  }
  Set<QName> requiredAspectQNames=new HashSet<QName>(3);
  Set<QName> aspectPropertyQNames=new HashSet<QName>(17);
  for (  QName propertyQName : modifiedProperties.keySet()) {
    PropertyDefinition propertyDef=dictionaryService.getProperty(propertyQName);
    if (propertyDef == null) {
      continue;
    }
    ClassDefinition propertyContainerDef=propertyDef.getContainerClass();
    if (propertyContainerDef.isAspect()) {
      QName aspectQName=propertyContainerDef.getName();
      requiredAspectQNames.add(aspectQName);
      Set<QName> aspectProperties=propertyContainerDef.getProperties().keySet();
      aspectPropertyQNames.addAll(aspectProperties);
    }
  }
  if (!carryAspectProperties) {
    for (    QName aspectPropertyQName : aspectPropertyQNames) {
      if (!modifiedProperties.containsKey(aspectPropertyQName)) {
        nodeProperties.remove(aspectPropertyQName);
      }
    }
  }
  nodeService.setProperties(actionedUponNodeRef,nodeProperties);
  for (  QName requiredAspectQName : requiredAspectQNames) {
    if (nodeService.hasAspect(actionedUponNodeRef,requiredAspectQName)) {
      continue;
    }
 else {
      nodeService.addAspect(actionedUponNodeRef,requiredAspectQName,null);
    }
  }
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.repo.action.executer.ActionExecuter#execute(org.alfresco.service.cmr.repository.NodeRef,NodeRef)
 */
public void executeImpl(Action ruleAction,NodeRef actionedUponNodeRef){
  if (!nodeService.exists(actionedUponNodeRef)) {
    return;
  }
  ContentReader reader=contentService.getReader(actionedUponNodeRef,ContentModel.PROP_CONTENT);
  if (reader == null || reader.getMimetype() == null) {
    return;
  }
  String mimetype=reader.getMimetype();
  MetadataExtracter extracter=metadataExtracterRegistry.getExtracter(mimetype);
  if (extracter == null) {
    return;
  }
  Map<QName,Serializable> nodeProperties=nodeService.getProperties(actionedUponNodeRef);
  Map<QName,Serializable> modifiedProperties=null;
  try {
    modifiedProperties=extracter.extract(reader,nodeProperties);
  }
 catch (  Throwable e) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + "String_Node_Str" + this + "String_Node_Str"+ "String_Node_Str"+ actionedUponNodeRef+ "String_Node_Str"+ "String_Node_Str"+ reader,e);
    }
 else {
      logger.warn("String_Node_Str" + "String_Node_Str" + this + "String_Node_Str"+ "String_Node_Str"+ actionedUponNodeRef+ "String_Node_Str"+ "String_Node_Str"+ reader+ "String_Node_Str"+ "String_Node_Str"+ e.getMessage());
    }
  }
  if (modifiedProperties.size() == 0) {
    return;
  }
  Set<QName> requiredAspectQNames=new HashSet<QName>(3);
  Set<QName> aspectPropertyQNames=new HashSet<QName>(17);
  for (  QName propertyQName : modifiedProperties.keySet()) {
    PropertyDefinition propertyDef=dictionaryService.getProperty(propertyQName);
    if (propertyDef == null) {
      continue;
    }
    ClassDefinition propertyContainerDef=propertyDef.getContainerClass();
    if (propertyContainerDef.isAspect()) {
      QName aspectQName=propertyContainerDef.getName();
      requiredAspectQNames.add(aspectQName);
      Set<QName> aspectProperties=propertyContainerDef.getProperties().keySet();
      aspectPropertyQNames.addAll(aspectProperties);
    }
  }
  if (!carryAspectProperties) {
    for (    QName aspectPropertyQName : aspectPropertyQNames) {
      if (!modifiedProperties.containsKey(aspectPropertyQName)) {
        nodeProperties.remove(aspectPropertyQName);
      }
    }
  }
  nodeService.setProperties(actionedUponNodeRef,nodeProperties);
  for (  QName requiredAspectQName : requiredAspectQNames) {
    if (nodeService.hasAspect(actionedUponNodeRef,requiredAspectQName)) {
      continue;
    }
 else {
      nodeService.addAspect(actionedUponNodeRef,requiredAspectQName,null);
    }
  }
}