Program: 172311
Project: 172311
Buggy source:
/** 
 * Sets Properties of Task
 * @param instance  task instance
 * @param properties  properties to set
 */
protected void setTaskProperties(TaskInstance instance,Map<QName,Serializable> properties){
  if (properties == null) {
    return;
  }
  TypeDefinition taskDef=getAnonymousTaskDefinition(getTaskDefinition(instance.getTask()));
  Map<QName,PropertyDefinition> taskProperties=taskDef.getProperties();
  Map<QName,AssociationDefinition> taskAssocs=taskDef.getAssociations();
  for (  Entry<QName,Serializable> entry : properties.entrySet()) {
    QName key=entry.getKey();
    Serializable value=entry.getValue();
    PropertyDefinition propDef=taskProperties.get(key);
    if (propDef != null) {
      if (propDef.isProtected()) {
        continue;
      }
      if (key.equals(WorkflowModel.PROP_DUE_DATE)) {
        if (!(value instanceof Date)) {
          throw new WorkflowException("String_Node_Str" + value + "String_Node_Str");
        }
        instance.setDueDate((Date)value);
        continue;
      }
 else       if (key.equals(WorkflowModel.PROP_PRIORITY)) {
        if (!(value instanceof Integer)) {
          throw new WorkflowException("String_Node_Str" + value + "String_Node_Str");
        }
        instance.setPriority((Integer)value);
        continue;
      }
 else       if (key.equals(ContentModel.PROP_OWNER)) {
        if (!(value instanceof String)) {
          throw new WorkflowException("String_Node_Str" + value + "String_Node_Str");
        }
        instance.setActorId((String)value);
        continue;
      }
    }
 else {
      AssociationDefinition assocDef=taskAssocs.get(key);
      if (assocDef != null) {
        if (assocDef.getTargetClass().equals(ContentModel.TYPE_PERSON)) {
          value=mapAuthorityToName((List<NodeRef>)value);
        }
        if (key.equals(WorkflowModel.ASSOC_POOLED_ACTORS)) {
          instance.setPooledActors((String[])value);
          continue;
        }
      }
    }
    String name=null;
    if (key.getNamespaceURI().equals(NamespaceService.DEFAULT_URI)) {
      name=key.getLocalName();
    }
 else {
      name=key.toString();
    }
    instance.setVariableLocally(name,value);
  }
}

Fixed version (ground truth):
/** 
 * Sets Properties of Task
 * @param instance  task instance
 * @param properties  properties to set
 */
protected void setTaskProperties(TaskInstance instance,Map<QName,Serializable> properties){
  if (properties == null) {
    return;
  }
  TypeDefinition taskDef=getAnonymousTaskDefinition(getTaskDefinition(instance.getTask()));
  Map<QName,PropertyDefinition> taskProperties=taskDef.getProperties();
  Map<QName,AssociationDefinition> taskAssocs=taskDef.getAssociations();
  for (  Entry<QName,Serializable> entry : properties.entrySet()) {
    QName key=entry.getKey();
    Serializable value=entry.getValue();
    PropertyDefinition propDef=taskProperties.get(key);
    if (propDef != null) {
      if (propDef.isProtected()) {
        continue;
      }
      if (key.equals(WorkflowModel.PROP_DUE_DATE)) {
        if (!(value instanceof Date)) {
          throw new WorkflowException("String_Node_Str" + value + "String_Node_Str");
        }
        instance.setDueDate((Date)value);
        continue;
      }
 else       if (key.equals(WorkflowModel.PROP_PRIORITY)) {
        if (!(value instanceof Integer)) {
          throw new WorkflowException("String_Node_Str" + value + "String_Node_Str");
        }
        instance.setPriority((Integer)value);
        continue;
      }
 else       if (key.equals(ContentModel.PROP_OWNER)) {
        if (!(value instanceof String)) {
          throw new WorkflowException("String_Node_Str" + value + "String_Node_Str");
        }
        instance.setActorId((String)value);
        continue;
      }
    }
 else {
      AssociationDefinition assocDef=taskAssocs.get(key);
      if (assocDef != null) {
        if (assocDef.getTargetClass().getName().equals(ContentModel.TYPE_PERSON)) {
          String[] authorityNames=mapAuthorityToName((List<NodeRef>)value);
          value=((assocDef.isTargetMany()) ? authorityNames : authorityNames[0]);
        }
        if (key.equals(WorkflowModel.ASSOC_POOLED_ACTORS)) {
          instance.setPooledActors((String[])value);
          continue;
        }
      }
    }
    String name=null;
    if (key.getNamespaceURI().equals(NamespaceService.DEFAULT_URI)) {
      name=key.getLocalName();
    }
 else {
      name=key.toPrefixString(this.namespaceService);
    }
    instance.setVariableLocally(name,value);
  }
}