Program: 172272
Project: 172272
Buggy source:
/** 
 * @see org.alfresco.service.cmr.repository.NodeService#createNode(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName,java.util.Map)
 */
public ChildAssociationRef createNode(NodeRef parentRef,QName assocTypeQName,QName assocQName,QName nodeTypeQName,Map<QName,Serializable> properties){
  Assert.notNull(parentRef);
  Assert.notNull(assocTypeQName);
  Assert.notNull(assocQName);
  if (properties == null) {
    properties=new HashMap<QName,Serializable>();
  }
 else {
    properties=new HashMap<QName,Serializable>(properties);
  }
  invokeBeforeCreateNode(parentRef,assocTypeQName,assocQName,nodeTypeQName);
  StoreRef storeRef=parentRef.getStoreRef();
  Store store=nodeDaoService.getStore(storeRef.getProtocol(),storeRef.getIdentifier());
  if (store == null) {
    throw new RuntimeException("String_Node_Str" + parentRef);
  }
  TypeDefinition nodeTypeDef=dictionaryService.getType(nodeTypeQName);
  if (nodeTypeDef == null) {
    throw new InvalidTypeException(nodeTypeQName);
  }
  String newId=generateGuid(properties);
  Node childNode=nodeDaoService.newNode(store,newId,nodeTypeQName);
  NodeRef childNodeRef=childNode.getNodeRef();
  invokeBeforeCreateChildAssociation(parentRef,childNodeRef,assocTypeQName,assocQName,true);
  Node parentNode=getNodeNotNull(parentRef);
  ChildAssoc childAssoc=nodeDaoService.newChildAssoc(parentNode,childNode,true,assocTypeQName,assocQName);
  addDefaultPropertyValues(nodeTypeDef,properties);
  addDefaultAspects(nodeTypeDef,childNode,properties);
  Map<QName,Serializable> propertiesBefore=getPropertiesImpl(childNode);
  Map<QName,Serializable> propertiesAfter=null;
  if (properties.size() > 0) {
    propertiesAfter=setPropertiesImpl(childNode,properties);
  }
  setChildUniqueName(childNode);
  ChildAssociationRef childAssocRef=childAssoc.getChildAssocRef();
  invokeOnCreateNode(childAssocRef);
  invokeOnCreateChildAssociation(childAssocRef,true);
  if (propertiesAfter != null) {
    invokeOnUpdateProperties(childAssocRef.getChildRef(),propertiesBefore,propertiesAfter);
  }
  return childAssocRef;
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.service.cmr.repository.NodeService#createNode(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName,java.util.Map)
 */
public ChildAssociationRef createNode(NodeRef parentRef,QName assocTypeQName,QName assocQName,QName nodeTypeQName,Map<QName,Serializable> properties){
  Assert.notNull(parentRef);
  Assert.notNull(assocTypeQName);
  Assert.notNull(assocQName);
  Node parentNode=getNodeNotNull(parentRef);
  if (properties == null) {
    properties=new HashMap<QName,Serializable>();
  }
 else {
    properties=new HashMap<QName,Serializable>(properties);
  }
  invokeBeforeCreateNode(parentRef,assocTypeQName,assocQName,nodeTypeQName);
  StoreRef storeRef=parentRef.getStoreRef();
  Store store=nodeDaoService.getStore(storeRef.getProtocol(),storeRef.getIdentifier());
  if (store == null) {
    throw new RuntimeException("String_Node_Str" + parentRef);
  }
  TypeDefinition nodeTypeDef=dictionaryService.getType(nodeTypeQName);
  if (nodeTypeDef == null) {
    throw new InvalidTypeException(nodeTypeQName);
  }
  String newId=generateGuid(properties);
  Node childNode=nodeDaoService.newNode(store,newId,nodeTypeQName);
  NodeRef childNodeRef=childNode.getNodeRef();
  invokeBeforeCreateChildAssociation(parentRef,childNodeRef,assocTypeQName,assocQName,true);
  ChildAssoc childAssoc=nodeDaoService.newChildAssoc(parentNode,childNode,true,assocTypeQName,assocQName);
  addDefaultPropertyValues(nodeTypeDef,properties);
  addDefaultAspects(nodeTypeDef,childNode,properties);
  Map<QName,Serializable> propertiesBefore=getPropertiesImpl(childNode);
  Map<QName,Serializable> propertiesAfter=null;
  if (properties.size() > 0) {
    propertiesAfter=setPropertiesImpl(childNode,properties);
  }
  setChildUniqueName(childNode);
  ChildAssociationRef childAssocRef=childAssoc.getChildAssocRef();
  invokeOnCreateNode(childAssocRef);
  invokeOnCreateChildAssociation(childAssocRef,true);
  if (propertiesAfter != null) {
    invokeOnUpdateProperties(childAssocRef.getChildRef(),propertiesBefore,propertiesAfter);
  }
  return childAssocRef;
}