Program: 125330
Project: 125330
Buggy source:
@Test public void test_installFromFolder_updatesite_file() throws Exception {
  if (!CommonsPlugin.isDebugMode() && Platform.inDevelopmentMode()) {
    return;
  }
  final File testDataFile=BundleFileUtil.getBundleFile(this.getClass(),P2InstallerTest.TEST_COMP_MYJIRA);
  Assert.assertNotNull(testDataFile);
  Assert.assertTrue(testDataFile.exists());
  ComponentIndexBean index=new ComponentIndexManager().create(testDataFile);
  Assert.assertNotNull(index);
  final File target=new File(tmpFolder,testDataFile.getName());
  FilesUtils.copyFile(testDataFile,target);
  final File installedFolder=new File(tmpFolder,"String_Node_Str");
  try {
    LocalComponentsInstallComponent installComp=new LocalComponentsInstallComponentTestClass(){
      @Override protected ComponentP2ExtraFeature createComponentFeature(      File f){
        return new ComponentP2ExtraFeature(f){
          @Override public IStatus install(          IProgressMonitor progress,          List<URI> allRepoUris) throws P2ExtraFeatureException {
            useLegacyP2Install=false;
            return super.install(progress,allRepoUris);
          }
          @Override protected void moveToSharedFolder(          File installedComponentFolder,          File compFile) throws IOException {
            super.moveToSharedFolder(installedFolder,compFile);
          }
        }
;
      }
    }
;
    installComp.installFromFolder(tmpFolder);
    final List<File> failedComponents=installComp.getFailedComponents();
    Assert.assertNotNull(failedComponents);
    Assert.assertTrue(failedComponents.isEmpty());
    Assert.assertTrue(installedFolder.exists());
    File installedCompFile=new File(installedFolder,testDataFile.getName());
    Assert.assertTrue(installedCompFile.exists());
    Assert.assertFalse(target.exists());
    Assert.assertEquals(testDataFile.getName(),installedCompFile.getName());
    final long originalChecksumAlder32=FilesUtils.getChecksumAlder32(testDataFile);
    final long checksumAlder32=FilesUtils.getChecksumAlder32(installedCompFile);
    Assert.assertEquals(originalChecksumAlder32,checksumAlder32);
    Bundle bundle=Platform.getBundle(index.getBundleId());
    Assert.assertNotNull("String_Node_Str",bundle);
  }
  finally {
    Bundle bundle=Platform.getBundle(index.getBundleId());
    if (bundle != null) {
      if (bundle.getState() == Bundle.ACTIVE) {
        bundle.stop();
      }
      bundle.uninstall();
    }
  }
}

Fixed version (ground truth):
@Test public void test_installFromFolder_updatesite_file() throws Exception {
  if (!CommonsPlugin.isDebugMode() && Platform.inDevelopmentMode()) {
    return;
  }
  final File testDataFile=BundleFileUtil.getBundleFile(this.getClass(),P2InstallerTest.TEST_COMP_MYJIRA);
  Assert.assertNotNull(testDataFile);
  Assert.assertTrue(testDataFile.exists());
  ComponentIndexBean index=new ComponentIndexManager().create(testDataFile);
  Assert.assertNotNull(index);
  final File target=new File(tmpFolder,testDataFile.getName());
  FilesUtils.copyFile(testDataFile,target);
  final File installedFolder=new File(tmpFolder,"String_Node_Str");
  try {
    LocalComponentsInstallComponent installComp=new LocalComponentsInstallComponentTestClass(){
      @Override protected ComponentP2ExtraFeature createComponentFeature(      File f){
        return new ComponentP2ExtraFeature(f){
          @Override public IStatus install(          IProgressMonitor progress,          List<URI> allRepoUris) throws P2ExtraFeatureException {
            useLegacyP2Install=false;
            return super.install(progress,allRepoUris);
          }
          @Override protected void syncComponentsToLocalNexus(          IProgressMonitor progress,          File installedCompFile){
            File sharedCompFile=new File(installedFolder,installedCompFile.getName());
            try {
              FilesUtils.copyFile(installedCompFile,sharedCompFile);
            }
 catch (            IOException e) {
            }
            boolean deleted=installedCompFile.delete();
            if (!deleted) {
              installedCompFile.deleteOnExit();
            }
          }
        }
;
      }
    }
;
    installComp.installFromFolder(tmpFolder);
    final List<File> failedComponents=installComp.getFailedComponents();
    Assert.assertNotNull(failedComponents);
    Assert.assertTrue(failedComponents.isEmpty());
    Assert.assertTrue(installedFolder.exists());
    File installedCompFile=new File(installedFolder,testDataFile.getName());
    Assert.assertTrue(installedCompFile.exists());
    Assert.assertFalse(target.exists());
    Assert.assertEquals(testDataFile.getName(),installedCompFile.getName());
    final long originalChecksumAlder32=FilesUtils.getChecksumAlder32(testDataFile);
    final long checksumAlder32=FilesUtils.getChecksumAlder32(installedCompFile);
    Assert.assertEquals(originalChecksumAlder32,checksumAlder32);
    Bundle bundle=Platform.getBundle(index.getBundleId());
    Assert.assertNotNull("String_Node_Str",bundle);
  }
  finally {
    Bundle bundle=Platform.getBundle(index.getBundleId());
    if (bundle != null) {
      if (bundle.getState() == Bundle.ACTIVE) {
        bundle.stop();
      }
      bundle.uninstall();
    }
  }
}