Program: 20682
Project: 20682
Buggy source:
@Test public void downloadWithRemoteRedirect() throws Exception {
  RemoteRepository remoteRepository=getRemoteRepositoriesService().getRemoteRepository("String_Node_Str");
  remoteRepository.setUrl("String_Node_Str" + redirectPort);
  getRemoteRepositoriesService().updateRemoteRepository(remoteRepository);
  RoleManagementService roleManagementService=getRoleManagementService(authorizationHeader);
  if (!roleManagementService.templatedRoleExists(ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,"String_Node_Str")) {
    roleManagementService.createTemplatedRole(ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,"String_Node_Str");
  }
  getUserService(authorizationHeader).createGuestUser();
  roleManagementService.assignRole(ArchivaRoleConstants.TEMPLATE_GUEST,"String_Node_Str");
  roleManagementService.assignTemplatedRole(ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,"String_Node_Str","String_Node_Str");
  getUserService(authorizationHeader).removeFromCache("String_Node_Str");
  URL url=new URL("String_Node_Str" + port + "String_Node_Str");
  HttpURLConnection urlConnection=(HttpURLConnection)url.openConnection();
  InputStream is=urlConnection.getInputStream();
  File file=new File("String_Node_Str");
  if (file.exists()) {
    file.delete();
  }
  FileWriter fw=new FileWriter(file);
  IOUtil.copy(is,fw);
  ZipFile zipFile=new ZipFile(file);
  List<String> entries=getZipEntriesNames(zipFile);
  ZipEntry zipEntry=zipFile.getEntry("String_Node_Str");
  assertNotNull("String_Node_Str" + entries + "String_Node_Str"+ FileUtils.readFileToString(file),zipEntry);
  zipFile.close();
  file.deleteOnExit();
}

Fixed version (ground truth):
@Test public void downloadWithRemoteRedirect() throws Exception {
  RemoteRepository remoteRepository=getRemoteRepositoriesService().getRemoteRepository("String_Node_Str");
  remoteRepository.setUrl("String_Node_Str" + redirectPort);
  getRemoteRepositoriesService().updateRemoteRepository(remoteRepository);
  RoleManagementService roleManagementService=getRoleManagementService(authorizationHeader);
  if (!roleManagementService.templatedRoleExists(ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,"String_Node_Str")) {
    roleManagementService.createTemplatedRole(ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,"String_Node_Str");
  }
  getUserService(authorizationHeader).createGuestUser();
  roleManagementService.assignRole(ArchivaRoleConstants.TEMPLATE_GUEST,"String_Node_Str");
  roleManagementService.assignTemplatedRole(ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,"String_Node_Str","String_Node_Str");
  getUserService(authorizationHeader).removeFromCache("String_Node_Str");
  File file=new File("String_Node_Str");
  if (file.exists()) {
    file.delete();
  }
  HttpWagon httpWagon=new HttpWagon();
  httpWagon.connect(new Repository("String_Node_Str","String_Node_Str" + port));
  httpWagon.get("String_Node_Str",file);
  ZipFile zipFile=new ZipFile(file);
  List<String> entries=getZipEntriesNames(zipFile);
  ZipEntry zipEntry=zipFile.getEntry("String_Node_Str");
  assertNotNull("String_Node_Str" + entries + "String_Node_Str"+ FileUtils.readFileToString(file),zipEntry);
  zipFile.close();
  file.deleteOnExit();
}