nus-yam/ex-repair huggingface dataset:
Program: 172273
Project: 172273
Buggy source:
/** 
 * @see Node#getAspects()
 */
public void addAspect(NodeRef nodeRef,QName aspectTypeQName,Map<QName,Serializable> aspectProperties) throws InvalidNodeRefException, InvalidAspectException {
  AspectDefinition aspectDef=dictionaryService.getAspect(aspectTypeQName);
  if (aspectDef == null) {
    throw new InvalidAspectException("String_Node_Str" + aspectTypeQName,aspectTypeQName);
  }
  invokeBeforeUpdateNode(nodeRef);
  invokeBeforeAddAspect(nodeRef,aspectTypeQName);
  Node node=getNodeNotNull(nodeRef);
  Map<QName,Serializable> nodeProperties=getPropertiesImpl(node);
  if (aspectProperties != null) {
    nodeProperties.putAll(aspectProperties);
  }
  addDefaultPropertyValues(aspectDef,nodeProperties);
  addDefaultAspects(aspectDef,node,nodeProperties);
  setProperties(nodeRef,nodeProperties);
  if (node.getAspects().add(aspectTypeQName) == true) {
    invokeOnUpdateNode(nodeRef);
    invokeOnAddAspect(nodeRef,aspectTypeQName);
    nodeDaoService.recordChangeId(nodeRef);
  }
}

Fixed version (ground truth):
/** 
 * @see Node#getAspects()
 */
public void addAspect(NodeRef nodeRef,QName aspectTypeQName,Map<QName,Serializable> aspectProperties) throws InvalidNodeRefException, InvalidAspectException {
  AspectDefinition aspectDef=dictionaryService.getAspect(aspectTypeQName);
  if (aspectDef == null) {
    throw new InvalidAspectException("String_Node_Str" + aspectTypeQName,aspectTypeQName);
  }
  Node node=getNodeNotNull(nodeRef);
  invokeBeforeUpdateNode(nodeRef);
  invokeBeforeAddAspect(nodeRef,aspectTypeQName);
  Map<QName,Serializable> nodeProperties=getPropertiesImpl(node);
  if (aspectProperties != null) {
    nodeProperties.putAll(aspectProperties);
  }
  addDefaultPropertyValues(aspectDef,nodeProperties);
  addDefaultAspects(aspectDef,node,nodeProperties);
  setProperties(nodeRef,nodeProperties);
  if (node.getAspects().add(aspectTypeQName) == true) {
    invokeOnUpdateNode(nodeRef);
    invokeOnAddAspect(nodeRef,aspectTypeQName);
    nodeDaoService.recordChangeId(nodeRef);
  }
}
Program: 172274
Project: 172274
Buggy source:
/** 
 * Gets the properties map, sets the value (null is allowed) and checks that the new set of properties is valid.
 * @see DbNodeServiceImpl.NullPropertyValue
 */
public void setProperty(NodeRef nodeRef,QName qname,Serializable value) throws InvalidNodeRefException {
  Assert.notNull(qname);
  invokeBeforeUpdateNode(nodeRef);
  Node node=getNodeNotNull(nodeRef);
  Map<QName,Serializable> propertiesBefore=getPropertiesImpl(node);
  Map<QName,Serializable> propertiesAfter=setPropertyImpl(node,qname,value);
  if (qname.equals(ContentModel.PROP_NAME)) {
    setChildUniqueName(node);
  }
  invokeOnUpdateNode(nodeRef);
  invokeOnUpdateProperties(nodeRef,propertiesBefore,propertiesAfter);
}

Fixed version (ground truth):
/** 
 * Gets the properties map, sets the value (null is allowed) and checks that the new set of properties is valid.
 * @see DbNodeServiceImpl.NullPropertyValue
 */
public void setProperty(NodeRef nodeRef,QName qname,Serializable value) throws InvalidNodeRefException {
  Assert.notNull(qname);
  Node node=getNodeNotNull(nodeRef);
  invokeBeforeUpdateNode(nodeRef);
  Map<QName,Serializable> propertiesBefore=getPropertiesImpl(node);
  Map<QName,Serializable> propertiesAfter=setPropertyImpl(node,qname,value);
  if (qname.equals(ContentModel.PROP_NAME)) {
    setChildUniqueName(node);
  }
  invokeOnUpdateNode(nodeRef);
  invokeOnUpdateProperties(nodeRef,propertiesBefore,propertiesAfter);
}
Program: 172275
Project: 172275
Buggy source:
public ChildAssociationRef addChild(NodeRef parentRef,NodeRef childRef,QName assocTypeQName,QName assocQName){
  invokeBeforeCreateChildAssociation(parentRef,childRef,assocTypeQName,assocQName,false);
  Node parentNode=getNodeNotNull(parentRef);
  Node childNode=getNodeNotNull(childRef);
  ChildAssoc assoc=nodeDaoService.newChildAssoc(parentNode,childNode,false,assocTypeQName,assocQName);
  setChildUniqueName(childNode);
  ChildAssociationRef assocRef=assoc.getChildAssocRef();
  NodeRef childNodeRef=assocRef.getChildRef();
  getPaths(childNodeRef,false);
  invokeOnCreateChildAssociation(assocRef,false);
  return assoc.getChildAssocRef();
}

Fixed version (ground truth):
public ChildAssociationRef addChild(NodeRef parentRef,NodeRef childRef,QName assocTypeQName,QName assocQName){
  Node parentNode=getNodeNotNull(parentRef);
  Node childNode=getNodeNotNull(childRef);
  invokeBeforeCreateChildAssociation(parentRef,childRef,assocTypeQName,assocQName,false);
  ChildAssoc assoc=nodeDaoService.newChildAssoc(parentNode,childNode,false,assocTypeQName,assocQName);
  setChildUniqueName(childNode);
  ChildAssociationRef assocRef=assoc.getChildAssocRef();
  NodeRef childNodeRef=assocRef.getChildRef();
  getPaths(childNodeRef,false);
  invokeOnCreateChildAssociation(assocRef,false);
  return assoc.getChildAssocRef();
}
Program: 172276
Project: 172276
Buggy source:
public void removeProperty(NodeRef nodeRef,QName qname) throws InvalidNodeRefException {
  if (qname.equals(ContentModel.PROP_NAME)) {
    throw new UnsupportedOperationException("String_Node_Str" + qname + "String_Node_Str");
  }
  invokeBeforeUpdateNode(nodeRef);
  Node node=getNodeNotNull(nodeRef);
  Map<QName,Serializable> propertiesBefore=getPropertiesImpl(node);
  Map<QName,PropertyValue> properties=node.getProperties();
  properties.remove(qname);
  Map<QName,Serializable> propertiesAfter=getPropertiesImpl(node);
  invokeOnUpdateNode(nodeRef);
  invokeOnUpdateProperties(nodeRef,propertiesBefore,propertiesAfter);
}

Fixed version (ground truth):
public void removeProperty(NodeRef nodeRef,QName qname) throws InvalidNodeRefException {
  if (qname.equals(ContentModel.PROP_NAME)) {
    throw new UnsupportedOperationException("String_Node_Str" + qname + "String_Node_Str");
  }
  Node node=getNodeNotNull(nodeRef);
  invokeBeforeUpdateNode(nodeRef);
  Map<QName,Serializable> propertiesBefore=getPropertiesImpl(node);
  Map<QName,PropertyValue> properties=node.getProperties();
  properties.remove(qname);
  Map<QName,Serializable> propertiesAfter=getPropertiesImpl(node);
  invokeOnUpdateNode(nodeRef);
  invokeOnUpdateProperties(nodeRef,propertiesBefore,propertiesAfter);
}
Program: 172277
Project: 172277
Buggy source:
/** 
 * Performs all the necessary housekeeping involved in changing a node's store. This method cascades down through all the primary children of the node as well.
 * @param node the node whose store is changing
 * @param store the new store for the node
 */
private void moveNodeToStore(Node node,Store store){
  NodeRef nodeRef=node.getNodeRef();
  NodeStatus nodeStatus=nodeDaoService.getNodeStatus(nodeRef,true);
  Map<Long,NodeStatus> nodeStatusesById=getNodeHierarchy(nodeStatus,null);
  for (  NodeStatus oldNodeStatus : nodeStatusesById.values()) {
    Node nodeToMove=oldNodeStatus.getNode();
    nodeToMove.setStore(store);
    NodeRef newNodeRef=nodeToMove.getNodeRef();
    oldNodeStatus.setNode(null);
    NodeStatus newNodeStatus=nodeDaoService.getNodeStatus(newNodeRef,true);
    newNodeStatus.setNode(nodeToMove);
    invokeOnUpdateNode(newNodeRef);
  }
}

Fixed version (ground truth):
/** 
 * Performs all the necessary housekeeping involved in changing a node's store. This method cascades down through all the primary children of the node as well.
 * @param node the node whose store is changing
 * @param store the new store for the node
 */
private void moveNodeToStore(Node node,Store store){
  NodeRef nodeRef=node.getNodeRef();
  NodeStatus nodeStatus=nodeDaoService.getNodeStatus(nodeRef,true);
  Map<Long,NodeStatus> nodeStatusesById=getNodeHierarchy(nodeStatus,null);
  for (  NodeStatus oldNodeStatus : nodeStatusesById.values()) {
    Node nodeToMove=oldNodeStatus.getNode();
    NodeRef oldNodeRef=nodeToMove.getNodeRef();
    nodeToMove.setStore(store);
    NodeRef newNodeRef=nodeToMove.getNodeRef();
    oldNodeStatus.setNode(null);
    NodeStatus newNodeStatus=nodeDaoService.getNodeStatus(newNodeRef,true);
    newNodeStatus.setNode(nodeToMove);
    nodeDaoService.recordChangeId(oldNodeRef);
    nodeDaoService.recordChangeId(newNodeRef);
    invokeOnUpdateNode(newNodeRef);
  }
}
Program: 172278
Project: 172278
Buggy source:
public Serializable getProperty(NodeRef nodeRef,QName qname) throws InvalidNodeRefException {
  if (qname.equals(ContentModel.PROP_STORE_PROTOCOL)) {
    return nodeRef.getStoreRef().getProtocol();
  }
 else   if (qname.equals(ContentModel.PROP_STORE_IDENTIFIER)) {
    return nodeRef.getStoreRef().getIdentifier();
  }
 else   if (qname.equals(ContentModel.PROP_NODE_UUID)) {
    return nodeRef.getId();
  }
  Node node=getNodeNotNull(nodeRef);
  if (qname.equals(ContentModel.PROP_NODE_DBID)) {
    return node.getId();
  }
  Map<QName,PropertyValue> properties=node.getProperties();
  PropertyValue propertyValue=properties.get(qname);
  if (propertyValue == null && qname.equals(ContentModel.PROP_NAME)) {
    return nodeRef.getId();
  }
  PropertyDefinition propertyDef=dictionaryService.getProperty(qname);
  Serializable value=makeSerializableValue(propertyDef,propertyValue);
  return value;
}

Fixed version (ground truth):
public Serializable getProperty(NodeRef nodeRef,QName qname) throws InvalidNodeRefException {
  Node node=getNodeNotNull(nodeRef);
  if (qname.equals(ContentModel.PROP_STORE_PROTOCOL)) {
    return nodeRef.getStoreRef().getProtocol();
  }
 else   if (qname.equals(ContentModel.PROP_STORE_IDENTIFIER)) {
    return nodeRef.getStoreRef().getIdentifier();
  }
 else   if (qname.equals(ContentModel.PROP_NODE_UUID)) {
    return nodeRef.getId();
  }
  if (qname.equals(ContentModel.PROP_NODE_DBID)) {
    return node.getId();
  }
  Map<QName,PropertyValue> properties=node.getProperties();
  PropertyValue propertyValue=properties.get(qname);
  if (propertyValue == null && qname.equals(ContentModel.PROP_NAME)) {
    return nodeRef.getId();
  }
  PropertyDefinition propertyDef=dictionaryService.getProperty(qname);
  Serializable value=makeSerializableValue(propertyDef,propertyValue);
  return value;
}
Program: 172279
Project: 172279
Buggy source:
/** 
 * @see org.alfresco.service.cmr.repository.NodeService#setType(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName)
 */
public void setType(NodeRef nodeRef,QName typeQName) throws InvalidNodeRefException {
  TypeDefinition nodeTypeDef=dictionaryService.getType(typeQName);
  if (nodeTypeDef == null) {
    throw new InvalidTypeException(typeQName);
  }
  invokeBeforeUpdateNode(nodeRef);
  Node node=getNodeNotNull(nodeRef);
  node.setTypeQName(typeQName);
  Map<QName,Serializable> properties=this.getPropertiesImpl(node);
  addDefaultAspects(nodeTypeDef,node,properties);
  this.setProperties(nodeRef,properties);
  invokeOnUpdateNode(nodeRef);
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.service.cmr.repository.NodeService#setType(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName)
 */
public void setType(NodeRef nodeRef,QName typeQName) throws InvalidNodeRefException {
  TypeDefinition nodeTypeDef=dictionaryService.getType(typeQName);
  if (nodeTypeDef == null) {
    throw new InvalidTypeException(typeQName);
  }
  Node node=getNodeNotNull(nodeRef);
  invokeBeforeUpdateNode(nodeRef);
  node.setTypeQName(typeQName);
  Map<QName,Serializable> properties=this.getPropertiesImpl(node);
  addDefaultAspects(nodeTypeDef,node,properties);
  this.setProperties(nodeRef,properties);
  invokeOnUpdateNode(nodeRef);
}
Program: 172281
Project: 172281
Buggy source:
/** 
 * Execute a script
 * @param context  jBPM execution context
 * @param services  Alfresco service registry
 * @param expression  script to execute
 * @param variableAccesses  (optional) list of jBPM variables to map into script (all, if not supplied)
 * @return  script result
 */
public static Object executeScript(ExecutionContext context,ServiceRegistry services,String expression,List<VariableAccess> variableAccesses){
  Map<String,Object> inputMap=createInputMap(context,services,variableAccesses);
  ScriptService scriptService=services.getScriptService();
  Object result=scriptService.executeScriptString(expression,inputMap);
  if (result instanceof NodeRef) {
    result=new JBPMNode((NodeRef)result,services);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Execute a script
 * @param context  jBPM execution context
 * @param services  Alfresco service registry
 * @param expression  script to execute
 * @param variableAccesses  (optional) list of jBPM variables to map into script (all, if not supplied)
 * @return  script result
 */
public static Object executeScript(ExecutionContext context,ServiceRegistry services,String expression,List<VariableAccess> variableAccesses){
  Map<String,Object> inputMap=createInputMap(context,services,variableAccesses);
  ScriptService scriptService=services.getScriptService();
  Object result=scriptService.executeScriptString(expression,inputMap);
  result=convertForJBPM(result,services);
  return result;
}
Program: 172285
Project: 172285
Buggy source:
public String toString(){
  StringBuilder sb=new StringBuilder(56);
  sb.append("String_Node_Str");
  if (combinedPattern != null) {
    sb.append("String_Node_Str").append(combinedPattern);
  }
 else {
    sb.append("String_Node_Str").append(namespaceUriPattern);
    sb.append("String_Node_Str").append(namespaceUriPattern);
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuilder sb=new StringBuilder(56);
  sb.append("String_Node_Str");
  if (combinedPattern != null) {
    sb.append("String_Node_Str").append(combinedPattern);
  }
 else {
    sb.append("String_Node_Str").append(namespaceUriPattern);
    sb.append("String_Node_Str").append(localNamePattern);
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 172287
Project: 172287
Buggy source:
/** 
 * Do the actual work.
 * @param executionContext The context to get stuff from.
 */
public void execute(ExecutionContext executionContext) throws Exception {
  NodeRef pkg=((JBPMNode)executionContext.getContextInstance().getVariable("String_Node_Str")).getNodeRef();
  Pair<Integer,String> pkgPath=AVMNodeConverter.ToAVMVersionPath(pkg);
  String description=(String)executionContext.getContextInstance().getVariable("String_Node_Str");
  String tag=(String)executionContext.getContextInstance().getVariable("String_Node_Str");
  AVMNodeDescriptor pkgDesc=fAVMService.lookup(pkgPath.getFirst(),pkgPath.getSecond());
  String targetPath=pkgDesc.getIndirection();
  List<AVMDifference> stagingDiffs=fAVMSyncService.compare(pkgPath.getFirst(),pkgPath.getSecond(),-1,targetPath,null);
  for (  AVMDifference diff : stagingDiffs) {
    fAVMSubmittedAspect.clearSubmitted(diff.getSourceVersion(),diff.getSourcePath());
  }
  fAVMSyncService.update(stagingDiffs,null,false,false,true,true,tag,description);
  String from=(String)executionContext.getContextInstance().getVariable("String_Node_Str");
  if (from != null && from.length() > 0) {
    List<AVMDifference> sandboxDiffs=fAVMSyncService.compare(pkgPath.getFirst(),pkgPath.getSecond(),-1,from,null);
    fAVMSyncService.update(sandboxDiffs,null,false,false,true,true,tag,description);
    AVMDAOs.Instance().fAVMNodeDAO.flush();
    fAVMSyncService.flatten(from,targetPath);
  }
}

Fixed version (ground truth):
/** 
 * Do the actual work.
 * @param executionContext The context to get stuff from.
 */
public void execute(ExecutionContext executionContext) throws Exception {
  NodeRef pkg=((JBPMNode)executionContext.getContextInstance().getVariable("String_Node_Str")).getNodeRef();
  Pair<Integer,String> pkgPath=AVMNodeConverter.ToAVMVersionPath(pkg);
  String description=(String)executionContext.getContextInstance().getVariable("String_Node_Str");
  String tag=(String)executionContext.getContextInstance().getVariable("String_Node_Str");
  AVMNodeDescriptor pkgDesc=fAVMService.lookup(pkgPath.getFirst(),pkgPath.getSecond());
  String targetPath=pkgDesc.getIndirection();
  List<AVMDifference> stagingDiffs=fAVMSyncService.compare(pkgPath.getFirst(),pkgPath.getSecond(),-1,targetPath,null);
  for (  AVMDifference diff : stagingDiffs) {
    fAVMSubmittedAspect.clearSubmitted(diff.getSourceVersion(),diff.getSourcePath());
  }
  fAVMSyncService.update(stagingDiffs,null,false,false,true,true,tag,description);
  String from=(String)executionContext.getContextInstance().getVariable("String_Node_Str");
  if (from != null && from.length() > 0) {
    List<AVMDifference> sandboxDiffs=fAVMSyncService.compare(pkgPath.getFirst(),pkgPath.getSecond(),-1,from,null);
    fAVMSyncService.update(sandboxDiffs,null,true,true,false,false,tag,description);
    AVMDAOs.Instance().fAVMNodeDAO.flush();
    fAVMSyncService.flatten(from,targetPath);
  }
}
Program: 172288
Project: 172288
Buggy source:
public void testConcurrent() throws Exception {
  luceneFTS.pause();
  int count=10;
  int repeats=10;
  Map<QName,ChildAssociationRef> assocRefs=commitNodeGraph();
  Thread runner=null;
  for (int i=0; i < count; i++) {
    runner=new Nester("String_Node_Str" + i,runner,repeats);
  }
  if (runner != null) {
    runner.start();
    try {
      runner.join();
      System.out.println("String_Node_Str" + runner.getName());
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  Thread.sleep(20000);
  SearchService searcher=(SearchService)ctx.getBean(ServiceRegistry.SEARCH_SERVICE.getLocalName());
  assertEquals(2 * ((count * repeats) + 1),searcher.selectNodes(rootNodeRef,"String_Node_Str",null,getNamespacePrefixReolsver("String_Node_Str"),false).size());
  ResultSet results=searcher.query(rootNodeRef.getStoreRef(),"String_Node_Str","String_Node_Str");
  assertEquals(3 * ((count * repeats) + 1),results.length());
  results.close();
}

Fixed version (ground truth):
public void testConcurrent() throws Exception {
  luceneFTS.pause();
  int count=10;
  int repeats=10;
  Map<QName,ChildAssociationRef> assocRefs=commitNodeGraph();
  Thread runner=null;
  for (int i=0; i < count; i++) {
    runner=new Nester("String_Node_Str" + i,runner,repeats);
  }
  if (runner != null) {
    runner.start();
    try {
      runner.join();
      System.out.println("String_Node_Str" + runner.getName());
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  SearchService searcher=(SearchService)ctx.getBean(ServiceRegistry.SEARCH_SERVICE.getLocalName());
  assertEquals(2 * ((count * repeats) + 1),searcher.selectNodes(rootNodeRef,"String_Node_Str",null,getNamespacePrefixReolsver("String_Node_Str"),false).size());
  ResultSet results=searcher.query(rootNodeRef.getStoreRef(),"String_Node_Str","String_Node_Str");
  assertEquals(3 * ((count * repeats) + 1),results.length());
  results.close();
}
Program: 172289
Project: 172289
Buggy source:
public Set<NodeRef> getDeletions(String id) throws IOException {
  if (id == null) {
    throw new IndexerException("String_Node_Str");
  }
  Set<NodeRef> deletions=new HashSet<NodeRef>();
  File location=new File(indexDirectory,id);
  File file=new File(location,INDEX_INFO_DELETIONS);
  if (!file.exists()) {
    return Collections.<NodeRef>emptySet();
  }
  DataInputStream is=new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
  int size=is.readInt();
  for (int i=0; i < size; i++) {
    String ref=is.readUTF();
    deletions.add(new NodeRef(ref));
  }
  is.close();
  return deletions;
}

Fixed version (ground truth):
public Set<NodeRef> getDeletions(String id) throws IOException {
  if (id == null) {
    throw new IndexerException("String_Node_Str");
  }
  Set<NodeRef> deletions=new HashSet<NodeRef>();
  File location=new File(indexDirectory,id);
  File file=new File(location,INDEX_INFO_DELETIONS);
  if (!file.exists()) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + id);
    }
    return Collections.<NodeRef>emptySet();
  }
  DataInputStream is=new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
  int size=is.readInt();
  for (int i=0; i < size; i++) {
    String ref=is.readUTF();
    deletions.add(new NodeRef(ref));
  }
  is.close();
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + deletions.size() + "String_Node_Str"+ id);
  }
  return deletions;
}
Program: 172290
Project: 172290
Buggy source:
private void dumpInfo(){
  if (s_logger.isDebugEnabled()) {
    readWriteLock.writeLock().lock();
    try {
      s_logger.debug("String_Node_Str");
      s_logger.debug("String_Node_Str");
      for (      IndexEntry entry : indexEntries.values()) {
        s_logger.debug("String_Node_Str" + entry.toString());
      }
    }
  finally {
      readWriteLock.writeLock().unlock();
    }
  }
}

Fixed version (ground truth):
private void dumpInfo(){
  if (s_logger.isDebugEnabled()) {
    StringBuilder builder=new StringBuilder();
    readWriteLock.writeLock().lock();
    try {
      builder.append("String_Node_Str");
      builder.append("String_Node_Str");
      for (      IndexEntry entry : indexEntries.values()) {
        builder.append("String_Node_Str" + entry.toString()).append("String_Node_Str");
      }
      s_logger.debug(builder.toString());
    }
  finally {
      readWriteLock.writeLock().unlock();
    }
  }
}
Program: 172291
Project: 172291
Buggy source:
public Object doWork() throws Exception {
  HashSet<String> toDelete=new HashSet<String>();
  for (  IndexEntry entry : toMerge.values()) {
    if (entry.getStatus() == TransactionStatus.MERGE) {
      if (wasMerged) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + entry.getName());
        }
        toDelete.add(entry.getName());
      }
 else {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + entry.getName());
        }
        entry.setStatus(TransactionStatus.COMMITTED);
      }
    }
 else     if (entry.getStatus() == TransactionStatus.MERGE_TARGET) {
      if (wasMerged) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + entry.getName());
        }
        entry.setStatus(TransactionStatus.COMMITTED);
      }
 else {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + entry.getName());
        }
        toDelete.add(entry.getName());
      }
    }
  }
  for (  String id : toDelete) {
    indexEntries.remove(id);
    deleteQueue.add(id);
  }
  dumpInfo();
  writeStatus();
  clearOldReaders();
synchronized (cleaner) {
    cleaner.notify();
  }
  return null;
}

Fixed version (ground truth):
public Object doWork() throws Exception {
  HashSet<String> toDelete=new HashSet<String>();
  for (  IndexEntry entry : toMerge.values()) {
    if (entry.getStatus() == TransactionStatus.MERGE) {
      if (wasMerged) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + entry.getName());
        }
        toDelete.add(entry.getName());
      }
 else {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + entry.getName());
        }
        entry.setStatus(TransactionStatus.COMMITTED);
      }
    }
 else     if (entry.getStatus() == TransactionStatus.MERGE_TARGET) {
      if (wasMerged) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + entry.getName());
        }
        entry.setStatus(TransactionStatus.COMMITTED);
      }
 else {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + entry.getName());
        }
        toDelete.add(entry.getName());
      }
    }
  }
  for (  String id : toDelete) {
    indexEntries.remove(id);
    if (!referenceCountingReadOnlyIndexReaders.containsKey(id)) {
      s_logger.debug("String_Node_Str" + id);
      deleteQueue.add(id);
    }
  }
  dumpInfo();
  writeStatus();
  clearOldReaders();
synchronized (cleaner) {
    cleaner.notify();
  }
  return null;
}
Program: 172292
Project: 172292
Buggy source:
private void clearOldReaders() throws IOException {
  HashSet<String> valid=new HashSet<String>();
  for (  String id : indexEntries.keySet()) {
    IndexEntry entry=indexEntries.get(id);
    if (entry.getStatus().isCommitted()) {
      valid.add(id);
    }
  }
  HashSet<String> inValid=new HashSet<String>();
  for (  String id : referenceCountingReadOnlyIndexReaders.keySet()) {
    if (!valid.contains(id)) {
      inValid.add(id);
    }
  }
  boolean hasInvalid=false;
  for (  String id : inValid) {
    IndexReader reader=referenceCountingReadOnlyIndexReaders.remove(id);
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + id);
    }
    ReferenceCounting referenceCounting=(ReferenceCounting)reader;
    referenceCounting.setInvalidForReuse();
    hasInvalid=true;
  }
  if (hasInvalid) {
    if (mainIndexReader != null) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str");
      }
      ((ReferenceCounting)mainIndexReader).setInvalidForReuse();
    }
    mainIndexReader=null;
  }
}

Fixed version (ground truth):
private void clearOldReaders() throws IOException {
  HashSet<String> inValid=new HashSet<String>();
  for (  String id : referenceCountingReadOnlyIndexReaders.keySet()) {
    if (!indexEntries.containsKey(id)) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug(id + "String_Node_Str");
      }
      inValid.add(id);
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug(id + "String_Node_Str");
      }
    }
  }
  clearInvalid(inValid);
}
Program: 172293
Project: 172293
Buggy source:
/** 
 * Get the IndexInfo object based in the given directory. There is only one object per directory per JVM.
 * @param file
 * @return
 * @throws IndexerException
 */
public static synchronized IndexInfo getIndexInfo(File file) throws IndexerException {
  File canonicalFile;
  try {
    canonicalFile=file.getCanonicalFile();
    IndexInfo indexInfo=indexInfos.get(canonicalFile);
    if (indexInfo == null) {
      indexInfo=new IndexInfo(canonicalFile);
      indexInfos.put(canonicalFile,indexInfo);
    }
    s_logger.error("String_Node_Str" + indexInfo + "String_Node_Str"+ file.getAbsolutePath());
    return indexInfo;
  }
 catch (  IOException e) {
    throw new IndexerException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Get the IndexInfo object based in the given directory. There is only one object per directory per JVM.
 * @param file
 * @return
 * @throws IndexerException
 */
public static synchronized IndexInfo getIndexInfo(File file) throws IndexerException {
  File canonicalFile;
  try {
    canonicalFile=file.getCanonicalFile();
    IndexInfo indexInfo=indexInfos.get(canonicalFile);
    if (indexInfo == null) {
      indexInfo=new IndexInfo(canonicalFile);
      indexInfos.put(canonicalFile,indexInfo);
    }
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + indexInfo + "String_Node_Str"+ file.getAbsolutePath());
    }
    return indexInfo;
  }
 catch (  IOException e) {
    throw new IndexerException("String_Node_Str",e);
  }
}
Program: 172295
Project: 172295
Buggy source:
/** 
 * Run the NetBIOS session socket handler
 */
public void run(){
  try {
    clearShutdown();
    while (hasShutdown() == false) {
      if (logger.isDebugEnabled() && hasDebug())       logger.debug("String_Node_Str");
      Socket sessSock=getSocket().accept();
      if (logger.isDebugEnabled() && hasDebug())       logger.debug("String_Node_Str" + sessSock.getInetAddress().getHostAddress());
      try {
        PacketHandler pktHandler=new NetBIOSPacketHandler(sessSock);
        SMBSrvSession srvSess=new SMBSrvSession(pktHandler,getServer());
        srvSess.setSessionId(getNextSessionId());
        srvSess.setUniqueId(pktHandler.getShortName() + srvSess.getSessionId());
        srvSess.setDebugPrefix("String_Node_Str" + pktHandler.getShortName() + srvSess.getSessionId()+ "String_Node_Str");
        getServer().addSession(srvSess);
        Thread srvThread=new Thread(THREAD_GROUP_SESSION,srvSess);
        srvThread.setDaemon(true);
        srvThread.setName("String_Node_Str" + srvSess.getSessionId() + "String_Node_Str"+ sessSock.getInetAddress().getHostAddress());
        srvThread.start();
      }
 catch (      Exception ex) {
        logger.error("String_Node_Str",ex);
      }
    }
  }
 catch (  SocketException ex) {
    if (hasShutdown() == false)     logger.error("String_Node_Str",ex);
  }
catch (  Exception ex) {
    if (hasShutdown() == false)     logger.error("String_Node_Str",ex);
  }
  if (logger.isDebugEnabled() && hasDebug())   logger.debug("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Run the NetBIOS session socket handler
 */
public void run(){
  try {
    clearShutdown();
    while (hasShutdown() == false) {
      if (logger.isDebugEnabled() && hasDebug())       logger.debug("String_Node_Str");
      Socket sessSock=getSocket().accept();
      if (logger.isDebugEnabled() && hasDebug())       logger.debug("String_Node_Str" + sessSock.getInetAddress().getHostAddress());
      try {
        PacketHandler pktHandler=new NetBIOSPacketHandler(sessSock);
        SMBSrvSession srvSess=new SMBSrvSession(pktHandler,getServer());
        srvSess.setSessionId(getNextSessionId());
        srvSess.setUniqueId(pktHandler.getShortName() + srvSess.getSessionId());
        getServer().addSession(srvSess);
        Thread srvThread=new Thread(THREAD_GROUP_SESSION,srvSess);
        srvThread.setDaemon(true);
        srvThread.setName("String_Node_Str" + srvSess.getSessionId() + "String_Node_Str"+ sessSock.getInetAddress().getHostAddress());
        srvThread.start();
      }
 catch (      Exception ex) {
        logger.error("String_Node_Str",ex);
      }
    }
  }
 catch (  SocketException ex) {
    if (hasShutdown() == false)     logger.error("String_Node_Str",ex);
  }
catch (  Exception ex) {
    if (hasShutdown() == false)     logger.error("String_Node_Str",ex);
  }
  if (logger.isDebugEnabled() && hasDebug())   logger.debug("String_Node_Str");
}
Program: 172296
Project: 172296
Buggy source:
/** 
 * Run the native SMB session socket handler
 */
public void run(){
  try {
    clearShutdown();
    while (hasShutdown() == false) {
      if (logger.isDebugEnabled() && hasDebug())       logger.debug("String_Node_Str");
      Socket sessSock=getSocket().accept();
      if (logger.isDebugEnabled() && hasDebug())       logger.debug("String_Node_Str" + sessSock.getInetAddress().getHostAddress());
      try {
        PacketHandler pktHandler=new TcpipSMBPacketHandler(sessSock);
        SMBSrvSession srvSess=new SMBSrvSession(pktHandler,getServer());
        srvSess.setSessionId(getNextSessionId());
        srvSess.setUniqueId(pktHandler.getShortName() + srvSess.getSessionId());
        srvSess.setDebugPrefix("String_Node_Str" + pktHandler.getShortName() + srvSess.getSessionId()+ "String_Node_Str");
        getServer().addSession(srvSess);
        Thread srvThread=new Thread(THREAD_GROUP_SESSION,srvSess);
        srvThread.setDaemon(true);
        srvThread.setName("String_Node_Str" + srvSess.getSessionId() + "String_Node_Str"+ sessSock.getInetAddress().getHostAddress());
        srvThread.start();
      }
 catch (      Exception ex) {
        logger.error("String_Node_Str",ex);
      }
    }
  }
 catch (  SocketException ex) {
    if (hasShutdown() == false)     logger.error("String_Node_Str",ex);
  }
catch (  Exception ex) {
    if (hasShutdown() == false)     logger.error("String_Node_Str",ex);
  }
  if (logger.isDebugEnabled() && hasDebug())   logger.debug("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Run the native SMB session socket handler
 */
public void run(){
  try {
    clearShutdown();
    while (hasShutdown() == false) {
      if (logger.isDebugEnabled() && hasDebug())       logger.debug("String_Node_Str");
      Socket sessSock=getSocket().accept();
      if (logger.isDebugEnabled() && hasDebug())       logger.debug("String_Node_Str" + sessSock.getInetAddress().getHostAddress());
      try {
        PacketHandler pktHandler=new TcpipSMBPacketHandler(sessSock);
        SMBSrvSession srvSess=new SMBSrvSession(pktHandler,getServer());
        srvSess.setSessionId(getNextSessionId());
        srvSess.setUniqueId(pktHandler.getShortName() + srvSess.getSessionId());
        getServer().addSession(srvSess);
        Thread srvThread=new Thread(THREAD_GROUP_SESSION,srvSess);
        srvThread.setDaemon(true);
        srvThread.setName("String_Node_Str" + srvSess.getSessionId() + "String_Node_Str"+ sessSock.getInetAddress().getHostAddress());
        srvThread.start();
      }
 catch (      Exception ex) {
        logger.error("String_Node_Str",ex);
      }
    }
  }
 catch (  SocketException ex) {
    if (hasShutdown() == false)     logger.error("String_Node_Str",ex);
  }
catch (  Exception ex) {
    if (hasShutdown() == false)     logger.error("String_Node_Str",ex);
  }
  if (logger.isDebugEnabled() && hasDebug())   logger.debug("String_Node_Str");
}
Program: 172299
Project: 172299
Buggy source:
@Override protected void executeImpl(Action action,NodeRef actionedUponNodeRef){
  Pair<Integer,String> versionPath=AVMNodeConverter.ToAVMVersionPath(actionedUponNodeRef);
  String[] storePath=versionPath.getSecond().split("String_Node_Str");
  String store=storePath[0];
  AVMNodeDescriptor toRevert=(AVMNodeDescriptor)action.getParameterValue(TOREVERT);
  List<Pair<Integer,String>> paths=fAVMService.getPaths(toRevert);
  Pair<Integer,String> found=new Pair<Integer,String>(Integer.MAX_VALUE,"String_Node_Str");
  for (  Pair<Integer,String> path : paths) {
    if (!path.getSecond().startsWith(store + ':')) {
      continue;
    }
    if (path.getFirst() < found.getFirst()) {
      found=path;
    }
  }
  AVMDifference diff=new AVMDifference(found.getFirst(),found.getSecond(),-1,versionPath.getSecond(),AVMDifference.NEWER);
  List<AVMDifference> diffs=new ArrayList<AVMDifference>(1);
  diffs.add(diff);
  String message="String_Node_Str" + versionPath.getSecond() + "String_Node_Str"+ found.getFirst()+ "String_Node_Str";
  fAVMSyncService.update(diffs,null,false,false,true,true,"String_Node_Str",message);
}

Fixed version (ground truth):
@Override protected void executeImpl(Action action,NodeRef actionedUponNodeRef){
  Pair<Integer,String> versionPath=AVMNodeConverter.ToAVMVersionPath(actionedUponNodeRef);
  AVMNodeDescriptor toRevert=(AVMNodeDescriptor)action.getParameterValue(TOREVERT);
  List<Pair<Integer,String>> paths=fAVMService.getPaths(toRevert);
  if (paths.size() == 0) {
    fgLogger.error("String_Node_Str" + toRevert);
    throw new AlfrescoRuntimeException("String_Node_Str" + toRevert);
  }
  AVMDifference diff=new AVMDifference(paths.get(0).getFirst(),paths.get(0).getSecond(),-1,versionPath.getSecond(),AVMDifference.NEWER);
  List<AVMDifference> diffs=new ArrayList<AVMDifference>(1);
  diffs.add(diff);
  String message="String_Node_Str" + versionPath.getSecond() + "String_Node_Str"+ paths.get(0).getFirst()+ "String_Node_Str";
  fAVMSyncService.update(diffs,null,false,false,true,true,"String_Node_Str",message);
}
Program: 172301
Project: 172301
Buggy source:
/** 
 * Insert a child node without COW.
 * @param name The name to give the child.
 */
public void putChild(String name,AVMNode node){
  ChildKey key=new ChildKey(this,name);
  ChildEntry existing=AVMDAOs.Instance().fChildEntryDAO.get(key);
  if (existing != null) {
    existing.setChild(node);
    AVMDAOs.Instance().fChildEntryDAO.update(existing);
  }
 else {
    ChildEntry entry=new ChildEntryImpl(key,node);
    AVMDAOs.Instance().fAVMNodeDAO.flush();
    AVMDAOs.Instance().fChildEntryDAO.save(entry);
  }
}

Fixed version (ground truth):
/** 
 * Insert a child node without COW.
 * @param name The name to give the child.
 */
public void putChild(String name,AVMNode node){
  ChildKey key=new ChildKey(this,name);
  ChildEntry existing=AVMDAOs.Instance().fChildEntryDAO.get(key);
  if (existing != null) {
    AVMDAOs.Instance().fChildEntryDAO.delete(existing);
  }
  ChildEntry entry=new ChildEntryImpl(key,node);
  AVMDAOs.Instance().fAVMNodeDAO.flush();
  AVMDAOs.Instance().fChildEntryDAO.save(entry);
}
Program: 172302
Project: 172302
Buggy source:
/** 
 * Put a new child node into this directory.  No copy.
 * @param name The name of the child.
 * @param node The node to add.
 */
public void putChild(String name,AVMNode node){
  ChildKey key=new ChildKey(this,name);
  ChildEntry existing=AVMDAOs.Instance().fChildEntryDAO.get(key);
  if (existing != null) {
    existing.setChild(node);
    AVMDAOs.Instance().fChildEntryDAO.update(existing);
  }
 else {
    ChildEntry entry=new ChildEntryImpl(key,node);
    AVMDAOs.Instance().fAVMNodeDAO.flush();
    AVMDAOs.Instance().fChildEntryDAO.save(entry);
  }
}

Fixed version (ground truth):
/** 
 * Put a new child node into this directory.  No copy.
 * @param name The name of the child.
 * @param node The node to add.
 */
public void putChild(String name,AVMNode node){
  ChildKey key=new ChildKey(this,name);
  ChildEntry existing=AVMDAOs.Instance().fChildEntryDAO.get(key);
  if (existing != null) {
    AVMDAOs.Instance().fChildEntryDAO.delete(existing);
  }
  ChildEntry entry=new ChildEntryImpl(key,node);
  AVMDAOs.Instance().fAVMNodeDAO.flush();
  AVMDAOs.Instance().fChildEntryDAO.save(entry);
}
Program: 172306
Project: 172306
Buggy source:
/** 
 * Insert a child node without COW.
 * @param name The name to give the child.
 */
public void putChild(String name,AVMNode node){
  ChildEntry existing=AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name,this);
  if (existing != null) {
    existing.setChild(node);
    AVMContext.fgInstance.fChildEntryDAO.update(existing);
  }
 else {
    ChildEntry entry=new ChildEntryImpl(name,this,node);
    AVMContext.fgInstance.fChildEntryDAO.save(entry);
  }
  DeletedChild dc=getDeleted(name);
  if (dc != null) {
    AVMContext.fgInstance.fDeletedChildDAO.delete(dc);
  }
}

Fixed version (ground truth):
/** 
 * Insert a child node without COW.
 * @param name The name to give the child.
 */
public void putChild(String name,AVMNode node){
  ChildEntry existing=AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name,this);
  if (existing != null) {
    existing.setChild(node);
    AVMContext.fgInstance.fChildEntryDAO.update(existing);
  }
 else {
    ChildEntry entry=new ChildEntryImpl(name,this,node);
    AVMContext.fgInstance.fAVMNodeDAO.flush();
    AVMContext.fgInstance.fChildEntryDAO.save(entry);
  }
  DeletedChild dc=getDeleted(name);
  if (dc != null) {
    AVMContext.fgInstance.fDeletedChildDAO.delete(dc);
  }
}
Program: 172307
Project: 172307
Buggy source:
/** 
 * Put a new child node into this directory.  No copy.
 * @param name The name of the child.
 * @param node The node to add.
 */
public void putChild(String name,AVMNode node){
  ChildEntry existing=AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name,this);
  if (existing != null) {
    existing.setChild(node);
    AVMContext.fgInstance.fChildEntryDAO.update(existing);
  }
 else {
    ChildEntry entry=new ChildEntryImpl(name,this,node);
    AVMContext.fgInstance.fChildEntryDAO.save(entry);
  }
}

Fixed version (ground truth):
/** 
 * Put a new child node into this directory.  No copy.
 * @param name The name of the child.
 * @param node The node to add.
 */
public void putChild(String name,AVMNode node){
  ChildEntry existing=AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name,this);
  if (existing != null) {
    existing.setChild(node);
    AVMContext.fgInstance.fChildEntryDAO.update(existing);
  }
 else {
    ChildEntry entry=new ChildEntryImpl(name,this,node);
    AVMContext.fgInstance.fAVMNodeDAO.flush();
    AVMContext.fgInstance.fChildEntryDAO.save(entry);
  }
}
Program: 172308
Project: 172308
Buggy source:
/** 
 * Get an entry by name and parent.
 * @param name The name of the child to find.
 * @param parent The parent to look in.
 * @return The ChildEntry or null if not foun.
 */
public ChildEntry getByNameParent(String name,DirectoryNode parent){
  ChildEntry query=new ChildEntryImpl(name,parent,null);
  return (ChildEntry)getSession().get(ChildEntryImpl.class,(Serializable)query);
}

Fixed version (ground truth):
/** 
 * Get an entry by name and parent.
 * @param name The name of the child to find.
 * @param parent The parent to look in.
 * @return The ChildEntry or null if not foun.
 */
public ChildEntry getByNameParent(String name,DirectoryNode parent){
  Query query=getSession().createQuery("String_Node_Str");
  query.setString("String_Node_Str",name);
  query.setEntity("String_Node_Str",parent);
  query.setCacheable(true);
  return (ChildEntry)query.uniqueResult();
}
Program: 172309
Project: 172309
Buggy source:
/** 
 * Lookup a directory specifically.
 * @param version The version to look under.
 * @param path The path to lookup.
 * @return A lookup object.
 */
public Lookup lookupDirectory(int version,String path){
  Integer count=fLookupCount.get();
  if (count == null) {
    fLookupCount.set(1);
  }
 else {
    fLookupCount.set(count + 1);
  }
  if (fLookupCount.get() > 50) {
  }
  String[] pathParts=SplitPath(path);
  AVMStore store=getAVMStoreByName(pathParts[0]);
  return store.lookupDirectory(version,pathParts[1],false);
}

Fixed version (ground truth):
/** 
 * Lookup a directory specifically.
 * @param version The version to look under.
 * @param path The path to lookup.
 * @return A lookup object.
 */
public Lookup lookupDirectory(int version,String path){
  if (fLookupCount.get() > 50) {
    throw new AVMCycleException("String_Node_Str");
  }
  String[] pathParts=SplitPath(path);
  AVMStore store=getAVMStoreByName(pathParts[0]);
  return store.lookupDirectory(version,pathParts[1],false);
}
Program: 172312
Project: 172312
Buggy source:
/** 
 * Execute the script content from the supplied Reader. Adds the data model into the default root scope for access by the script.
 * @param reader        Reader referencing the script to execute.
 * @param model         Data model containing objects to be added to the root scope.
 * @return result of the script execution, can be null.
 * @throws AlfrescoRuntimeException
 */
private Object executeScriptImpl(Reader reader,Map<String,Object> model) throws AlfrescoRuntimeException {
  Context cx=Context.enter();
  try {
    Scriptable topLevelScope=new ImporterTopLevel(cx);
    Scriptable scope=cx.initStandardObjects();
    scope.setParentScope(topLevelScope);
    if (model != null) {
      for (      String key : model.keySet()) {
        Object jsObject=Context.javaToJS(model.get(key),scope);
        ScriptableObject.putProperty(scope,key,jsObject);
      }
    }
    Object result=cx.evaluateReader(scope,reader,"String_Node_Str",1,null);
    return result;
  }
 catch (  Throwable err) {
    throw new AlfrescoRuntimeException(err.getMessage(),err);
  }
 finally {
    cx.exit();
  }
}

Fixed version (ground truth):
/** 
 * Execute the script content from the supplied Reader. Adds the data model into the default root scope for access by the script.
 * @param reader        Reader referencing the script to execute.
 * @param model         Data model containing objects to be added to the root scope.
 * @return result of the script execution, can be null.
 * @throws AlfrescoRuntimeException
 */
private Object executeScriptImpl(Reader reader,Map<String,Object> model) throws AlfrescoRuntimeException {
  long startTime=0;
  if (logger.isDebugEnabled()) {
    startTime=System.currentTimeMillis();
  }
  Context cx=Context.enter();
  try {
    Scriptable topLevelScope=new ImporterTopLevel(cx);
    Scriptable scope=cx.initStandardObjects();
    scope.setParentScope(topLevelScope);
    if (model != null) {
      for (      String key : model.keySet()) {
        Object jsObject=Context.javaToJS(model.get(key),scope);
        ScriptableObject.putProperty(scope,key,jsObject);
      }
    }
    Object result=cx.evaluateReader(scope,reader,"String_Node_Str",1,null);
    return result;
  }
 catch (  Throwable err) {
    throw new AlfrescoRuntimeException(err.getMessage(),err);
  }
 finally {
    cx.exit();
    if (logger.isDebugEnabled()) {
      long endTime=System.currentTimeMillis();
      logger.debug("String_Node_Str" + (endTime - startTime) + "String_Node_Str");
    }
  }
}
Program: 172313
Project: 172313
Buggy source:
/** 
 * @see org.alfresco.service.cmr.repository.TemplateProcessor#process(java.lang.String,java.lang.Object,java.io.Writer)
 */
public void process(String template,Object model,Writer out){
  if (template == null || template.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (model == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (out == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + template + "String_Node_Str"+ model);
    Template t=getConfig().getTemplate(template);
    if (t != null) {
      try {
        t.process(model,out);
      }
 catch (      Throwable err) {
        throw new TemplateException(MSG_ERROR_TEMPLATE_FAIL,new Object[]{err.getMessage()},err);
      }
    }
 else {
      throw new TemplateException(MSG_ERROR_NO_TEMPLATE,new Object[]{template});
    }
  }
 catch (  IOException ioerr) {
    throw new TemplateException(MSG_ERROR_TEMPLATE_IO,new Object[]{template},ioerr);
  }
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.service.cmr.repository.TemplateProcessor#process(java.lang.String,java.lang.Object,java.io.Writer)
 */
public void process(String template,Object model,Writer out){
  if (template == null || template.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (model == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (out == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    long startTime=0;
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + template);
      startTime=System.currentTimeMillis();
    }
    Template t=getConfig().getTemplate(template);
    if (t != null) {
      try {
        t.process(model,out);
      }
 catch (      Throwable err) {
        throw new TemplateException(MSG_ERROR_TEMPLATE_FAIL,new Object[]{err.getMessage()},err);
      }
    }
 else {
      throw new TemplateException(MSG_ERROR_NO_TEMPLATE,new Object[]{template});
    }
    if (logger.isDebugEnabled()) {
      long endTime=System.currentTimeMillis();
      logger.debug("String_Node_Str" + (endTime - startTime) + "String_Node_Str");
    }
  }
 catch (  IOException ioerr) {
    throw new TemplateException(MSG_ERROR_TEMPLATE_IO,new Object[]{template},ioerr);
  }
}
Program: 172314
Project: 172314
Buggy source:
private Configuration getStringConfig(String path,String template){
  Configuration config=new Configuration();
  config.setCacheStorage(new MruCacheStorage(20,0));
  StringTemplateLoader stringTemplateLoader=new StringTemplateLoader();
  stringTemplateLoader.putTemplate(path,template);
  config.setTemplateLoader(stringTemplateLoader);
  config.setObjectWrapper(new QNameAwareObjectWrapper());
  config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
  return config;
}

Fixed version (ground truth):
/** 
 * FreeMarker configuration for loading the specified template directly from a String
 * @param path      Pseudo Path to the template
 * @param template  Template content
 * @return FreeMarker configuration
 */
private Configuration getStringConfig(String path,String template){
  Configuration config=new Configuration();
  StringTemplateLoader stringTemplateLoader=new StringTemplateLoader();
  stringTemplateLoader.putTemplate(path,template);
  config.setTemplateLoader(stringTemplateLoader);
  config.setObjectWrapper(new QNameAwareObjectWrapper());
  config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
  return config;
}