nus-yam/ex-repair huggingface dataset:
Program: 155054
Project: 155054
Buggy source:
void buildResponse(GraphDatabaseService neo,Object transactionId,ResponseVisitor responseState){
}

Fixed version (ground truth):
void buildResponse(GraphDatabaseService graphDb,Object transactionId,ResponseVisitor responseState){
}
Program: 155055
Project: 155055
Buggy source:
Object setRelationshipProperty(GraphDatabaseService neo,long relationshipId,String key,Object value){
  neo.getRelationshipById(relationshipId).setProperty(key,value);
  return null;
}

Fixed version (ground truth):
Object setRelationshipProperty(GraphDatabaseService graphDb,long relationshipId,String key,Object value){
  graphDb.getRelationshipById(relationshipId).setProperty(key,value);
  return null;
}
Program: 155056
Project: 155056
Buggy source:
SimpleIterator<NodeSpecification> getIndexNodes(GraphDatabaseService neo,int indexId,String key,Object value){
  final IndexHits<Node> nodes=indexes[indexId].index.getNodes(key,value);
  return new SimpleIterator<NodeSpecification>(nodes.size()){
    Iterator<Node> iter=nodes.iterator();
    @Override NodeSpecification getNext(){
      return new NodeSpecification(iter.next().getId());
    }
    @Override boolean hasNext(){
      return iter.hasNext();
    }
  }
;
}

Fixed version (ground truth):
SimpleIterator<NodeSpecification> getIndexNodes(GraphDatabaseService graphDb,int indexId,String key,Object value){
  final IndexHits<Node> nodes=indexes[indexId].index.getNodes(key,value);
  return new SimpleIterator<NodeSpecification>(nodes.size()){
    Iterator<Node> iter=nodes.iterator();
    @Override NodeSpecification getNext(){
      return new NodeSpecification(iter.next().getId());
    }
    @Override boolean hasNext(){
      return iter.hasNext();
    }
  }
;
}
Program: 155057
Project: 155057
Buggy source:
Object getNodeProperty(GraphDatabaseService neo,long nodeId,String key){
  return neo.getNodeById(nodeId).getProperty(key,null);
}

Fixed version (ground truth):
Object getNodeProperty(GraphDatabaseService graphDb,long nodeId,String key){
  return graphDb.getNodeById(nodeId).getProperty(key,null);
}
Program: 155058
Project: 155058
Buggy source:
RelationshipSpecification getRelationshipById(GraphDatabaseService neo,long relationshipId){
  return new RelationshipSpecification(neo.getRelationshipById(relationshipId));
}

Fixed version (ground truth):
RelationshipSpecification getRelationshipById(GraphDatabaseService graphDb,long relationshipId){
  return new RelationshipSpecification(graphDb.getRelationshipById(relationshipId));
}
Program: 155059
Project: 155059
Buggy source:
void deleteNode(GraphDatabaseService neo,long nodeId){
  neo.getNodeById(nodeId).delete();
}

Fixed version (ground truth):
void deleteNode(GraphDatabaseService graphDb,long nodeId){
  graphDb.getNodeById(nodeId).delete();
}
Program: 155060
Project: 155060
Buggy source:
void removeIndexNode(GraphDatabaseService neo,int indexId,long nodeId,String key,Object value){
  indexes[indexId].index.removeIndex(neo.getNodeById(nodeId),key,value);
}

Fixed version (ground truth):
void removeIndexNode(GraphDatabaseService graphDb,int indexId,long nodeId,String key,Object value){
  indexes[indexId].index.removeIndex(graphDb.getNodeById(nodeId),key,value);
}
Program: 155061
Project: 155061
Buggy source:
Object setNodeProperty(GraphDatabaseService neo,long nodeId,String key,Object value){
  neo.getNodeById(nodeId).setProperty(key,value);
  return null;
}

Fixed version (ground truth):
Object setNodeProperty(GraphDatabaseService graphDb,long nodeId,String key,Object value){
  graphDb.getNodeById(nodeId).setProperty(key,value);
  return null;
}
Program: 155062
Project: 155062
Buggy source:
SimpleIterator<String> getRelationshipPropertyKeys(GraphDatabaseService neo,long relationshipId){
  final Iterator<String> keys=neo.getRelationshipById(relationshipId).getPropertyKeys().iterator();
  return new SimpleIterator<String>(){
    @Override boolean hasNext(){
      return keys.hasNext();
    }
    @Override String getNext(){
      return keys.next();
    }
  }
;
}

Fixed version (ground truth):
SimpleIterator<String> getRelationshipPropertyKeys(GraphDatabaseService graphDb,long relationshipId){
  final Iterator<String> keys=graphDb.getRelationshipById(relationshipId).getPropertyKeys().iterator();
  return new SimpleIterator<String>(){
    @Override boolean hasNext(){
      return keys.hasNext();
    }
    @Override String getNext(){
      return keys.next();
    }
  }
;
}
Program: 155063
Project: 155063
Buggy source:
void indexNode(GraphDatabaseService neo,int indexId,long nodeId,String key,Object value){
  indexes[indexId].index.index(neo.getNodeById(nodeId),key,value);
}

Fixed version (ground truth):
void indexNode(GraphDatabaseService graphDb,int indexId,long nodeId,String key,Object value){
  indexes[indexId].index.index(graphDb.getNodeById(nodeId),key,value);
}
Program: 155064
Project: 155064
Buggy source:
SimpleIterator<String> getRelationshipTypes(GraphDatabaseService neo){
  final Iterator<RelationshipType> types;
  if (neo instanceof EmbeddedGraphDatabase) {
    types=((EmbeddedGraphDatabase)neo).getRelationshipTypes().iterator();
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  return new SimpleIterator<String>(){
    @Override boolean hasNext(){
      return types.hasNext();
    }
    @Override String getNext(){
      return types.next().name();
    }
  }
;
}

Fixed version (ground truth):
SimpleIterator<String> getRelationshipTypes(GraphDatabaseService graphDb){
  final Iterator<RelationshipType> types;
  if (graphDb instanceof EmbeddedGraphDatabase) {
    types=((EmbeddedGraphDatabase)graphDb).getRelationshipTypes().iterator();
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  return new SimpleIterator<String>(){
    @Override boolean hasNext(){
      return types.hasNext();
    }
    @Override String getNext(){
      return types.next().name();
    }
  }
;
}
Program: 155065
Project: 155065
Buggy source:
SimpleIterator<String> getNodePropertyKeys(GraphDatabaseService neo,long nodeId){
  final Iterator<String> keys=neo.getNodeById(nodeId).getPropertyKeys().iterator();
  return new SimpleIterator<String>(){
    @Override boolean hasNext(){
      return keys.hasNext();
    }
    @Override String getNext(){
      return keys.next();
    }
  }
;
}

Fixed version (ground truth):
SimpleIterator<String> getNodePropertyKeys(GraphDatabaseService graphDb,long nodeId){
  final Iterator<String> keys=graphDb.getNodeById(nodeId).getPropertyKeys().iterator();
  return new SimpleIterator<String>(){
    @Override boolean hasNext(){
      return keys.hasNext();
    }
    @Override String getNext(){
      return keys.next();
    }
  }
;
}
Program: 155066
Project: 155066
Buggy source:
long getReferenceNode(GraphDatabaseService neo){
  return neo.getReferenceNode().getId();
}

Fixed version (ground truth):
long getReferenceNode(GraphDatabaseService graphDb){
  return graphDb.getReferenceNode().getId();
}
Program: 155067
Project: 155067
Buggy source:
void deleteRelationship(GraphDatabaseService neo,long relationshipId){
  neo.getRelationshipById(relationshipId).delete();
}

Fixed version (ground truth):
void deleteRelationship(GraphDatabaseService graphDb,long relationshipId){
  graphDb.getRelationshipById(relationshipId).delete();
}
Program: 155068
Project: 155068
Buggy source:
private void doInternalRecovery(String logFileName) throws IOException {
  log.info("String_Node_Str" + logFileName + "String_Node_Str");
  buffer.clear();
  buffer.limit(8);
  if (fileChannel.read(buffer) != 8) {
    log.info("String_Node_Str" + "String_Node_Str");
    fileChannel.close();
    boolean success=FileUtils.renameFile(new File(logFileName),new File(logFileName + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"));
    assert success;
    fileChannel=new RandomAccessFile(logFileName,"String_Node_Str").getChannel();
    return;
  }
  buffer.flip();
  logVersion=buffer.getLong();
  log.fine("String_Node_Str" + logVersion);
  long logEntriesFound=0;
  while (readEntry()) {
    logEntriesFound++;
  }
  scanIsComplete=true;
  log.fine("String_Node_Str" + logEntriesFound + "String_Node_Str");
  xaRm.checkXids();
  if (xidIdentMap.size() == 0) {
    log.fine("String_Node_Str");
  }
 else {
    log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ xidIdentMap.size()+ "String_Node_Str");
    for (    StartEntry entry : xidIdentMap.values()) {
      log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ entry.getXid()+ "String_Node_Str");
    }
  }
  recoveredTxMap.clear();
}

Fixed version (ground truth):
private void doInternalRecovery(String logFileName) throws IOException {
  log.info("String_Node_Str" + logFileName + "String_Node_Str");
  buffer.clear();
  buffer.limit(8);
  if (fileChannel.read(buffer) != 8) {
    log.info("String_Node_Str" + "String_Node_Str");
    fileChannel.close();
    boolean success=FileUtils.renameFile(new File(logFileName),new File(logFileName + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"));
    assert success;
    fileChannel=new RandomAccessFile(logFileName,"String_Node_Str").getChannel();
    return;
  }
  buffer.flip();
  logVersion=buffer.getLong();
  log.fine("String_Node_Str" + logVersion);
  long logEntriesFound=0;
  long lastEntryPos=fileChannel.position();
  while (readEntry()) {
    logEntriesFound++;
    lastEntryPos=fileChannel.position();
  }
  fileChannel.position(lastEntryPos);
  scanIsComplete=true;
  log.fine("String_Node_Str" + logEntriesFound + "String_Node_Str");
  xaRm.checkXids();
  if (xidIdentMap.size() == 0) {
    log.fine("String_Node_Str");
  }
 else {
    log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ xidIdentMap.size()+ "String_Node_Str");
    for (    StartEntry entry : xidIdentMap.values()) {
      log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ entry.getXid()+ "String_Node_Str");
    }
  }
  recoveredTxMap.clear();
}
Program: 155069
Project: 155069
Buggy source:
static Command readCommand(NeoStore neoStore,ReadableByteChannel byteChannel,ByteBuffer buffer) throws IOException {
  buffer.clear();
  buffer.limit(1);
  if (byteChannel.read(buffer) != buffer.limit()) {
    return null;
  }
  buffer.flip();
  byte commandType=buffer.get();
switch (commandType) {
case NODE_COMMAND:
    return NodeCommand.readCommand(neoStore,byteChannel,buffer);
case PROP_COMMAND:
  return PropertyCommand.readCommand(neoStore,byteChannel,buffer);
case PROP_INDEX_COMMAND:
return PropertyIndexCommand.readCommand(neoStore,byteChannel,buffer);
case REL_COMMAND:
return RelationshipCommand.readCommand(neoStore,byteChannel,buffer);
case REL_TYPE_COMMAND:
return RelationshipTypeCommand.readCommand(neoStore,byteChannel,buffer);
default :
throw new IOException("String_Node_Str" + commandType + "String_Node_Str");
}
}

Fixed version (ground truth):
static Command readCommand(NeoStore neoStore,ReadableByteChannel byteChannel,ByteBuffer buffer) throws IOException {
  buffer.clear();
  buffer.limit(1);
  if (byteChannel.read(buffer) != buffer.limit()) {
    return null;
  }
  buffer.flip();
  byte commandType=buffer.get();
switch (commandType) {
case NODE_COMMAND:
    return NodeCommand.readCommand(neoStore,byteChannel,buffer);
case PROP_COMMAND:
  return PropertyCommand.readCommand(neoStore,byteChannel,buffer);
case PROP_INDEX_COMMAND:
return PropertyIndexCommand.readCommand(neoStore,byteChannel,buffer);
case REL_COMMAND:
return RelationshipCommand.readCommand(neoStore,byteChannel,buffer);
case REL_TYPE_COMMAND:
return RelationshipTypeCommand.readCommand(neoStore,byteChannel,buffer);
case NONE:
return null;
default :
throw new IOException("String_Node_Str" + commandType + "String_Node_Str");
}
}
Program: 155070
Project: 155070
Buggy source:
private void truncateLogicalLog(int size) throws IOException {
  char active='1';
  FileChannel af=new RandomAccessFile("String_Node_Str","String_Node_Str").getChannel();
  ByteBuffer buffer=ByteBuffer.allocate(1024);
  af.read(buffer);
  af.close();
  buffer.flip();
  active=buffer.asCharBuffer().get();
  buffer.clear();
  FileChannel fileChannel=new RandomAccessFile("String_Node_Str" + active,"String_Node_Str").getChannel();
  if (size < 0) {
    fileChannel.truncate(fileChannel.size() - 3);
  }
 else {
    fileChannel.truncate(size);
  }
  fileChannel.force(false);
  fileChannel.close();
}

Fixed version (ground truth):
private void truncateLogicalLog(int size) throws IOException {
  char active='1';
  FileChannel af=new RandomAccessFile("String_Node_Str","String_Node_Str").getChannel();
  ByteBuffer buffer=ByteBuffer.allocate(1024);
  af.read(buffer);
  af.close();
  buffer.flip();
  active=buffer.asCharBuffer().get();
  buffer.clear();
  FileChannel fileChannel=new RandomAccessFile("String_Node_Str" + active,"String_Node_Str").getChannel();
  if (fileChannel.size() > size) {
    fileChannel.truncate(size);
  }
 else {
    fileChannel.position(size);
    ByteBuffer buf=ByteBuffer.allocate(1);
    buf.put((byte)0).flip();
    fileChannel.write(buf);
  }
  fileChannel.force(false);
  fileChannel.close();
}
Program: 155071
Project: 155071
Buggy source:
public void testBrokenCommand(){
  try {
    Xid xid=new XidImpl(new byte[4],new byte[4]);
    XAResource xaRes=xaCon.getXaResource();
    xaRes.start(xid,XAResource.TMNOFLAGS);
    int node1=ds.nextId(Node.class);
    xaCon.getNodeConsumer().createNode(node1);
    int node2=ds.nextId(Node.class);
    xaCon.getNodeConsumer().createNode(node2);
    int n1prop1=ds.nextId(PropertyStore.class);
    xaCon.getNodeConsumer().addProperty(node1,n1prop1,index("String_Node_Str"),"String_Node_Str");
    copyLogicalLog();
    xaCon.clearAllTransactions();
    ds.close();
    deleteLogicalLogIfExist();
    renameCopiedLogicalLog();
    truncateLogicalLog(-3);
    ds=new NeoStoreXaDataSource("String_Node_Str","String_Node_Str",lockManager,lockReleaser);
    xaCon=(NeoStoreXaConnection)ds.getXaConnection();
    xaRes=xaCon.getXaResource();
    assertEquals(0,xaRes.recover(XAResource.TMNOFLAGS).length);
    xaCon.clearAllTransactions();
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
public void testBrokenCommand(){
  try {
    Xid xid=new XidImpl(new byte[4],new byte[4]);
    XAResource xaRes=xaCon.getXaResource();
    xaRes.start(xid,XAResource.TMNOFLAGS);
    int node1=ds.nextId(Node.class);
    xaCon.getNodeConsumer().createNode(node1);
    xaRes.end(xid,XAResource.TMSUCCESS);
    xaRes.prepare(xid);
    xaCon.clearAllTransactions();
    copyLogicalLog();
    xaCon.clearAllTransactions();
    ds.close();
    deleteLogicalLogIfExist();
    renameCopiedLogicalLog();
    truncateLogicalLog(32);
    truncateLogicalLog(40);
    ds=new NeoStoreXaDataSource("String_Node_Str","String_Node_Str",lockManager,lockReleaser);
    xaCon=(NeoStoreXaConnection)ds.getXaConnection();
    xaRes=xaCon.getXaResource();
    assertEquals(0,xaRes.recover(XAResource.TMNOFLAGS).length);
    xaCon.clearAllTransactions();
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str" + e);
  }
}
Program: 155072
Project: 155072
Buggy source:
private static PropertyType getType(int type){
switch (type) {
case 1:
    return PropertyType.INT;
case 2:
  return PropertyType.STRING;
case 3:
return PropertyType.BOOL;
case 4:
return PropertyType.DOUBLE;
case 5:
return PropertyType.FLOAT;
case 6:
return PropertyType.LONG;
case 7:
return PropertyType.BYTE;
case 8:
return PropertyType.CHAR;
case 9:
return PropertyType.ARRAY;
case 10:
return PropertyType.SHORT;
}
throw new InvalidRecordException("String_Node_Str" + type);
}

Fixed version (ground truth):
private static PropertyType getType(int type){
switch (type) {
case 1:
    return PropertyType.INT;
case 2:
  return PropertyType.STRING;
case 3:
return PropertyType.BOOL;
case 4:
return PropertyType.DOUBLE;
case 5:
return PropertyType.FLOAT;
case 6:
return PropertyType.LONG;
case 7:
return PropertyType.BYTE;
case 8:
return PropertyType.CHAR;
case 9:
return PropertyType.ARRAY;
case 10:
return PropertyType.SHORT;
case 0:
return null;
}
throw new InvalidRecordException("String_Node_Str" + type);
}
Program: 155074
Project: 155074
Buggy source:
private XaDataSource registerLuceneDataSource(String className,TxModule txModule,String luceneDirectory,LockManager lockManager){
  byte resourceId[]="String_Node_Str".getBytes();
  Map<Object,Object> params=new HashMap<Object,Object>();
  params.put("String_Node_Str",luceneDirectory);
  params.put(LockManager.class,lockManager);
  return txModule.registerDataSource("String_Node_Str",className,resourceId,params,true);
}

Fixed version (ground truth):
private XaDataSource registerLuceneDataSource(String name,String className,TxModule txModule,String luceneDirectory,LockManager lockManager,byte[] resourceId){
  Map<Object,Object> params=new HashMap<Object,Object>();
  params.put("String_Node_Str",luceneDirectory);
  params.put(LockManager.class,lockManager);
  return txModule.registerDataSource(name,className,resourceId,params,true);
}
Program: 155076
Project: 155076
Buggy source:
private Object instantiateOrGetIndexServiceObject(Session session,Output out) throws Exception {
  try {
    Class.forName("String_Node_Str");
  }
 catch (  Exception e) {
    throw new ShellException("String_Node_Str");
  }
  String className=(String)safeGet(session,KEY_INDEX_CLASS_NAME);
  if (className == null) {
    return null;
  }
  IndexServiceContext context=null;
synchronized (this.contexts) {
    context=this.contexts.get(className);
    if (context == null) {
      if (session instanceof SameJvmSession) {
        context=new IndexServiceContext(Class.forName(className).getConstructor(GraphDatabaseService.class).newInstance(this.getServer().getDb()),true);
      }
 else {
        XaDataSourceManager xaManager=((EmbeddedGraphDatabase)getServer().getDb()).getConfig().getTxModule().getXaDataSourceManager();
        String xaName=DATA_SOURCE_NAMES.get(className);
        if (xaName == null) {
          throw new ShellException("String_Node_Str" + className);
        }
        if (!xaManager.hasDataSource(xaName)) {
          throw new ShellException("String_Node_Str" + className + "String_Node_Str");
        }
        XaDataSource dataSource=xaManager.getXaDataSource(xaName);
        Method getterMethod=dataSource.getClass().getDeclaredMethod("String_Node_Str");
        getterMethod.setAccessible(true);
        context=new IndexServiceContext(getterMethod.invoke(dataSource),false);
      }
      this.contexts.put(className,context);
    }
  }
  return context.indexService;
}

Fixed version (ground truth):
private Object instantiateOrGetIndexServiceObject(Session session,Output out) throws Exception {
  try {
    Class.forName("String_Node_Str");
  }
 catch (  Exception e) {
    throw new ShellException("String_Node_Str");
  }
  String className=(String)safeGet(session,KEY_INDEX_CLASS_NAME);
  if (className == null) {
    return null;
  }
  IndexServiceContext context=null;
synchronized (this.contexts) {
    context=this.contexts.get(className);
    if (context == null) {
      if (session instanceof SameJvmSession) {
        context=new IndexServiceContext(Class.forName(className).getConstructor(GraphDatabaseService.class).newInstance(this.getServer().getDb()),true);
      }
 else {
        XaDataSourceManager xaManager=((EmbeddedGraphDatabase)getServer().getDb()).getConfig().getTxModule().getXaDataSourceManager();
        String xaName=DATA_SOURCE_NAMES.get(className);
        if (xaName == null) {
          throw new ShellException("String_Node_Str" + className);
        }
        if (!xaManager.hasDataSource(xaName)) {
          throw new ShellException("String_Node_Str" + className + "String_Node_Str");
        }
        XaDataSource dataSource=xaManager.getXaDataSource(xaName);
        Method getterMethod=dataSource.getClass().getMethod("String_Node_Str");
        getterMethod.setAccessible(true);
        context=new IndexServiceContext(getterMethod.invoke(dataSource),false);
      }
      this.contexts.put(className,context);
    }
  }
  return context.indexService;
}
Program: 155077
Project: 155077
Buggy source:
private boolean ensureFullRelationships(){
  if (relationshipMap == null) {
    this.relChainPosition=nodeManager.getRelationshipChainPosition(this);
    this.relationshipMap=new ArrayMap<String,IntArray>();
    getMoreRelationships();
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean ensureFullRelationships(){
  if (relChainPosition == null) {
    setupMapAndChainPosition();
    getMoreRelationships();
    return true;
  }
  return false;
}
Program: 155078
Project: 155078
Buggy source:
public Relationship getRelationshipById(long id){
  return nodeManager.getRelationshipById((int)id);
}

Fixed version (ground truth):
public Relationship getRelationshipById(long id){
  if (id < 0 || id > Integer.MAX_VALUE * 2l) {
    throw new NotFoundException("String_Node_Str" + id + "String_Node_Str");
  }
  return nodeManager.getRelationshipById((int)id);
}
Program: 155079
Project: 155079
Buggy source:
public Node getNodeById(long id){
  return nodeManager.getNodeById((int)id);
}

Fixed version (ground truth):
public Node getNodeById(long id){
  if (id < 0 || id > Integer.MAX_VALUE * 2l) {
    throw new NotFoundException("String_Node_Str" + id + "String_Node_Str");
  }
  return nodeManager.getNodeById((int)id);
}
Program: 155080
Project: 155080
Buggy source:
public Node getNodeById(int nodeId) throws NotFoundException {
  if (nodeId < 0) {
    throw new IllegalArgumentException("String_Node_Str" + nodeId);
  }
  NodeImpl node=nodeCache.get(nodeId);
  if (node != null) {
    return new NodeProxy(nodeId,this);
  }
  node=new NodeImpl(nodeId,this);
  ReentrantLock loadLock=lockId(nodeId);
  try {
    if (nodeCache.get(nodeId) != null) {
      return new NodeProxy(nodeId,this);
    }
    if (!persistenceManager.loadLightNode(nodeId)) {
      throw new NotFoundException("String_Node_Str" + nodeId + "String_Node_Str");
    }
    nodeCache.put(nodeId,node);
    return new NodeProxy(nodeId,this);
  }
  finally {
    loadLock.unlock();
  }
}

Fixed version (ground truth):
public Node getNodeById(int nodeId) throws NotFoundException {
  NodeImpl node=nodeCache.get(nodeId);
  if (node != null) {
    return new NodeProxy(nodeId,this);
  }
  node=new NodeImpl(nodeId,this);
  ReentrantLock loadLock=lockId(nodeId);
  try {
    if (nodeCache.get(nodeId) != null) {
      return new NodeProxy(nodeId,this);
    }
    if (!persistenceManager.loadLightNode(nodeId)) {
      throw new NotFoundException("String_Node_Str" + nodeId + "String_Node_Str");
    }
    nodeCache.put(nodeId,node);
    return new NodeProxy(nodeId,this);
  }
  finally {
    loadLock.unlock();
  }
}
Program: 155081
Project: 155081
Buggy source:
private ReentrantLock lockId(int id){
  ReentrantLock lock=loadLocks[id % LOCK_STRIPE_COUNT];
  lock.lock();
  return lock;
}

Fixed version (ground truth):
private ReentrantLock lockId(int id){
  int stripe=id % LOCK_STRIPE_COUNT;
  if (stripe < 0) {
    stripe*=-1;
  }
  ReentrantLock lock=loadLocks[stripe];
  lock.lock();
  return lock;
}
Program: 155082
Project: 155082
Buggy source:
public Relationship getRelationshipById(int relId) throws NotFoundException {
  if (relId < 0) {
    throw new IllegalArgumentException("String_Node_Str" + relId);
  }
  RelationshipImpl relationship=relCache.get(relId);
  if (relationship != null) {
    return new RelationshipProxy(relId,this);
  }
  relationship=new RelationshipImpl(relId,this);
  ReentrantLock loadLock=lockId(relId);
  try {
    if (relCache.get(relId) != null) {
      relationship=relCache.get(relId);
      return new RelationshipProxy(relId,this);
    }
    RelationshipData data=persistenceManager.loadLightRelationship(relId);
    if (data == null) {
      throw new NotFoundException("String_Node_Str" + relId + "String_Node_Str");
    }
    int typeId=data.relationshipType();
    RelationshipType type=getRelationshipTypeById(typeId);
    if (type == null) {
      throw new NotFoundException("String_Node_Str" + data.getId() + "String_Node_Str"+ typeId+ "String_Node_Str");
    }
    final int startNodeId=data.firstNode();
    final int endNodeId=data.secondNode();
    relationship=new RelationshipImpl(relId,startNodeId,endNodeId,type,false,this);
    relCache.put(relId,relationship);
    return new RelationshipProxy(relId,this);
  }
  finally {
    loadLock.unlock();
  }
}

Fixed version (ground truth):
public Relationship getRelationshipById(int relId) throws NotFoundException {
  RelationshipImpl relationship=relCache.get(relId);
  if (relationship != null) {
    return new RelationshipProxy(relId,this);
  }
  relationship=new RelationshipImpl(relId,this);
  ReentrantLock loadLock=lockId(relId);
  try {
    if (relCache.get(relId) != null) {
      relationship=relCache.get(relId);
      return new RelationshipProxy(relId,this);
    }
    RelationshipData data=persistenceManager.loadLightRelationship(relId);
    if (data == null) {
      throw new NotFoundException("String_Node_Str" + relId + "String_Node_Str");
    }
    int typeId=data.relationshipType();
    RelationshipType type=getRelationshipTypeById(typeId);
    if (type == null) {
      throw new NotFoundException("String_Node_Str" + data.getId() + "String_Node_Str"+ typeId+ "String_Node_Str");
    }
    final int startNodeId=data.firstNode();
    final int endNodeId=data.secondNode();
    relationship=new RelationshipImpl(relId,startNodeId,endNodeId,type,false,this);
    relCache.put(relId,relationship);
    return new RelationshipProxy(relId,this);
  }
  finally {
    loadLock.unlock();
  }
}
Program: 155083
Project: 155083
Buggy source:
private List<PropertyContainer> constructPath(boolean includeNodes,boolean includeRels){
  LinkedList<PropertyContainer> path=new LinkedList<PropertyContainer>();
  Relationship rel=firstSet.get(matchNode);
  Node currentNode=matchNode;
  while (rel != null) {
    if (includeRels) {
      path.addFirst(rel);
    }
    currentNode=rel.getOtherNode(currentNode);
    if (includeNodes && !currentNode.equals(matchNode) && !currentNode.equals(startNode)) {
      path.addFirst(currentNode);
    }
    rel=firstSet.get(currentNode);
  }
  if (includeNodes) {
    path.addFirst(startNode);
    if (!matchNode.equals(startNode)) {
      path.addLast(matchNode);
    }
  }
  rel=secondSet.get(matchNode);
  currentNode=matchNode;
  while (rel != null) {
    if (includeRels) {
      path.addLast(rel);
    }
    currentNode=rel.getOtherNode(currentNode);
    if (includeNodes && !currentNode.equals(endNode)) {
      path.addLast(currentNode);
    }
    rel=firstSet.get(currentNode);
  }
  if (includeNodes && !endNode.equals(matchNode)) {
    path.addLast(endNode);
  }
  return path;
}

Fixed version (ground truth):
private List<PropertyContainer> constructPath(boolean includeNodes,boolean includeRels){
  LinkedList<PropertyContainer> path=new LinkedList<PropertyContainer>();
  Relationship rel=firstSet.get(matchNode);
  Node currentNode=matchNode;
  while (rel != NULL_REL && rel != null) {
    if (includeRels) {
      path.addFirst(rel);
    }
    currentNode=rel.getOtherNode(currentNode);
    if (includeNodes && !currentNode.equals(matchNode) && !currentNode.equals(startNode)) {
      path.addFirst(currentNode);
    }
    rel=firstSet.get(currentNode);
  }
  if (includeNodes) {
    path.addFirst(startNode);
    if (!matchNode.equals(startNode)) {
      path.addLast(matchNode);
    }
  }
  rel=secondSet.get(matchNode);
  currentNode=matchNode;
  while (rel != NULL_REL && rel != null) {
    if (includeRels) {
      path.addLast(rel);
    }
    currentNode=rel.getOtherNode(currentNode);
    if (includeNodes && !currentNode.equals(endNode)) {
      path.addLast(currentNode);
    }
    rel=firstSet.get(currentNode);
  }
  if (includeNodes && !endNode.equals(matchNode)) {
    path.addLast(endNode);
  }
  return path;
}
Program: 155085
Project: 155085
Buggy source:
/** 
 * /--2--A--7--B--2--\ S E \----7---C---7----/
 */
public void testPathConstruct(){
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  FindSingleShortestPath findPath=getFindPath(graph,"String_Node_Str","String_Node_Str",Integer.MAX_VALUE);
  assertTrue(findPath.getPathAsNodes() != null);
  assertTrue(findPath.getPathAsNodes().size() == 3);
}

Fixed version (ground truth):
/** 
 * /--2--A--7--B--2--\ S E \----7---C---7----/
 */
public void testPathConstruct(){
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  graph.makeEdge("String_Node_Str","String_Node_Str","String_Node_Str",(double)1);
  FindSingleShortestPath findPath=getFindPath(graph,"String_Node_Str","String_Node_Str",Integer.MAX_VALUE);
  assertTrue(findPath.getPathAsNodes() != null);
  assertTrue(findPath.getPathAsNodes().size() == 4);
}
Program: 155086
Project: 155086
Buggy source:
private List<PropertyContainer> constructPath(boolean includeNodes,boolean includeRels){
  LinkedList<PropertyContainer> path=new LinkedList<PropertyContainer>();
  Relationship rel=firstSet.get(matchNode);
  Node currentNode=matchNode;
  while (rel != NULL_REL && rel != null) {
    if (includeRels) {
      path.addFirst(rel);
    }
    currentNode=rel.getOtherNode(currentNode);
    if (includeNodes && !currentNode.equals(matchNode) && !currentNode.equals(startNode)) {
      path.addFirst(currentNode);
    }
    rel=firstSet.get(currentNode);
  }
  if (includeNodes) {
    path.addFirst(startNode);
    if (!matchNode.equals(startNode)) {
      path.addLast(matchNode);
    }
  }
  rel=secondSet.get(matchNode);
  currentNode=matchNode;
  while (rel != NULL_REL && rel != null) {
    if (includeRels) {
      path.addLast(rel);
    }
    currentNode=rel.getOtherNode(currentNode);
    if (includeNodes && !currentNode.equals(endNode)) {
      path.addLast(currentNode);
    }
    rel=firstSet.get(currentNode);
  }
  if (includeNodes && !endNode.equals(matchNode)) {
    path.addLast(endNode);
  }
  return path;
}

Fixed version (ground truth):
private List<PropertyContainer> constructPath(boolean includeNodes,boolean includeRels){
  LinkedList<PropertyContainer> path=new LinkedList<PropertyContainer>();
  Relationship rel=firstSet.get(matchNode);
  Node currentNode=matchNode;
  while (rel != NULL_REL && rel != null) {
    if (includeRels) {
      path.addFirst(rel);
    }
    currentNode=rel.getOtherNode(currentNode);
    if (includeNodes && !currentNode.equals(matchNode) && !currentNode.equals(startNode)) {
      path.addFirst(currentNode);
    }
    rel=firstSet.get(currentNode);
  }
  if (includeNodes) {
    path.addFirst(startNode);
    if (!matchNode.equals(startNode)) {
      path.addLast(matchNode);
    }
  }
  rel=secondSet.get(matchNode);
  currentNode=matchNode;
  while (rel != NULL_REL && rel != null) {
    if (includeRels) {
      path.addLast(rel);
    }
    currentNode=rel.getOtherNode(currentNode);
    if (includeNodes && !currentNode.equals(endNode)) {
      path.addLast(currentNode);
    }
    rel=secondSet.get(currentNode);
  }
  if (includeNodes && !endNode.equals(matchNode)) {
    path.addLast(endNode);
  }
  return path;
}
Program: 155087
Project: 155087
Buggy source:
public String getReplacement(ShellServer server,Session session) throws ShellException {
  return GraphDatabaseApp.getDisplayName((GraphDatabaseShellServer)server,session,GraphDatabaseApp.getCurrent((GraphDatabaseShellServer)server,session)).toString();
}

Fixed version (ground truth):
public String getReplacement(ShellServer server,Session session) throws ShellException {
  return GraphDatabaseApp.getDisplayName((GraphDatabaseShellServer)server,session,GraphDatabaseApp.getCurrent((GraphDatabaseShellServer)server,session),false).toString();
}
Program: 155089
Project: 155089
Buggy source:
protected String getDisplayNameForCurrent(Session session) throws ShellException {
  NodeOrRelationship current=getCurrent(session);
  return current.isNode() ? "String_Node_Str" : "String_Node_Str";
}

Fixed version (ground truth):
private static String getDisplayNameForCurrent(GraphDatabaseShellServer server,Session session) throws ShellException {
  NodeOrRelationship current=getCurrent(server,session);
  return current.isNode() ? "String_Node_Str" : "String_Node_Str";
}
Program: 155090
Project: 155090
Buggy source:
/** 
 * @param server the {@link GraphDatabaseShellServer} to run at.
 * @param session the {@link Session} used by the client.
 * @param relationship the {@link Relationship} to get a display name for.
 * @param verbose whether or not to include the relationship id as well.
 * @return a display string for the {@code relationship}.
 */
public static String getDisplayName(GraphDatabaseShellServer server,Session session,Relationship relationship,boolean verbose){
  StringBuffer result=new StringBuffer("String_Node_Str");
  if (verbose) {
    result.append(relationship.getId() + "String_Node_Str");
  }
  result.append(relationship.getType().name() + "String_Node_Str");
  return result.toString();
}

Fixed version (ground truth):
/** 
 * @param server the {@link GraphDatabaseShellServer} to run at.
 * @param session the {@link Session} used by the client.
 * @param relationship the {@link Relationship} to get a display name for.
 * @param verbose whether or not to include the relationship id as well.
 * @return a display string for the {@code relationship}.
 */
public static String getDisplayName(GraphDatabaseShellServer server,Session session,Relationship relationship,boolean verbose,boolean checkForMe) throws ShellException {
  if (checkForMe && isCurrent(session,NodeOrRelationship.wrap(relationship))) {
    return getDisplayNameForCurrent(server,session);
  }
  StringBuffer result=new StringBuffer("String_Node_Str");
  if (verbose) {
    result.append(relationship.getId() + "String_Node_Str");
  }
  result.append(relationship.getType().name() + "String_Node_Str");
  return result.toString();
}
Program: 155091
Project: 155091
Buggy source:
private void displayRelationships(NodeOrRelationship thing,Session session,Output out,boolean verbose,Direction direction,String prefixString,String postfixString,Map<String,Object> filterMap,boolean caseInsensitiveFilters,boolean looseFilters) throws ShellException, RemoteException {
  for (  Relationship rel : sortRelationships(thing.getRelationships(direction))) {
    String type=rel.getType().name();
    boolean matches=filterMap.isEmpty();
    for (    String filter : filterMap.keySet()) {
      if (matches(newPattern(filter,caseInsensitiveFilters),type,caseInsensitiveFilters,looseFilters)) {
        matches=true;
        break;
      }
    }
    if (!matches) {
      continue;
    }
    StringBuffer buf=new StringBuffer(getDisplayNameForCurrent(session));
    buf.append("String_Node_Str" + prefixString).append(getDisplayName(getServer(),session,rel,verbose));
    buf.append(postfixString + "String_Node_Str");
    buf.append(getDisplayName(getServer(),session,direction == Direction.OUTGOING ? rel.getEndNode() : rel.getStartNode()));
    out.println(buf);
  }
}

Fixed version (ground truth):
private void displayRelationships(NodeOrRelationship thing,Session session,Output out,boolean verbose,Direction direction,String prefixString,String postfixString,Map<String,Object> filterMap,boolean caseInsensitiveFilters,boolean looseFilters) throws ShellException, RemoteException {
  for (  Relationship rel : sortRelationships(thing.getRelationships(direction))) {
    String type=rel.getType().name();
    boolean matches=filterMap.isEmpty();
    for (    String filter : filterMap.keySet()) {
      if (matches(newPattern(filter,caseInsensitiveFilters),type,caseInsensitiveFilters,looseFilters)) {
        matches=true;
        break;
      }
    }
    if (!matches) {
      continue;
    }
    StringBuffer buf=new StringBuffer(getDisplayName(getServer(),session,thing,true));
    buf.append("String_Node_Str" + prefixString).append(getDisplayName(getServer(),session,rel,verbose,true));
    buf.append(postfixString + "String_Node_Str");
    buf.append(getDisplayName(getServer(),session,direction == Direction.OUTGOING ? rel.getEndNode() : rel.getStartNode(),true));
    out.println(buf);
  }
}
Program: 155092
Project: 155092
Buggy source:
@Override protected String exec(AppCommandParser parser,Session session,Output out) throws ShellException, RemoteException {
  assertCurrentIsNode(session);
  boolean createNode=parser.options().containsKey("String_Node_Str");
  boolean suppliedNode=parser.options().containsKey("String_Node_Str");
  Node node=null;
  if (createNode) {
    node=getServer().getDb().createNode();
  }
 else   if (suppliedNode) {
    node=getNodeById(Long.parseLong(parser.options().get("String_Node_Str")));
  }
 else {
    throw new ShellException("String_Node_Str" + "String_Node_Str");
  }
  if (parser.options().get("String_Node_Str") == null) {
    throw new ShellException("String_Node_Str" + "String_Node_Str");
  }
  RelationshipType type=this.getRelationshipType(parser.options().get("String_Node_Str"));
  Direction direction=this.getDirection(parser.options().get("String_Node_Str"));
  Node currentNode=getCurrent(session).asNode();
  Node startNode=direction == Direction.OUTGOING ? currentNode : node;
  Node endNode=direction == Direction.OUTGOING ? node : currentNode;
  Relationship relationship=startNode.createRelationshipTo(endNode,type);
  boolean verbose=parser.options().containsKey("String_Node_Str");
  if (createNode && verbose) {
    out.println("String_Node_Str" + getDisplayName(getServer(),session,node) + "String_Node_Str");
  }
  if (verbose) {
    out.println("String_Node_Str" + getDisplayName(getServer(),session,relationship,true) + "String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
@Override protected String exec(AppCommandParser parser,Session session,Output out) throws ShellException, RemoteException {
  assertCurrentIsNode(session);
  boolean createNode=parser.options().containsKey("String_Node_Str");
  boolean suppliedNode=parser.options().containsKey("String_Node_Str");
  Node node=null;
  if (createNode) {
    node=getServer().getDb().createNode();
  }
 else   if (suppliedNode) {
    node=getNodeById(Long.parseLong(parser.options().get("String_Node_Str")));
  }
 else {
    throw new ShellException("String_Node_Str" + "String_Node_Str");
  }
  if (parser.options().get("String_Node_Str") == null) {
    throw new ShellException("String_Node_Str" + "String_Node_Str");
  }
  RelationshipType type=this.getRelationshipType(parser.options().get("String_Node_Str"));
  Direction direction=this.getDirection(parser.options().get("String_Node_Str"));
  Node currentNode=getCurrent(session).asNode();
  Node startNode=direction == Direction.OUTGOING ? currentNode : node;
  Node endNode=direction == Direction.OUTGOING ? node : currentNode;
  Relationship relationship=startNode.createRelationshipTo(endNode,type);
  boolean verbose=parser.options().containsKey("String_Node_Str");
  if (createNode && verbose) {
    out.println("String_Node_Str" + getDisplayName(getServer(),session,node,false) + "String_Node_Str");
  }
  if (verbose) {
    out.println("String_Node_Str" + getDisplayName(getServer(),session,relationship,true,false) + "String_Node_Str");
  }
  return null;
}
Program: 155093
Project: 155093
Buggy source:
@Override protected String exec(AppCommandParser parser,Session session,Output out) throws ShellException, RemoteException {
  NodeOrRelationship current=this.getCurrent(session);
  out.println("String_Node_Str" + getDisplayName(getServer(),session,current));
  String path=stringifyPath(Cd.readPaths(session),session);
  if (path.length() > 0) {
    out.println(path);
  }
  return null;
}

Fixed version (ground truth):
@Override protected String exec(AppCommandParser parser,Session session,Output out) throws ShellException, RemoteException {
  NodeOrRelationship current=this.getCurrent(session);
  out.println("String_Node_Str" + getDisplayName(getServer(),session,current,false));
  String path=stringifyPath(Cd.readPaths(session),session);
  if (path.length() > 0) {
    out.println(path);
  }
  return null;
}
Program: 155094
Project: 155094
Buggy source:
private String stringifyPath(List<TypedId> pathIds,Session session) throws ShellException {
  if (pathIds.isEmpty()) {
    return "String_Node_Str";
  }
  StringBuilder path=new StringBuilder();
  for (  TypedId id : pathIds) {
    path.append(getDisplayName(getServer(),session,id)).append("String_Node_Str");
  }
  return path.append(getDisplayNameForCurrent(session)).toString();
}

Fixed version (ground truth):
private String stringifyPath(List<TypedId> pathIds,Session session) throws ShellException {
  if (pathIds.isEmpty()) {
    return "String_Node_Str";
  }
  StringBuilder path=new StringBuilder();
  for (  TypedId id : pathIds) {
    path.append(getDisplayName(getServer(),session,id,false)).append("String_Node_Str");
  }
  return path.append(getDisplayName(getServer(),session,getCurrent(session),true)).toString();
}
Program: 155095
Project: 155095
Buggy source:
@Override protected String exec(AppCommandParser parser,Session session,Output out) throws ShellException {
  assertCurrentIsNode(session);
  if (parser.arguments().isEmpty()) {
    throw new ShellException("String_Node_Str");
  }
  Node currentNode=this.getCurrent(session).asNode();
  Relationship rel=findRel(currentNode,Long.parseLong(parser.arguments().get(0)));
  rel.delete();
  if (!currentNode.equals(getServer().getDb().getReferenceNode()) && !currentNode.getRelationships().iterator().hasNext()) {
    throw new ShellException("String_Node_Str" + currentNode + "String_Node_Str");
  }
  Node otherNode=rel.getOtherNode(currentNode);
  if (!otherNode.getRelationships().iterator().hasNext()) {
    boolean deleteOtherNodeWhenEmpty=parser.options().containsKey("String_Node_Str");
    if (!deleteOtherNodeWhenEmpty) {
      throw new ShellException("String_Node_Str" + getDisplayName(getServer(),session,otherNode) + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ otherNode+ "String_Node_Str");
    }
    otherNode.delete();
  }
 else {
    if (!this.hasPathToRefNode(otherNode)) {
      throw new ShellException("String_Node_Str" + otherNode + "String_Node_Str");
    }
    if (!this.hasPathToRefNode(currentNode)) {
      throw new ShellException("String_Node_Str" + currentNode + "String_Node_Str");
    }
  }
  return null;
}

Fixed version (ground truth):
@Override protected String exec(AppCommandParser parser,Session session,Output out) throws ShellException {
  assertCurrentIsNode(session);
  if (parser.arguments().isEmpty()) {
    throw new ShellException("String_Node_Str");
  }
  Node currentNode=this.getCurrent(session).asNode();
  Relationship rel=findRel(currentNode,Long.parseLong(parser.arguments().get(0)));
  rel.delete();
  if (!currentNode.equals(getServer().getDb().getReferenceNode()) && !currentNode.getRelationships().iterator().hasNext()) {
    throw new ShellException("String_Node_Str" + currentNode + "String_Node_Str");
  }
  Node otherNode=rel.getOtherNode(currentNode);
  if (!otherNode.getRelationships().iterator().hasNext()) {
    boolean deleteOtherNodeWhenEmpty=parser.options().containsKey("String_Node_Str");
    if (!deleteOtherNodeWhenEmpty) {
      throw new ShellException("String_Node_Str" + getDisplayName(getServer(),session,otherNode,false) + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ otherNode+ "String_Node_Str");
    }
    otherNode.delete();
  }
 else {
    if (!this.hasPathToRefNode(otherNode)) {
      throw new ShellException("String_Node_Str" + otherNode + "String_Node_Str");
    }
    if (!this.hasPathToRefNode(currentNode)) {
      throw new ShellException("String_Node_Str" + currentNode + "String_Node_Str");
    }
  }
  return null;
}
Program: 155098
Project: 155098
Buggy source:
public void commit(){
  if (tx != null) {
    tx.success();
    tx.finish();
  }
}

Fixed version (ground truth):
public void commit(){
  if (tx != null) {
    tx.success();
    tx.finish();
    tx=null;
  }
}
Program: 155099
Project: 155099
Buggy source:
public void tearDown(){
  tx.finish();
  graphDb.shutdown();
}

Fixed version (ground truth):
public void tearDown(){
  if (tx != null) {
    tx.finish();
  }
  graphDb.shutdown();
}
Program: 155100
Project: 155100
Buggy source:
/** 
 * A non-standard Convenience method that loads a standard property file and converts it into a generic <Code>Map<String,String></CODE>. Will most  likely be removed in future releases.
 * @param file the property file to load
 * @return a map containing the properties from the file
 * @throws IllegalArgumentException if file does not exist
 */
public static Map<String,String> loadConfigurations(String file){
  Properties props=new Properties();
  try {
    FileInputStream stream=new FileInputStream(new File(file));
    try {
      props.load(stream);
    }
  finally {
      stream.close();
    }
  }
 catch (  Exception e) {
    throw new IllegalArgumentException("String_Node_Str" + file,e);
  }
  Set<Entry<Object,Object>> entries=props.entrySet();
  Map<String,String> stringProps=new HashMap<String,String>();
  for (  Entry entry : entries) {
    String key=(String)entry.getKey();
    String value=(String)entry.getValue();
    stringProps.put(key,value);
  }
  return stringProps;
}

Fixed version (ground truth):
/** 
 * A non-standard Convenience method that loads a standard property file and converts it into a generic <Code>Map<String,String></CODE>. Will most  likely be removed in future releases.
 * @param file the property file to load
 * @return a map containing the properties from the file
 * @throws IllegalArgumentException if file does not exist
 */
public static Map<String,String> loadConfigurations(String file){
  Properties props=new Properties();
  try {
    FileInputStream stream=new FileInputStream(new File(file));
    try {
      props.load(stream);
    }
  finally {
      stream.close();
    }
  }
 catch (  Exception e) {
    throw new IllegalArgumentException("String_Node_Str" + file,e);
  }
  Set<Entry<Object,Object>> entries=props.entrySet();
  Map<String,String> stringProps=new HashMap<String,String>();
  for (  Entry<Object,Object> entry : entries) {
    String key=(String)entry.getKey();
    String value=(String)entry.getValue();
    stringProps.put(key,value);
  }
  return stringProps;
}