Program: 180543
Project: 180543
Buggy source:
@Test public void testGitUrisInContentLocation() throws Exception {
  URI workspaceLocation=createWorkspace(getMethodName());
  String projectName=getMethodName();
  WebResponse response=createProjectWithContentLocation(workspaceLocation,projectName,gitDir.toString());
  assertEquals(HttpURLConnection.HTTP_CREATED,response.getResponseCode());
  JSONObject newProject=new JSONObject(response.getText());
  assertEquals(projectName,newProject.getString(ProtocolConstants.KEY_NAME));
  String projectId=newProject.optString(ProtocolConstants.KEY_ID,null);
  assertNotNull(projectId);
  String contentLocation=newProject.optString(ProtocolConstants.KEY_CONTENT_LOCATION,null);
  assertNotNull(contentLocation);
  WebRequest request=getGetFilesRequest(contentLocation);
  response=webConversation.getResponse(request);
  assertEquals(HttpURLConnection.HTTP_OK,response.getResponseCode());
  JSONObject project=new JSONObject(response.getText());
  JSONObject gitSection=project.optJSONObject(GitConstants.KEY_GIT);
  assertNotNull(gitSection);
  assertNotNull(gitSection.optString(GitConstants.KEY_STATUS,null));
  assertNotNull(gitSection.optString(GitConstants.KEY_DIFF,null));
  assertNotNull(gitSection.optString(GitConstants.KEY_INDEX,null));
  String childrenLocation=project.getString(ProtocolConstants.KEY_CHILDREN_LOCATION);
  assertNotNull(childrenLocation);
  request=getGetFilesRequest(childrenLocation);
  response=webConversation.getResponse(request);
  assertEquals(HttpURLConnection.HTTP_OK,response.getResponseCode());
  List<JSONObject> children=getDirectoryChildren(new JSONObject(response.getText()));
  String[] expectedChildren=new String[]{Constants.DOT_GIT,"String_Node_Str","String_Node_Str"};
  assertEquals("String_Node_Str",expectedChildren.length,children.size());
  for (  JSONObject child : children) {
    gitSection=child.optJSONObject(GitConstants.KEY_GIT);
    assertNotNull(gitSection);
    assertNotNull(gitSection.optString(GitConstants.KEY_STATUS,null));
    assertNotNull(gitSection.optString(GitConstants.KEY_DIFF,null));
    assertNotNull(gitSection.optString(GitConstants.KEY_INDEX,null));
  }
  childrenLocation=children.get(1).getString(ProtocolConstants.KEY_CHILDREN_LOCATION);
  request=getGetFilesRequest(childrenLocation);
  response=webConversation.getResponse(request);
  assertEquals(HttpURLConnection.HTTP_OK,response.getResponseCode());
  children=getDirectoryChildren(new JSONObject(response.getText()));
  expectedChildren=new String[]{"String_Node_Str"};
  assertEquals("String_Node_Str",expectedChildren.length,children.size());
  for (  JSONObject child : children) {
    gitSection=child.optJSONObject(GitConstants.KEY_GIT);
    assertNotNull(gitSection);
    assertNotNull(gitSection.optString(GitConstants.KEY_STATUS,null));
    assertNotNull(gitSection.optString(GitConstants.KEY_DIFF,null));
    assertNotNull(gitSection.optString(GitConstants.KEY_INDEX,null));
  }
}

Fixed version (ground truth):
@Test public void testGitUrisInContentLocation() throws Exception {
  URI workspaceLocation=createWorkspace(getMethodName());
  String projectName=getMethodName();
  WebResponse response=createProjectWithContentLocation(workspaceLocation,projectName,gitDir.toString());
  assertEquals(HttpURLConnection.HTTP_CREATED,response.getResponseCode());
  JSONObject newProject=new JSONObject(response.getText());
  assertEquals(projectName,newProject.getString(ProtocolConstants.KEY_NAME));
  String projectId=newProject.optString(ProtocolConstants.KEY_ID,null);
  assertNotNull(projectId);
  String contentLocation=newProject.optString(ProtocolConstants.KEY_CONTENT_LOCATION,null);
  assertNotNull(contentLocation);
  WebRequest request=getGetFilesRequest(contentLocation);
  response=webConversation.getResponse(request);
  assertEquals(HttpURLConnection.HTTP_OK,response.getResponseCode());
  JSONObject project=new JSONObject(response.getText());
  JSONObject gitSection=project.optJSONObject(GitConstants.KEY_GIT);
  assertNotNull(gitSection);
  assertNotNull(gitSection.optString(GitConstants.KEY_STATUS,null));
  assertNotNull(gitSection.optString(GitConstants.KEY_DIFF,null));
  assertNotNull(gitSection.optString(GitConstants.KEY_INDEX,null));
  String childrenLocation=project.getString(ProtocolConstants.KEY_CHILDREN_LOCATION);
  assertNotNull(childrenLocation);
  request=getGetFilesRequest(childrenLocation);
  response=webConversation.getResponse(request);
  assertEquals(HttpURLConnection.HTTP_OK,response.getResponseCode());
  List<JSONObject> children=getDirectoryChildren(new JSONObject(response.getText()));
  String[] expectedChildren=new String[]{Constants.DOT_GIT,"String_Node_Str","String_Node_Str"};
  assertEquals("String_Node_Str",expectedChildren.length,children.size());
  for (  JSONObject child : children) {
    gitSection=child.optJSONObject(GitConstants.KEY_GIT);
    assertNotNull(gitSection);
    assertNotNull(gitSection.optString(GitConstants.KEY_STATUS,null));
    assertNotNull(gitSection.optString(GitConstants.KEY_DIFF,null));
    assertNotNull(gitSection.optString(GitConstants.KEY_INDEX,null));
  }
  childrenLocation=getChildByName(children,"String_Node_Str").getString(ProtocolConstants.KEY_CHILDREN_LOCATION);
  request=getGetFilesRequest(childrenLocation);
  response=webConversation.getResponse(request);
  assertEquals(HttpURLConnection.HTTP_OK,response.getResponseCode());
  children=getDirectoryChildren(new JSONObject(response.getText()));
  expectedChildren=new String[]{"String_Node_Str"};
  assertEquals("String_Node_Str",expectedChildren.length,children.size());
  for (  JSONObject child : children) {
    gitSection=child.optJSONObject(GitConstants.KEY_GIT);
    assertNotNull(gitSection);
    assertNotNull(gitSection.optString(GitConstants.KEY_STATUS,null));
    assertNotNull(gitSection.optString(GitConstants.KEY_DIFF,null));
    assertNotNull(gitSection.optString(GitConstants.KEY_INDEX,null));
  }
}