nus-yam/ex-repair huggingface dataset:
Program: 20691
Project: 20691
Buggy source:
@Before public void setUp() throws Exception {
  super.setUp();
  FileUtils.deleteDirectory(new File(FileUtil.getBasedir(),"String_Node_Str" + TEST_REPO_1 + "String_Node_Str"));
  assertFalse(new File(FileUtil.getBasedir(),"String_Node_Str" + TEST_REPO_1 + "String_Node_Str").exists());
  FileUtils.deleteDirectory(new File(FileUtil.getBasedir(),"String_Node_Str" + TEST_REPO_2 + "String_Node_Str"));
  assertFalse(new File(FileUtil.getBasedir(),"String_Node_Str" + TEST_REPO_2 + "String_Node_Str").exists());
  archivaConfigControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfig=(ArchivaConfiguration)archivaConfigControl.getMock();
  search=new NexusRepositorySearch(plexusSisuBridge,archivaConfig);
  nexusIndexer=plexusSisuBridge.lookup(NexusIndexer.class);
  artifactContextProducer=plexusSisuBridge.lookup(ArtifactContextProducer.class);
  config=new Configuration();
  config.addManagedRepository(createRepositoryConfig(TEST_REPO_1));
  config.addManagedRepository(createRepositoryConfig(TEST_REPO_2));
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  super.setUp();
  FileUtils.deleteDirectory(new File(FileUtil.getBasedir(),"String_Node_Str" + TEST_REPO_1 + "String_Node_Str"));
  assertFalse(new File(FileUtil.getBasedir(),"String_Node_Str" + TEST_REPO_1 + "String_Node_Str").exists());
  FileUtils.deleteDirectory(new File(FileUtil.getBasedir(),"String_Node_Str" + TEST_REPO_2 + "String_Node_Str"));
  assertFalse(new File(FileUtil.getBasedir(),"String_Node_Str" + TEST_REPO_2 + "String_Node_Str").exists());
  archivaConfigControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfig=(ArchivaConfiguration)archivaConfigControl.getMock();
  search=new NexusRepositorySearch(plexusSisuBridge,archivaConfig,mavenIndexerUtils);
  nexusIndexer=plexusSisuBridge.lookup(NexusIndexer.class);
  artifactContextProducer=plexusSisuBridge.lookup(ArtifactContextProducer.class);
  config=new Configuration();
  config.addManagedRepository(createRepositoryConfig(TEST_REPO_1));
  config.addManagedRepository(createRepositoryConfig(TEST_REPO_2));
}
Program: 20692
Project: 20692
Buggy source:
@SuppressWarnings("String_Node_Str") protected void validateConnector(){
  if (connector.getPolicies() == null) {
    addActionError("String_Node_Str");
  }
 else {
    for (    Map.Entry<String,Policy> entry : getPolicyMap().entrySet()) {
      String policyId=entry.getKey();
      Policy policy=entry.getValue();
      List<String> options=policy.getOptions();
      if (!connector.getPolicies().containsKey(policyId)) {
        addActionError("String_Node_Str" + policyId + "String_Node_Str");
        continue;
      }
      Map<String,Object> properties=connector.getProperties();
      for (      String key : properties.keySet()) {
        Object value=properties.get(key);
        if (value.getClass().isArray()) {
          String[] arr=(String[])value;
          properties.put(key,arr[0]);
        }
      }
      Object o=connector.getPolicies().get(policyId);
      String value;
      if (o.getClass().isArray()) {
        String arr[]=(String[])o;
        value=arr[0];
      }
 else {
        value=(String)o;
      }
      connector.getPolicies().put(policyId,value);
      if (StringUtils.isBlank(value)) {
        addActionError("String_Node_Str" + policyId + "String_Node_Str");
        continue;
      }
      if (!options.contains(value)) {
        addActionError("String_Node_Str" + value + "String_Node_Str"+ policyId+ "String_Node_Str"+ options);
        continue;
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void validateConnector(){
  if (connector.getPolicies() == null) {
    addActionError("String_Node_Str");
  }
 else {
    for (    Map.Entry<String,Policy> entry : getPolicyMap().entrySet()) {
      String policyId=entry.getKey();
      Policy policy=entry.getValue();
      List<String> options=policy.getOptions();
      if (!connector.getPolicies().containsKey(policyId)) {
        addActionError("String_Node_Str" + policyId + "String_Node_Str");
        continue;
      }
      Map<String,Object> properties=connector.getProperties();
      for (      Map.Entry<String,Object> entry2 : properties.entrySet()) {
        Object value=entry2.getValue();
        if (value.getClass().isArray()) {
          String[] arr=(String[])value;
          properties.put(entry2.getKey(),arr[0]);
        }
      }
      Object o=connector.getPolicies().get(policyId);
      String value;
      if (o.getClass().isArray()) {
        String arr[]=(String[])o;
        value=arr[0];
      }
 else {
        value=(String)o;
      }
      connector.getPolicies().put(policyId,value);
      if (StringUtils.isBlank(value)) {
        addActionError("String_Node_Str" + policyId + "String_Node_Str");
        continue;
      }
      if (!options.contains(value)) {
        addActionError("String_Node_Str" + value + "String_Node_Str"+ policyId+ "String_Node_Str"+ options);
        continue;
      }
    }
  }
}
Program: 20693
Project: 20693
Buggy source:
public void prepare(){
  managedRepositoryList=new ArrayList<String>();
  managedRepositoryList=getObservableRepos();
  if (managedRepositoryList.size() > 0) {
    managedRepositoryList.add("String_Node_Str");
  }
  searchFields=new LinkedHashMap<String,String>();
  searchFields.put("String_Node_Str","String_Node_Str");
  searchFields.put("String_Node_Str","String_Node_Str");
  searchFields.put("String_Node_Str","String_Node_Str");
  searchFields.put("String_Node_Str","String_Node_Str");
  searchFields.put("String_Node_Str","String_Node_Str");
  super.clearErrorsAndMessages();
  clearSearchFields();
}

Fixed version (ground truth):
public void prepare(){
  managedRepositoryList=getObservableRepos();
  if (managedRepositoryList.size() > 0) {
    managedRepositoryList.add("String_Node_Str");
  }
  searchFields=new LinkedHashMap<String,String>();
  searchFields.put("String_Node_Str","String_Node_Str");
  searchFields.put("String_Node_Str","String_Node_Str");
  searchFields.put("String_Node_Str","String_Node_Str");
  searchFields.put("String_Node_Str","String_Node_Str");
  searchFields.put("String_Node_Str","String_Node_Str");
  super.clearErrorsAndMessages();
  clearSearchFields();
}
Program: 20694
Project: 20694
Buggy source:
@After protected void tearDown() throws Exception {
  super.tearDown();
  FileUtils.deleteDirectory(baseDir);
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  super.tearDown();
  FileUtils.deleteDirectory(baseDir);
}
Program: 20695
Project: 20695
Buggy source:
public void testGetFromFirstManagedRepositoryReturnOk() throws Exception {
  String resourceName="String_Node_Str";
  File dummyInternalResourceFile=new File(repoRootFirst,resourceName);
  dummyInternalResourceFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(dummyInternalResourceFile,"String_Node_Str",null);
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str"+ resourceName);
  WebResponse response=sc.getResponse(request);
  assertResponseOK(response);
  assertEquals("String_Node_Str","String_Node_Str",response.getText());
}

Fixed version (ground truth):
@Test public void testGetFromFirstManagedRepositoryReturnOk() throws Exception {
  String resourceName="String_Node_Str";
  File dummyInternalResourceFile=new File(repoRootFirst,resourceName);
  dummyInternalResourceFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(dummyInternalResourceFile,"String_Node_Str",null);
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str"+ resourceName);
  WebResponse response=sc.getResponse(request);
  assertResponseOK(response);
  assertEquals("String_Node_Str","String_Node_Str",response.getText());
}
Program: 20696
Project: 20696
Buggy source:
public void testGetInvalidManagedRepositoryInGroupReturnNotFound() throws Exception {
  String resourceName="String_Node_Str";
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_INVALID_REPOS + "String_Node_Str"+ resourceName);
  WebResponse response=sc.getResponse(request);
  assertResponseInternalServerError(response);
}

Fixed version (ground truth):
@Test public void testGetInvalidManagedRepositoryInGroupReturnNotFound() throws Exception {
  String resourceName="String_Node_Str";
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_INVALID_REPOS + "String_Node_Str"+ resourceName);
  WebResponse response=sc.getResponse(request);
  assertResponseInternalServerError(response);
}
Program: 20697
Project: 20697
Buggy source:
public void testGetFromValidRepositoryGroupReturnNotFound() throws Exception {
  String resourceName="String_Node_Str";
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str"+ resourceName);
  WebResponse response=sc.getResponse(request);
  assertResponseNotFound(response);
}

Fixed version (ground truth):
@Test public void testGetFromValidRepositoryGroupReturnNotFound() throws Exception {
  String resourceName="String_Node_Str";
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str"+ resourceName);
  WebResponse response=sc.getResponse(request);
  assertResponseNotFound(response);
}
Program: 20699
Project: 20699
Buggy source:
public void testGetFromLastManagedRepositoryReturnOk() throws Exception {
  String resourceName="String_Node_Str";
  File dummyReleasesResourceFile=new File(repoRootLast,resourceName);
  dummyReleasesResourceFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(dummyReleasesResourceFile,"String_Node_Str",null);
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str"+ resourceName);
  WebResponse response=sc.getResponse(request);
  assertResponseOK(response);
  assertEquals("String_Node_Str","String_Node_Str",response.getText());
}

Fixed version (ground truth):
@Test public void testGetFromLastManagedRepositoryReturnOk() throws Exception {
  String resourceName="String_Node_Str";
  File dummyReleasesResourceFile=new File(repoRootLast,resourceName);
  dummyReleasesResourceFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(dummyReleasesResourceFile,"String_Node_Str",null);
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str"+ resourceName);
  WebResponse response=sc.getResponse(request);
  assertResponseOK(response);
  assertEquals("String_Node_Str","String_Node_Str",response.getText());
}
Program: 20700
Project: 20700
Buggy source:
public void testBrowseWithTwoArtifactsWithSameGroupIdInRepos() throws Exception {
  String resourceName="String_Node_Str";
  File dummyInternalResourceFile=new File(repoRootFirst,resourceName);
  dummyInternalResourceFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(dummyInternalResourceFile,"String_Node_Str",null);
  resourceName="String_Node_Str";
  File dummyReleasesResourceFile=new File(repoRootLast,resourceName);
  dummyReleasesResourceFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(dummyReleasesResourceFile,"String_Node_Str",null);
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str");
  WebResponse response=sc.getResource(request);
  assertResponseOK(response);
  assertTrue(StringUtils.contains(response.getText(),"String_Node_Str"));
  assertTrue(StringUtils.contains(response.getText(),"String_Node_Str"));
  assertTrue(StringUtils.contains(response.getText(),"String_Node_Str"));
  assertTrue(StringUtils.contains(response.getText(),"String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testBrowseWithTwoArtifactsWithSameGroupIdInRepos() throws Exception {
  String resourceName="String_Node_Str";
  File dummyInternalResourceFile=new File(repoRootFirst,resourceName);
  dummyInternalResourceFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(dummyInternalResourceFile,"String_Node_Str",null);
  resourceName="String_Node_Str";
  File dummyReleasesResourceFile=new File(repoRootLast,resourceName);
  dummyReleasesResourceFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(dummyReleasesResourceFile,"String_Node_Str",null);
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str");
  WebResponse response=sc.getResource(request);
  assertResponseOK(response);
  assertTrue(StringUtils.contains(response.getText(),"String_Node_Str"));
  assertTrue(StringUtils.contains(response.getText(),"String_Node_Str"));
  assertTrue(StringUtils.contains(response.getText(),"String_Node_Str"));
  assertTrue(StringUtils.contains(response.getText(),"String_Node_Str"));
}
Program: 20701
Project: 20701
Buggy source:
public void testPutValidRepositoryGroupReturnBadRequest() throws Exception {
  String resourceName="String_Node_Str";
  String putUrl="String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str"+ resourceName;
  InputStream is=getClass().getResourceAsStream("String_Node_Str");
  WebRequest request=new PutMethodWebRequest(putUrl,is,"String_Node_Str");
  WebResponse response=sc.getResponse(request);
  assertResponseMethodNotAllowed(response);
}

Fixed version (ground truth):
@Test public void testPutValidRepositoryGroupReturnBadRequest() throws Exception {
  String resourceName="String_Node_Str";
  String putUrl="String_Node_Str" + REPO_GROUP_WITH_VALID_REPOS + "String_Node_Str"+ resourceName;
  InputStream is=getClass().getResourceAsStream("String_Node_Str");
  WebRequest request=new PutMethodWebRequest(putUrl,is,"String_Node_Str");
  WebResponse response=sc.getResponse(request);
  assertResponseMethodNotAllowed(response);
}
Program: 20706
Project: 20706
Buggy source:
@Override @After protected void tearDown() throws Exception {
  if (sc != null) {
    sc.clearContents();
  }
  if (sr != null) {
    sr.shutDown();
  }
  if (repoRootInternal.exists()) {
    FileUtils.deleteDirectory(repoRootInternal);
  }
  servlet=null;
  super.tearDown();
}

Fixed version (ground truth):
@Override @After public void tearDown() throws Exception {
  if (sc != null) {
    sc.clearContents();
  }
  if (sr != null) {
    sr.shutDown();
  }
  if (repoRootInternal.exists()) {
    FileUtils.deleteDirectory(repoRootInternal);
  }
  servlet=null;
  super.tearDown();
}
Program: 20707
Project: 20707
Buggy source:
public void testPutWithInvalidUserAndGuestHasNoWriteAccess() throws Exception {
  setupCleanRepo(repoRootInternal);
  String putUrl="String_Node_Str";
  InputStream is=getClass().getResourceAsStream("String_Node_Str");
  assertNotNull("String_Node_Str",is);
  WebRequest request=new PutMethodWebRequest(putUrl,is,"String_Node_Str");
  InvocationContext ic=sc.newInvocation(request);
  servlet=(RepositoryServlet)ic.getServlet();
  servlet.setDavSessionProvider(davSessionProvider);
  AuthenticationResult result=new AuthenticationResult();
  httpAuthControl.expectAndReturn(httpAuth.getAuthenticationResult(null,null),result);
  servletAuthControl.expectAndThrow(servletAuth.isAuthenticated(null,null),new AuthenticationException("String_Node_Str"));
  servletAuth.isAuthorized("String_Node_Str","String_Node_Str",ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD);
  servletAuthControl.setMatcher(MockControl.EQUALS_MATCHER);
  servletAuthControl.setThrowable(new UnauthorizedException("String_Node_Str"));
  httpAuthControl.replay();
  servletAuthControl.replay();
  servlet.service(ic.getRequest(),ic.getResponse());
  httpAuthControl.verify();
  servletAuthControl.verify();
}

Fixed version (ground truth):
@Test public void testPutWithInvalidUserAndGuestHasNoWriteAccess() throws Exception {
  setupCleanRepo(repoRootInternal);
  String putUrl="String_Node_Str";
  InputStream is=getClass().getResourceAsStream("String_Node_Str");
  assertNotNull("String_Node_Str",is);
  WebRequest request=new PutMethodWebRequest(putUrl,is,"String_Node_Str");
  InvocationContext ic=sc.newInvocation(request);
  servlet=(RepositoryServlet)ic.getServlet();
  servlet.setDavSessionProvider(davSessionProvider);
  AuthenticationResult result=new AuthenticationResult();
  httpAuthControl.expectAndReturn(httpAuth.getAuthenticationResult(null,null),result);
  servletAuthControl.expectAndThrow(servletAuth.isAuthenticated(null,null),new AuthenticationException("String_Node_Str"));
  servletAuth.isAuthorized("String_Node_Str","String_Node_Str",ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD);
  servletAuthControl.setMatcher(MockControl.EQUALS_MATCHER);
  servletAuthControl.setThrowable(new UnauthorizedException("String_Node_Str"));
  httpAuthControl.replay();
  servletAuthControl.replay();
  servlet.service(ic.getRequest(),ic.getResponse());
  httpAuthControl.verify();
  servletAuthControl.verify();
}
Program: 20708
Project: 20708
Buggy source:
public void testGetWithInvalidUserAndGuestHasNoReadAccess() throws Exception {
  String commonsLangJar="String_Node_Str";
  String expectedArtifactContents="String_Node_Str";
  File artifactFile=new File(repoRootInternal,commonsLangJar);
  artifactFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(artifactFile,expectedArtifactContents,null);
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + commonsLangJar);
  InvocationContext ic=sc.newInvocation(request);
  servlet=(RepositoryServlet)ic.getServlet();
  servlet.setDavSessionProvider(davSessionProvider);
  AuthenticationResult result=new AuthenticationResult();
  httpAuthControl.expectAndReturn(httpAuth.getAuthenticationResult(null,null),result);
  servletAuthControl.expectAndThrow(servletAuth.isAuthenticated(null,null),new AuthenticationException("String_Node_Str"));
  servletAuthControl.expectAndReturn(servletAuth.isAuthorized("String_Node_Str","String_Node_Str",ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS),false);
  httpAuthControl.replay();
  servletAuthControl.replay();
  WebResponse response=sc.getResponse(request);
  httpAuthControl.verify();
  servletAuthControl.verify();
  assertEquals(HttpServletResponse.SC_UNAUTHORIZED,response.getResponseCode());
}

Fixed version (ground truth):
@Test public void testGetWithInvalidUserAndGuestHasNoReadAccess() throws Exception {
  String commonsLangJar="String_Node_Str";
  String expectedArtifactContents="String_Node_Str";
  File artifactFile=new File(repoRootInternal,commonsLangJar);
  artifactFile.getParentFile().mkdirs();
  FileUtils.writeStringToFile(artifactFile,expectedArtifactContents,null);
  WebRequest request=new GetMethodWebRequest("String_Node_Str" + commonsLangJar);
  InvocationContext ic=sc.newInvocation(request);
  servlet=(RepositoryServlet)ic.getServlet();
  servlet.setDavSessionProvider(davSessionProvider);
  AuthenticationResult result=new AuthenticationResult();
  httpAuthControl.expectAndReturn(httpAuth.getAuthenticationResult(null,null),result);
  servletAuthControl.expectAndThrow(servletAuth.isAuthenticated(null,null),new AuthenticationException("String_Node_Str"));
  servletAuthControl.expectAndReturn(servletAuth.isAuthorized("String_Node_Str","String_Node_Str",ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS),false);
  httpAuthControl.replay();
  servletAuthControl.replay();
  WebResponse response=sc.getResponse(request);
  httpAuthControl.verify();
  servletAuthControl.verify();
  assertEquals(HttpServletResponse.SC_UNAUTHORIZED,response.getResponseCode());
}
Program: 20711
Project: 20711
Buggy source:
@Override protected void setUp() throws Exception {
  super.setUp();
  action=(DeleteArtifactAction)lookup(Action.class.getName(),"String_Node_Str");
  assertNotNull(action);
  configurationControl=MockControl.createControl(ArchivaConfiguration.class);
  configuration=(ArchivaConfiguration)configurationControl.getMock();
  repositoryFactoryControl=MockClassControl.createControl(RepositoryContentFactory.class);
  repositoryFactory=(RepositoryContentFactory)repositoryFactoryControl.getMock();
  metadataRepositoryControl=MockControl.createControl(MetadataRepository.class);
  metadataRepository=(MetadataRepository)metadataRepositoryControl.getMock();
  RepositorySession repositorySession=mock(RepositorySession.class);
  when(repositorySession.getRepository()).thenReturn(metadataRepository);
  TestRepositorySessionFactory repositorySessionFactory=(TestRepositorySessionFactory)lookup(RepositorySessionFactory.class);
  repositorySessionFactory.setRepositorySession(repositorySession);
  action.setConfiguration(configuration);
  action.setRepositoryFactory(repositoryFactory);
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  action=(DeleteArtifactAction)getActionProxy("String_Node_Str").getAction();
  assertNotNull(action);
  configurationControl=MockControl.createControl(ArchivaConfiguration.class);
  configuration=(ArchivaConfiguration)configurationControl.getMock();
  repositoryFactoryControl=MockClassControl.createControl(RepositoryContentFactory.class);
  repositoryFactory=(RepositoryContentFactory)repositoryFactoryControl.getMock();
  metadataRepositoryControl=MockControl.createControl(MetadataRepository.class);
  metadataRepository=(MetadataRepository)metadataRepositoryControl.getMock();
  RepositorySession repositorySession=mock(RepositorySession.class);
  when(repositorySession.getRepository()).thenReturn(metadataRepository);
  TestRepositorySessionFactory repositorySessionFactory=new TestRepositorySessionFactory();
  repositorySessionFactory.setRepositorySession(repositorySession);
  action.setConfiguration(configuration);
  action.setRepositoryFactory(repositoryFactory);
}
Program: 20712
Project: 20712
Buggy source:
@Override protected void setUp() throws Exception {
  super.setUp();
  action=new SearchAction();
  session=mock(RepositorySession.class);
  TestRepositorySessionFactory factory=(TestRepositorySessionFactory)lookup(RepositorySessionFactory.class);
  factory.setRepositorySession(session);
  action.setRepositorySessionFactory(factory);
  MockControl archivaConfigControl=MockControl.createControl(ArchivaConfiguration.class);
  ArchivaConfiguration archivaConfig=(ArchivaConfiguration)archivaConfigControl.getMock();
  userReposControl=MockControl.createControl(UserRepositories.class);
  userRepos=(UserRepositories)userReposControl.getMock();
  searchControl=MockControl.createControl(RepositorySearch.class);
  searchControl.setDefaultMatcher(MockControl.ALWAYS_MATCHER);
  search=(RepositorySearch)searchControl.getMock();
  action.setArchivaConfiguration(archivaConfig);
  action.setUserRepositories(userRepos);
  action.setNexusSearch(search);
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  action=new SearchAction();
  session=mock(RepositorySession.class);
  TestRepositorySessionFactory factory=new TestRepositorySessionFactory();
  factory.setRepositorySession(session);
  action.setRepositorySessionFactory(factory);
  MockControl archivaConfigControl=MockControl.createControl(ArchivaConfiguration.class);
  ArchivaConfiguration archivaConfig=(ArchivaConfiguration)archivaConfigControl.getMock();
  userReposControl=MockControl.createControl(UserRepositories.class);
  userRepos=(UserRepositories)userReposControl.getMock();
  searchControl=MockControl.createControl(RepositorySearch.class);
  searchControl.setDefaultMatcher(MockControl.ALWAYS_MATCHER);
  search=(RepositorySearch)searchControl.getMock();
  action.setArchivaConfiguration(archivaConfig);
  action.setUserRepositories(userRepos);
  action.setNexusSearch(search);
}
Program: 20713
Project: 20713
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
  action=(ShowArtifactAction)lookup(Action.class,ACTION_HINT);
  metadataResolver=new TestMetadataResolver();
  MetadataRepository repo=mock(MetadataRepository.class);
  RepositorySession repositorySession=mock(RepositorySession.class);
  when(repositorySession.getResolver()).thenReturn(metadataResolver);
  when(repositorySession.getRepository()).thenReturn(repo);
  TestRepositorySessionFactory repositorySessionFactory=(TestRepositorySessionFactory)lookup(RepositorySessionFactory.class);
  repositorySessionFactory.setRepositorySession(repositorySession);
  RepositoryContentFactory factory=mock(RepositoryContentFactory.class);
  action.setRepositoryFactory(factory);
  ManagedRepositoryConfiguration config=new ManagedRepositoryConfiguration();
  config.setId(TEST_REPO);
  config.setLocation(getTestFile("String_Node_Str").getAbsolutePath());
  ManagedRepositoryContent content=new ManagedDefaultRepositoryContent();
  content.setRepository(config);
  when(factory.getManagedRepositoryContent(TEST_REPO)).thenReturn(content);
  ArchivaConfiguration archivaConfig=mock(ArchivaConfiguration.class);
  Configuration configuration=new Configuration();
  configuration.addManagedRepository(config);
  when(archivaConfig.getConfiguration()).thenReturn(configuration);
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  action=(ShowArtifactAction)getActionProxy("String_Node_Str").getAction();
  metadataResolver=new TestMetadataResolver();
  MetadataRepository repo=mock(MetadataRepository.class);
  RepositorySession repositorySession=mock(RepositorySession.class);
  when(repositorySession.getResolver()).thenReturn(metadataResolver);
  when(repositorySession.getRepository()).thenReturn(repo);
  TestRepositorySessionFactory repositorySessionFactory=new TestRepositorySessionFactory();
  repositorySessionFactory.setRepositorySession(repositorySession);
  RepositoryContentFactory factory=mock(RepositoryContentFactory.class);
  action.setRepositoryFactory(factory);
  ManagedRepositoryConfiguration config=new ManagedRepositoryConfiguration();
  config.setId(TEST_REPO);
  config.setLocation(new File("String_Node_Str").getAbsolutePath());
  ManagedRepositoryContent content=new ManagedDefaultRepositoryContent();
  content.setRepository(config);
  when(factory.getManagedRepositoryContent(TEST_REPO)).thenReturn(content);
  ArchivaConfiguration archivaConfig=mock(ArchivaConfiguration.class);
  Configuration configuration=new Configuration();
  configuration.addManagedRepository(config);
  when(archivaConfig.getConfiguration()).thenReturn(configuration);
}
Program: 20714
Project: 20714
Buggy source:
public void testInstantiation(){
  assertFalse(action == lookup(Action.class,ACTION_HINT));
}

Fixed version (ground truth):
public void testInstantiation(){
  assertFalse(action == getActionProxy("String_Node_Str").getAction());
}
Program: 20715
Project: 20715
Buggy source:
@Override protected void setUp() throws Exception {
  super.setUp();
  action=(DeleteProxyConnectorAction)lookup(Action.class.getName(),"String_Node_Str");
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  action=(DeleteProxyConnectorAction)getActionProxy("String_Node_Str").getAction();
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
}
Program: 20716
Project: 20716
Buggy source:
@Override protected void setUp() throws Exception {
  super.setUp();
  action=(EditProxyConnectorAction)lookup(Action.class.getName(),"String_Node_Str");
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
  for (int i=0; i < 3; i++) {
    archivaConfiguration.getConfiguration();
    archivaConfigurationControl.setReturnValue(new Configuration());
  }
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  action=(EditProxyConnectorAction)getActionProxy("String_Node_Str").getAction();
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
  for (int i=0; i < 3; i++) {
    archivaConfiguration.getConfiguration();
    archivaConfigurationControl.setReturnValue(new Configuration());
  }
}
Program: 20717
Project: 20717
Buggy source:
@Override protected void setUp() throws Exception {
  super.setUp();
  action=(EnableProxyConnectorAction)lookup(Action.class.getName(),"String_Node_Str");
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  action=(EnableProxyConnectorAction)getActionProxy("String_Node_Str").getAction();
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
}
Program: 20718
Project: 20718
Buggy source:
@Override protected void setUp() throws Exception {
  super.setUp();
  action=new AddManagedRepositoryAction();
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
  roleManagerControl=MockControl.createControl(RoleManager.class);
  roleManager=(RoleManager)roleManagerControl.getMock();
  action.setRoleManager(roleManager);
  registryControl=MockControl.createControl(Registry.class);
  registry=(Registry)registryControl.getMock();
  action.setRegistry(registry);
  location=getTestFile("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  action=new AddManagedRepositoryAction();
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
  roleManagerControl=MockControl.createControl(RoleManager.class);
  roleManager=(RoleManager)roleManagerControl.getMock();
  action.setRoleManager(roleManager);
  registryControl=MockControl.createControl(Registry.class);
  registry=(Registry)registryControl.getMock();
  action.setRegistry(registry);
  location=new File("String_Node_Str");
}
Program: 20719
Project: 20719
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
  action=(AddRemoteRepositoryAction)lookup(Action.class.getName(),"String_Node_Str");
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  action=(AddRemoteRepositoryAction)getActionProxy("String_Node_Str").getAction();
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
}
Program: 20720
Project: 20720
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
  action=new DeleteManagedRepositoryAction();
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
  roleManagerControl=MockControl.createControl(RoleManager.class);
  roleManager=(RoleManager)roleManagerControl.getMock();
  action.setRoleManager(roleManager);
  location=getTestFile("String_Node_Str");
  repositoryStatisticsManagerControl=MockControl.createControl(RepositoryStatisticsManager.class);
  repositoryStatisticsManager=(RepositoryStatisticsManager)repositoryStatisticsManagerControl.getMock();
  action.setRepositoryStatisticsManager(repositoryStatisticsManager);
  metadataRepositoryControl=MockControl.createControl(MetadataRepository.class);
  metadataRepository=(MetadataRepository)metadataRepositoryControl.getMock();
  metadataRepository.removeRepository(REPO_ID);
  respositorySession=mock(RepositorySession.class);
  when(respositorySession.getRepository()).thenReturn(metadataRepository);
  TestRepositorySessionFactory factory=(TestRepositorySessionFactory)lookup(RepositorySessionFactory.class);
  factory.setRepositorySession(respositorySession);
  action.setRepositorySessionFactory(factory);
  metadataRepositoryControl.replay();
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  action=new DeleteManagedRepositoryAction();
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  action.setArchivaConfiguration(archivaConfiguration);
  roleManagerControl=MockControl.createControl(RoleManager.class);
  roleManager=(RoleManager)roleManagerControl.getMock();
  action.setRoleManager(roleManager);
  location=new File("String_Node_Str");
  repositoryStatisticsManagerControl=MockControl.createControl(RepositoryStatisticsManager.class);
  repositoryStatisticsManager=(RepositoryStatisticsManager)repositoryStatisticsManagerControl.getMock();
  action.setRepositoryStatisticsManager(repositoryStatisticsManager);
  metadataRepositoryControl=MockControl.createControl(MetadataRepository.class);
  metadataRepository=(MetadataRepository)metadataRepositoryControl.getMock();
  metadataRepository.removeRepository(REPO_ID);
  respositorySession=mock(RepositorySession.class);
  when(respositorySession.getRepository()).thenReturn(metadataRepository);
  TestRepositorySessionFactory factory=new TestRepositorySessionFactory();
  factory.setRepositorySession(respositorySession);
  action.setRepositorySessionFactory(factory);
  metadataRepositoryControl.replay();
}
Program: 20721
Project: 20721
Buggy source:
public void testConsumerArtifactNotDuplicated() throws Exception {
  when(metadataRepository.getArtifactsByChecksum(TEST_REPO,TEST_CHECKSUM)).thenReturn(Arrays.asList(TEST_METADATA));
  consumer.beginScan(config,new Date());
  consumer.processFile(TEST_FILE);
  consumer.completeScan();
  verify(metadataRepository,never()).addMetadataFacet(eq(TEST_REPO),Matchers.<MetadataFacet>anyObject());
}

Fixed version (ground truth):
@Test public void testConsumerArtifactNotDuplicated() throws Exception {
  when(metadataRepository.getArtifactsByChecksum(TEST_REPO,TEST_CHECKSUM)).thenReturn(Arrays.asList(TEST_METADATA));
  consumer.beginScan(config,new Date());
  consumer.processFile(TEST_FILE);
  consumer.completeScan();
  verify(metadataRepository,never()).addMetadataFacet(eq(TEST_REPO),Matchers.<MetadataFacet>anyObject());
}
Program: 20722
Project: 20722
Buggy source:
public void testConsumerArtifactNotAnArtifactPathResults() throws Exception {
  when(metadataRepository.getArtifactsByChecksum(eq(TEST_REPO),anyString())).thenReturn(Arrays.asList(TEST_METADATA,createMetadata("String_Node_Str")));
  when(pathTranslator.getArtifactForPath(TEST_REPO,"String_Node_Str")).thenThrow(new IllegalArgumentException());
  consumer.beginScan(config,new Date());
  consumer.processFile("String_Node_Str");
  consumer.completeScan();
  verify(metadataRepository,never()).addMetadataFacet(eq(TEST_REPO),Matchers.<MetadataFacet>anyObject());
}

Fixed version (ground truth):
@Test public void testConsumerArtifactNotAnArtifactPathResults() throws Exception {
  when(metadataRepository.getArtifactsByChecksum(eq(TEST_REPO),anyString())).thenReturn(Arrays.asList(TEST_METADATA,createMetadata("String_Node_Str")));
  when(pathTranslator.getArtifactForPath(TEST_REPO,"String_Node_Str")).thenThrow(new IllegalArgumentException());
  consumer.beginScan(config,new Date());
  consumer.processFile("String_Node_Str");
  consumer.completeScan();
  verify(metadataRepository,never()).addMetadataFacet(eq(TEST_REPO),Matchers.<MetadataFacet>anyObject());
}
Program: 20723
Project: 20723
Buggy source:
public void testConsumerArtifactNotAnArtifactPathNoResults() throws Exception {
  consumer.beginScan(config,new Date());
  consumer.processFile("String_Node_Str");
  consumer.completeScan();
  verify(metadataRepository,never()).addMetadataFacet(eq(TEST_REPO),Matchers.<MetadataFacet>anyObject());
}

Fixed version (ground truth):
@Test public void testConsumerArtifactNotAnArtifactPathNoResults() throws Exception {
  consumer.beginScan(config,new Date());
  consumer.processFile("String_Node_Str");
  consumer.completeScan();
  verify(metadataRepository,never()).addMetadataFacet(eq(TEST_REPO),Matchers.<MetadataFacet>anyObject());
}
Program: 20724
Project: 20724
Buggy source:
public void testConsumerArtifactDuplicatedButSelfNotInMetadataRepository() throws Exception {
  when(metadataRepository.getArtifactsByChecksum(TEST_REPO,TEST_CHECKSUM)).thenReturn(Arrays.asList(createMetadata("String_Node_Str")));
  consumer.beginScan(config,new Date());
  consumer.processFile(TEST_FILE);
  consumer.completeScan();
  ArgumentCaptor<RepositoryProblemFacet> argument=ArgumentCaptor.forClass(RepositoryProblemFacet.class);
  verify(metadataRepository).addMetadataFacet(eq(TEST_REPO),argument.capture());
  RepositoryProblemFacet problem=argument.getValue();
  assertProblem(problem);
}

Fixed version (ground truth):
@Test public void testConsumerArtifactDuplicatedButSelfNotInMetadataRepository() throws Exception {
  when(metadataRepository.getArtifactsByChecksum(TEST_REPO,TEST_CHECKSUM)).thenReturn(Arrays.asList(createMetadata("String_Node_Str")));
  consumer.beginScan(config,new Date());
  consumer.processFile(TEST_FILE);
  consumer.completeScan();
  ArgumentCaptor<RepositoryProblemFacet> argument=ArgumentCaptor.forClass(RepositoryProblemFacet.class);
  verify(metadataRepository).addMetadataFacet(eq(TEST_REPO),argument.capture());
  RepositoryProblemFacet problem=argument.getValue();
  assertProblem(problem);
}
Program: 20725
Project: 20725
Buggy source:
public void testConsumerArtifactDuplicated() throws Exception {
  when(metadataRepository.getArtifactsByChecksum(TEST_REPO,TEST_CHECKSUM)).thenReturn(Arrays.asList(TEST_METADATA,createMetadata("String_Node_Str")));
  consumer.beginScan(config,new Date());
  consumer.processFile(TEST_FILE);
  consumer.completeScan();
  ArgumentCaptor<RepositoryProblemFacet> argument=ArgumentCaptor.forClass(RepositoryProblemFacet.class);
  verify(metadataRepository).addMetadataFacet(eq(TEST_REPO),argument.capture());
  RepositoryProblemFacet problem=argument.getValue();
  assertProblem(problem);
}

Fixed version (ground truth):
@Test public void testConsumerArtifactDuplicated() throws Exception {
  when(metadataRepository.getArtifactsByChecksum(TEST_REPO,TEST_CHECKSUM)).thenReturn(Arrays.asList(TEST_METADATA,createMetadata("String_Node_Str")));
  consumer.beginScan(config,new Date());
  consumer.processFile(TEST_FILE);
  consumer.completeScan();
  ArgumentCaptor<RepositoryProblemFacet> argument=ArgumentCaptor.forClass(RepositoryProblemFacet.class);
  verify(metadataRepository).addMetadataFacet(eq(TEST_REPO),argument.capture());
  RepositoryProblemFacet problem=argument.getValue();
  assertProblem(problem);
}
Program: 20726
Project: 20726
Buggy source:
public void setUp() throws Exception {
  super.setUp();
  consumer=(DuplicateArtifactsConsumer)lookup(KnownRepositoryContentConsumer.class,"String_Node_Str");
  assertNotNull(consumer);
  config=new ManagedRepositoryConfiguration();
  config.setId(TEST_REPO);
  config.setLocation(getTestFile("String_Node_Str").getAbsolutePath());
  metadataRepository=mock(MetadataRepository.class);
  RepositorySession session=mock(RepositorySession.class);
  when(session.getRepository()).thenReturn(metadataRepository);
  RepositorySessionFactory factory=(RepositorySessionFactory)lookup(RepositorySessionFactory.class);
  when(factory.createSession()).thenReturn(session);
  pathTranslator=(RepositoryPathTranslator)lookup(RepositoryPathTranslator.class,"String_Node_Str");
  when(pathTranslator.getArtifactForPath(TEST_REPO,TEST_FILE)).thenReturn(TEST_METADATA);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  super.setUp();
  assertNotNull(consumer);
  config=new ManagedRepositoryConfiguration();
  config.setId(TEST_REPO);
  config.setLocation(new File("String_Node_Str").getAbsolutePath());
  metadataRepository=mock(MetadataRepository.class);
  RepositorySession session=mock(RepositorySession.class);
  when(session.getRepository()).thenReturn(metadataRepository);
  RepositorySessionFactory factory=applicationContext.getBean(RepositorySessionFactory.class);
  when(factory.createSession()).thenReturn(session);
  when(pathTranslator.getArtifactForPath(TEST_REPO,TEST_FILE)).thenReturn(TEST_METADATA);
}
Program: 20727
Project: 20727
Buggy source:
public void testConsumerArtifactFileNotExist() throws Exception {
  consumer.beginScan(config,new Date());
  try {
    consumer.processFile("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  ConsumerException e) {
    assertTrue(e.getCause() instanceof FileNotFoundException);
  }
 finally {
    consumer.completeScan();
  }
  verify(metadataRepository,never()).addMetadataFacet(eq(TEST_REPO),Matchers.<MetadataFacet>anyObject());
}

Fixed version (ground truth):
@Test public void testConsumerArtifactFileNotExist() throws Exception {
  consumer.beginScan(config,new Date());
  try {
    consumer.processFile("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  ConsumerException e) {
    assertTrue(e.getCause() instanceof FileNotFoundException);
  }
 finally {
    consumer.completeScan();
  }
  verify(metadataRepository,never()).addMetadataFacet(eq(TEST_REPO),Matchers.<MetadataFacet>anyObject());
}
Program: 20728
Project: 20728
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
  roleManager=(RoleManager)lookup(RoleManager.ROLE,"String_Node_Str");
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  roleManager=(RoleManager)lookup(RoleManager.class.getName(),"String_Node_Str");
}
Program: 20731
Project: 20731
Buggy source:
public void fromProperties(Map<String,String> properties){
  type=properties.get("String_Node_Str");
  classifier=properties.get("String_Node_Str");
  timestamp=properties.get("String_Node_Str");
  String buildNumber=properties.get("String_Node_Str");
  if (buildNumber != null) {
    this.buildNumber=Integer.valueOf(buildNumber);
  }
}

Fixed version (ground truth):
public void fromProperties(Map<String,String> properties){
  type=properties.get("String_Node_Str");
  classifier=properties.get("String_Node_Str");
  timestamp=properties.get("String_Node_Str");
  String buildNumber=properties.get("String_Node_Str");
  if (buildNumber != null) {
    this.buildNumber=Integer.parseInt(buildNumber);
  }
}
Program: 20732
Project: 20732
Buggy source:
public void updateProjectReference(String repoId,String namespace,String projectId,String projectVersion,ProjectVersionReference reference){
  File directory=new File(getDirectory(repoId),namespace + "String_Node_Str" + projectId+ "String_Node_Str"+ projectVersion);
  Properties properties=readOrCreateProperties(directory,PROJECT_VERSION_METADATA_KEY);
  int i=Integer.valueOf(properties.getProperty("String_Node_Str","String_Node_Str")) + 1;
  setProperty(properties,"String_Node_Str",Integer.toString(i));
  setProperty(properties,"String_Node_Str" + i + "String_Node_Str",reference.getNamespace());
  setProperty(properties,"String_Node_Str" + i + "String_Node_Str",reference.getProjectId());
  setProperty(properties,"String_Node_Str" + i + "String_Node_Str",reference.getProjectVersion());
  setProperty(properties,"String_Node_Str" + i + "String_Node_Str",reference.getReferenceType().toString());
  try {
    writeProperties(properties,directory,PROJECT_VERSION_METADATA_KEY);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void updateProjectReference(String repoId,String namespace,String projectId,String projectVersion,ProjectVersionReference reference){
  File directory=new File(getDirectory(repoId),namespace + "String_Node_Str" + projectId+ "String_Node_Str"+ projectVersion);
  Properties properties=readOrCreateProperties(directory,PROJECT_VERSION_METADATA_KEY);
  int i=Integer.parseInt(properties.getProperty("String_Node_Str","String_Node_Str")) + 1;
  setProperty(properties,"String_Node_Str",Integer.toString(i));
  setProperty(properties,"String_Node_Str" + i + "String_Node_Str",reference.getNamespace());
  setProperty(properties,"String_Node_Str" + i + "String_Node_Str",reference.getProjectId());
  setProperty(properties,"String_Node_Str" + i + "String_Node_Str",reference.getProjectVersion());
  setProperty(properties,"String_Node_Str" + i + "String_Node_Str",reference.getReferenceType().toString());
  try {
    writeProperties(properties,directory,PROJECT_VERSION_METADATA_KEY);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 20733
Project: 20733
Buggy source:
public Collection<ProjectVersionReference> getProjectReferences(String repoId,String namespace,String projectId,String projectVersion){
  File directory=new File(getDirectory(repoId),namespace + "String_Node_Str" + projectId+ "String_Node_Str"+ projectVersion);
  Properties properties=readOrCreateProperties(directory,PROJECT_VERSION_METADATA_KEY);
  int numberOfRefs=Integer.valueOf(properties.getProperty("String_Node_Str","String_Node_Str")) + 1;
  List<ProjectVersionReference> references=new ArrayList<ProjectVersionReference>();
  for (int i=0; i < numberOfRefs; i++) {
    ProjectVersionReference reference=new ProjectVersionReference();
    reference.setProjectId(properties.getProperty("String_Node_Str" + i + "String_Node_Str"));
    reference.setNamespace(properties.getProperty("String_Node_Str" + i + "String_Node_Str"));
    reference.setProjectVersion(properties.getProperty("String_Node_Str" + i + "String_Node_Str"));
    reference.setReferenceType(ProjectVersionReference.ReferenceType.valueOf(properties.getProperty("String_Node_Str" + i + "String_Node_Str")));
    references.add(reference);
  }
  return references;
}

Fixed version (ground truth):
public Collection<ProjectVersionReference> getProjectReferences(String repoId,String namespace,String projectId,String projectVersion){
  File directory=new File(getDirectory(repoId),namespace + "String_Node_Str" + projectId+ "String_Node_Str"+ projectVersion);
  Properties properties=readOrCreateProperties(directory,PROJECT_VERSION_METADATA_KEY);
  int numberOfRefs=Integer.parseInt(properties.getProperty("String_Node_Str","String_Node_Str")) + 1;
  List<ProjectVersionReference> references=new ArrayList<ProjectVersionReference>();
  for (int i=0; i < numberOfRefs; i++) {
    ProjectVersionReference reference=new ProjectVersionReference();
    reference.setProjectId(properties.getProperty("String_Node_Str" + i + "String_Node_Str"));
    reference.setNamespace(properties.getProperty("String_Node_Str" + i + "String_Node_Str"));
    reference.setProjectVersion(properties.getProperty("String_Node_Str" + i + "String_Node_Str"));
    reference.setReferenceType(ProjectVersionReference.ReferenceType.valueOf(properties.getProperty("String_Node_Str" + i + "String_Node_Str")));
    references.add(reference);
  }
  return references;
}