Program: 185596
Project: 185596
Buggy source:
public CompilerChooser initialize() throws BundleException {
  if (initialized)   return this;
  initialized=true;
  SpecifiedVersion specifiedVersion=getVersionFromProperties();
  if (specifiedVersion == SpecifiedVersion.UNSPECIFIED) {
    specifiedVersion=getVersionFromPrefenences();
  }
  System.out.println("String_Node_Str" + specifiedVersion.toReadableVersionString());
  Bundle[] bundles=Platform.getBundles(GROOVY_PLUGIN_ID,null);
  if (bundles == null || bundles.length == 0) {
    System.out.println("String_Node_Str");
    bundles=new Bundle[0];
  }
 else {
    dump(bundles);
  }
  allVersions=new Version[bundles.length];
  allSpecifiedVersions=new SpecifiedVersion[bundles.length];
  if (specifiedVersion != SpecifiedVersion.UNSPECIFIED) {
    boolean found=false;
    for (int i=0, n=bundles.length; i < n; i+=1) {
      Bundle bundle=bundles[i];
      allVersions[i]=bundle.getVersion();
      allSpecifiedVersions[i]=SpecifiedVersion.findVersion(bundle.getVersion());
      if (allSpecifiedVersions[i] == specifiedVersion && !found) {
        activeIndex=i;
        found=true;
      }
    }
    if (found) {
      for (int i=0, n=bundles.length; i < n; i+=1) {
        Bundle bundle=bundles[i];
        if (i != activeIndex) {
          System.out.println("String_Node_Str" + bundle.getVersion());
          bundle.uninstall();
          refreshPackages(bundle);
        }
 else {
          System.out.println("String_Node_Str" + bundle.getVersion());
        }
      }
    }
 else {
      System.out.println("String_Node_Str" + allVersions[0] + "String_Node_Str");
    }
  }
 else {
    for (int i=0, n=bundles.length; i < n; i+=1) {
      Bundle bundle=bundles[i];
      allVersions[i]=bundle.getVersion();
      allSpecifiedVersions[i]=SpecifiedVersion.findVersion(bundle.getVersion());
    }
  }
  return this;
}

Fixed version (ground truth):
public CompilerChooser initialize() throws BundleException {
  if (!initialized) {
    initialized=true;
    SpecifiedVersion specifiedVersion=getVersionFromProperties();
    if (specifiedVersion == SpecifiedVersion.UNSPECIFIED) {
      specifiedVersion=getVersionFromPrefenences();
    }
    System.out.println("String_Node_Str" + specifiedVersion.toReadableVersionString());
    Bundle[] bundles=Platform.getBundles(GROOVY_PLUGIN_ID,null);
    if (bundles == null || bundles.length == 0) {
      System.out.println("String_Node_Str");
      bundles=new Bundle[0];
    }
 else {
      dump(Arrays.asList(bundles));
    }
    allVersions=new Version[bundles.length];
    allSpecifiedVersions=new SpecifiedVersion[bundles.length];
    for (int i=0, n=bundles.length; i < n; i+=1) {
      Bundle bundle=bundles[i];
      allVersions[i]=bundle.getVersion();
      allSpecifiedVersions[i]=SpecifiedVersion.findVersion(bundle.getVersion());
      if (allSpecifiedVersions[i] == specifiedVersion && activeIndex == -1) {
        activeIndex=i;
      }
    }
    if (bundles.length > 1) {
      int skip=Math.max(0,activeIndex);
      Collection<Bundle> dirty=new ArrayList<Bundle>();
      for (int i=0, n=bundles.length; i < n; i+=1) {
        Bundle bundle=bundles[i];
        if (i == skip) {
          System.out.println("String_Node_Str" + bundle.getVersion());
        }
 else {
          System.out.println("String_Node_Str" + bundle.getVersion());
          bundle.uninstall();
          dirty.add(bundle);
        }
      }
      refreshPackages(dirty);
    }
  }
  return this;
}