Program: 113832
Project: 113832
Buggy source:
public void testAccessControl() throws Exception {
  final String authString1=NullAuthProvider.createAuthString("String_Node_Str",MRCClient.generateStringList("String_Node_Str"));
  final String authString2=NullAuthProvider.createAuthString("String_Node_Str",MRCClient.generateStringList("String_Node_Str"));
  final String authString3=NullAuthProvider.createAuthString("String_Node_Str",MRCClient.generateStringList("String_Node_Str"));
  final String noACVolumeName="String_Node_Str";
  final String volACVolumeName="String_Node_Str";
  final String posixVolName="String_Node_Str";
  Map<String,Object> acl=new HashMap<String,Object>();
  acl.put("String_Node_Str",0);
  acl.put("String_Node_Str",(1 << 0) | (1 << 1));
  acl.put("String_Node_Str",1);
  client.createVolume(mrc1Address,noACVolumeName,RandomSelectionPolicy.POLICY_ID,null,YesToAnyoneFileAccessPolicy.POLICY_ID,DefaultPartitioningPolicy.POLICY_ID,null,authString1);
  client.createFile(mrc1Address,noACVolumeName + "String_Node_Str",authString1);
  client.changeOwner(mrc1Address,noACVolumeName + "String_Node_Str","String_Node_Str","String_Node_Str",authString1);
  Map<String,Object> stat=client.stat(mrc1Address,noACVolumeName + "String_Node_Str",false,false,false,authString3);
  assertEquals("String_Node_Str",stat.get("String_Node_Str"));
  assertEquals("String_Node_Str",stat.get("String_Node_Str"));
  client.delete(mrc1Address,noACVolumeName + "String_Node_Str",authString3);
  client.createDir(mrc1Address,noACVolumeName + "String_Node_Str",null,0,authString1);
  client.createFile(mrc1Address,noACVolumeName + "String_Node_Str",authString2);
  final String someone=NullAuthProvider.createAuthString("String_Node_Str",MRCClient.generateStringList("String_Node_Str"));
  assertTrue(client.checkAccess(mrc1Address,noACVolumeName + "String_Node_Str","String_Node_Str",someone));
  client.createVolume(mrc1Address,volACVolumeName,RandomSelectionPolicy.POLICY_ID,null,VolumeACLFileAccessPolicy.POLICY_ID,DefaultPartitioningPolicy.POLICY_ID,null,authString1);
  client.setACLEntries(mrc1Address,volACVolumeName,acl,authString1);
  client.createDir(mrc1Address,volACVolumeName + "String_Node_Str",null,0,authString1);
  try {
    client.createDir(mrc1Address,volACVolumeName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  Exception exc) {
  }
  assertEquals(0,client.readDir(mrc1Address,volACVolumeName + "String_Node_Str",authString1).size());
  assertEquals(0,client.readDir(mrc1Address,volACVolumeName + "String_Node_Str",authString2).size());
  try {
    client.readDir(mrc1Address,volACVolumeName + "String_Node_Str",authString3);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  client.createFile(mrc1Address,volACVolumeName + "String_Node_Str",authString1);
  client.createVolume(mrc1Address,posixVolName,RandomSelectionPolicy.POLICY_ID,null,POSIXFileAccessPolicy.POLICY_ID,DefaultPartitioningPolicy.POLICY_ID,null,authString1);
  client.changeAccessMode(mrc1Address,posixVolName,0700,authString1);
  client.createDir(mrc1Address,posixVolName + "String_Node_Str",authString1);
  assertTrue(client.checkAccess(mrc1Address,posixVolName + "String_Node_Str","String_Node_Str",authString1));
  try {
    client.createDir(mrc1Address,posixVolName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  Map<String,Object> statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,true,authString1);
  acl=(Map<String,Object>)statInfo.get("String_Node_Str");
  assertEquals(0,acl.size());
  Map<String,Object> newEntries=new HashMap<String,Object>();
  newEntries.put("String_Node_Str",5);
  try {
    client.setACLEntries(mrc1Address,posixVolName + "String_Node_Str",newEntries,authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  newEntries.clear();
  newEntries.put("String_Node_Str",2);
  newEntries.put("String_Node_Str",3);
  client.setACLEntries(mrc1Address,posixVolName + "String_Node_Str",newEntries,authString1);
  statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,true,authString1);
  acl=(Map<String,Object>)statInfo.get("String_Node_Str");
  assertEquals(4,acl.size());
  assertEquals(511L,acl.get("String_Node_Str"));
  assertEquals(2L,acl.get("String_Node_Str"));
  assertEquals(511L,acl.get("String_Node_Str"));
  assertEquals(3L,acl.get("String_Node_Str"));
  client.changeAccessMode(mrc1Address,posixVolName + "String_Node_Str",0,authString1);
  statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,true,authString1);
  acl=(Map<String,Object>)statInfo.get("String_Node_Str");
  assertEquals(4,acl.size());
  assertEquals(0L,acl.get("String_Node_Str"));
  assertEquals(0L,acl.get("String_Node_Str"));
  assertEquals(0L,acl.get("String_Node_Str"));
  assertEquals(0L,acl.get("String_Node_Str"));
  try {
    client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString1);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  try {
    client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  newEntries.clear();
  newEntries.put("String_Node_Str",511);
  newEntries.put("String_Node_Str",511);
  client.setACLEntries(mrc1Address,posixVolName + "String_Node_Str",newEntries,authString1);
  try {
    client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  client.setACLEntries(mrc1Address,posixVolName,newEntries,authString1);
  assertTrue(client.checkAccess(mrc1Address,posixVolName + "String_Node_Str","String_Node_Str",authString2));
  assertEquals(0,client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString2).size());
  client.removeACLEntries(mrc1Address,posixVolName + "String_Node_Str",new ArrayList<Object>(newEntries.keySet()),authString1);
  try {
    client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  client.changeAccessMode(mrc1Address,posixVolName,0005,authString1);
  assertEquals(1,client.readDir(mrc1Address,posixVolName,authString3).size());
  assertFalse(client.checkAccess(mrc1Address,posixVolName,"String_Node_Str",authString3));
  client.deleteVolume(mrc1Address,posixVolName,authString1);
  client.createVolume(mrc1Address,posixVolName,RandomSelectionPolicy.POLICY_ID,null,POSIXFileAccessPolicy.POLICY_ID,DefaultPartitioningPolicy.POLICY_ID,null,authString1);
  client.createFile(mrc1Address,posixVolName + "String_Node_Str",null,null,224,authString1);
  statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,false,authString1);
  long accessMode=(Long)statInfo.get("String_Node_Str");
  assertEquals(224,accessMode);
  client.changeAccessMode(mrc1Address,posixVolName + "String_Node_Str",accessMode & 192,authString1);
  statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,false,authString1);
  accessMode=(Long)statInfo.get("String_Node_Str");
  assertEquals(192,accessMode);
  client.changeAccessMode(mrc1Address,posixVolName,511,authString1);
  client.createDir(mrc1Address,posixVolName + "String_Node_Str",null,511,authString1);
  client.createFile(mrc1Address,posixVolName + "String_Node_Str",authString2);
  client.delete(mrc1Address,posixVolName + "String_Node_Str",authString1);
  client.createFile(mrc1Address,posixVolName + "String_Node_Str",authString2);
  client.move(mrc1Address,posixVolName + "String_Node_Str",posixVolName + "String_Node_Str",authString1);
  client.createFile(mrc1Address,posixVolName + "String_Node_Str",authString2);
  client.changeAccessMode(mrc1Address,posixVolName + "String_Node_Str",512 | 511,authString1);
  try {
    client.delete(mrc1Address,posixVolName + "String_Node_Str",authString1);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  try {
    client.move(mrc1Address,posixVolName + "String_Node_Str",posixVolName + "String_Node_Str",authString1);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  client.move(mrc1Address,posixVolName + "String_Node_Str",posixVolName + "String_Node_Str",authString2);
  client.delete(mrc1Address,posixVolName + "String_Node_Str",authString2);
}

Fixed version (ground truth):
public void testAccessControl() throws Exception {
  final String authString1=NullAuthProvider.createAuthString("String_Node_Str",MRCClient.generateStringList("String_Node_Str"));
  final String authString2=NullAuthProvider.createAuthString("String_Node_Str",MRCClient.generateStringList("String_Node_Str"));
  final String authString3=NullAuthProvider.createAuthString("String_Node_Str",MRCClient.generateStringList("String_Node_Str"));
  final String authString4=NullAuthProvider.createAuthString("String_Node_Str","String_Node_Str");
  final String noACVolumeName="String_Node_Str";
  final String volACVolumeName="String_Node_Str";
  final String posixVolName="String_Node_Str";
  Map<String,Object> acl=new HashMap<String,Object>();
  acl.put("String_Node_Str",0);
  acl.put("String_Node_Str",(1 << 0) | (1 << 1));
  acl.put("String_Node_Str",1);
  client.createVolume(mrc1Address,noACVolumeName,RandomSelectionPolicy.POLICY_ID,null,YesToAnyoneFileAccessPolicy.POLICY_ID,DefaultPartitioningPolicy.POLICY_ID,null,authString1);
  client.createFile(mrc1Address,noACVolumeName + "String_Node_Str",authString1);
  client.changeOwner(mrc1Address,noACVolumeName + "String_Node_Str","String_Node_Str","String_Node_Str",authString4);
  Map<String,Object> stat=client.stat(mrc1Address,noACVolumeName + "String_Node_Str",false,false,false,authString3);
  assertEquals("String_Node_Str",stat.get("String_Node_Str"));
  assertEquals("String_Node_Str",stat.get("String_Node_Str"));
  client.delete(mrc1Address,noACVolumeName + "String_Node_Str",authString3);
  client.createDir(mrc1Address,noACVolumeName + "String_Node_Str",null,0,authString1);
  client.createFile(mrc1Address,noACVolumeName + "String_Node_Str",authString2);
  final String someone=NullAuthProvider.createAuthString("String_Node_Str",MRCClient.generateStringList("String_Node_Str"));
  assertTrue(client.checkAccess(mrc1Address,noACVolumeName + "String_Node_Str","String_Node_Str",someone));
  client.createVolume(mrc1Address,volACVolumeName,RandomSelectionPolicy.POLICY_ID,null,VolumeACLFileAccessPolicy.POLICY_ID,DefaultPartitioningPolicy.POLICY_ID,null,authString1);
  client.setACLEntries(mrc1Address,volACVolumeName,acl,authString1);
  client.createDir(mrc1Address,volACVolumeName + "String_Node_Str",null,0,authString1);
  try {
    client.createDir(mrc1Address,volACVolumeName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  Exception exc) {
  }
  assertEquals(0,client.readDir(mrc1Address,volACVolumeName + "String_Node_Str",authString1).size());
  assertEquals(0,client.readDir(mrc1Address,volACVolumeName + "String_Node_Str",authString2).size());
  try {
    client.readDir(mrc1Address,volACVolumeName + "String_Node_Str",authString3);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  client.createFile(mrc1Address,volACVolumeName + "String_Node_Str",authString1);
  client.createVolume(mrc1Address,posixVolName,RandomSelectionPolicy.POLICY_ID,null,POSIXFileAccessPolicy.POLICY_ID,DefaultPartitioningPolicy.POLICY_ID,null,authString1);
  client.changeAccessMode(mrc1Address,posixVolName,0700,authString1);
  client.createDir(mrc1Address,posixVolName + "String_Node_Str",authString1);
  assertTrue(client.checkAccess(mrc1Address,posixVolName + "String_Node_Str","String_Node_Str",authString1));
  try {
    client.createDir(mrc1Address,posixVolName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  Map<String,Object> statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,true,authString1);
  acl=(Map<String,Object>)statInfo.get("String_Node_Str");
  assertEquals(0,acl.size());
  Map<String,Object> newEntries=new HashMap<String,Object>();
  newEntries.put("String_Node_Str",5);
  try {
    client.setACLEntries(mrc1Address,posixVolName + "String_Node_Str",newEntries,authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  newEntries.clear();
  newEntries.put("String_Node_Str",2);
  newEntries.put("String_Node_Str",3);
  client.setACLEntries(mrc1Address,posixVolName + "String_Node_Str",newEntries,authString1);
  statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,true,authString1);
  acl=(Map<String,Object>)statInfo.get("String_Node_Str");
  assertEquals(4,acl.size());
  assertEquals(511L,acl.get("String_Node_Str"));
  assertEquals(2L,acl.get("String_Node_Str"));
  assertEquals(511L,acl.get("String_Node_Str"));
  assertEquals(3L,acl.get("String_Node_Str"));
  client.changeAccessMode(mrc1Address,posixVolName + "String_Node_Str",0,authString1);
  statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,true,authString1);
  acl=(Map<String,Object>)statInfo.get("String_Node_Str");
  assertEquals(4,acl.size());
  assertEquals(0L,acl.get("String_Node_Str"));
  assertEquals(0L,acl.get("String_Node_Str"));
  assertEquals(0L,acl.get("String_Node_Str"));
  assertEquals(0L,acl.get("String_Node_Str"));
  try {
    client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString1);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  try {
    client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  newEntries.clear();
  newEntries.put("String_Node_Str",511);
  newEntries.put("String_Node_Str",511);
  client.setACLEntries(mrc1Address,posixVolName + "String_Node_Str",newEntries,authString1);
  try {
    client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  client.setACLEntries(mrc1Address,posixVolName,newEntries,authString1);
  assertTrue(client.checkAccess(mrc1Address,posixVolName + "String_Node_Str","String_Node_Str",authString2));
  assertEquals(0,client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString2).size());
  client.removeACLEntries(mrc1Address,posixVolName + "String_Node_Str",new ArrayList<Object>(newEntries.keySet()),authString1);
  try {
    client.readDir(mrc1Address,posixVolName + "String_Node_Str",authString2);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  client.changeAccessMode(mrc1Address,posixVolName,0005,authString1);
  assertEquals(1,client.readDir(mrc1Address,posixVolName,authString3).size());
  assertFalse(client.checkAccess(mrc1Address,posixVolName,"String_Node_Str",authString3));
  client.deleteVolume(mrc1Address,posixVolName,authString1);
  client.createVolume(mrc1Address,posixVolName,RandomSelectionPolicy.POLICY_ID,null,POSIXFileAccessPolicy.POLICY_ID,DefaultPartitioningPolicy.POLICY_ID,null,authString1);
  client.createFile(mrc1Address,posixVolName + "String_Node_Str",null,null,224,authString1);
  statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,false,authString1);
  long accessMode=(Long)statInfo.get("String_Node_Str");
  assertEquals(224,accessMode);
  client.changeAccessMode(mrc1Address,posixVolName + "String_Node_Str",accessMode & 192,authString1);
  statInfo=client.stat(mrc1Address,posixVolName + "String_Node_Str",false,false,false,authString1);
  accessMode=(Long)statInfo.get("String_Node_Str");
  assertEquals(192,accessMode);
  client.changeAccessMode(mrc1Address,posixVolName,511,authString1);
  client.createDir(mrc1Address,posixVolName + "String_Node_Str",null,511,authString1);
  client.createFile(mrc1Address,posixVolName + "String_Node_Str",authString2);
  client.delete(mrc1Address,posixVolName + "String_Node_Str",authString1);
  client.createFile(mrc1Address,posixVolName + "String_Node_Str",authString2);
  client.move(mrc1Address,posixVolName + "String_Node_Str",posixVolName + "String_Node_Str",authString1);
  client.createFile(mrc1Address,posixVolName + "String_Node_Str",authString2);
  client.changeAccessMode(mrc1Address,posixVolName + "String_Node_Str",512 | 511,authString1);
  try {
    client.delete(mrc1Address,posixVolName + "String_Node_Str",authString1);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  try {
    client.move(mrc1Address,posixVolName + "String_Node_Str",posixVolName + "String_Node_Str",authString1);
    fail("String_Node_Str");
  }
 catch (  HttpErrorException exc) {
  }
  client.move(mrc1Address,posixVolName + "String_Node_Str",posixVolName + "String_Node_Str",authString2);
  client.delete(mrc1Address,posixVolName + "String_Node_Str",authString2);
}