Program: 66355
Project: 66355
Buggy source:
private void initUISheetExtensions(String defaultExtensionId){
  mSheets=new LinkedHashMap<String,Collection<IRegisteredSubtaskEntry>>();
  if (UIHelper.isEclipseMode()) {
    IExtensionRegistry pluginRegistry=Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint=pluginRegistry.getExtensionPoint("String_Node_Str","String_Node_Str");
    IExtension[] extensions=extensionPoint.getExtensions();
    for (int iC=0; iC < extensions.length; iC++) {
      IExtension extension=extensions[iC];
      IConfigurationElement[] configElements=extension.getConfigurationElements();
      String id=extension.getSimpleIdentifier();
      if (id == null) {
        id=defaultExtensionId;
      }
      List<IRegisteredSubtaskEntry> cSheets=new ArrayList<IRegisteredSubtaskEntry>();
      for (int i=0; i < configElements.length; i++) {
        IConfigurationElement currentTag=configElements[i];
        if (currentTag.getName().equals("String_Node_Str")) {
          try {
            cSheets.add(new DefaultRegisteredSubtaskEntryImpl(currentTag.getAttribute("String_Node_Str"),currentTag.getAttribute("String_Node_Str"),currentTag.getAttribute("String_Node_Str"),(ISubtaskSheet)currentTag.createExecutableExtension("String_Node_Str")));
          }
 catch (          FrameworkException e) {
            logger.log(e);
          }
        }
      }
      if (!cSheets.isEmpty()) {
        if (mSheets.containsKey(id)) {
          if (extension.getNamespace().equals(NS_NATIVE_IMPL)) {
            cSheets.addAll(mSheets.get(id));
            mSheets.put(id,cSheets);
          }
 else {
            mSheets.get(id).addAll(cSheets);
          }
        }
 else {
          mSheets.put(id,cSheets);
        }
      }
    }
  }
 else {
    List<IRegisteredSubtaskEntry> cSheets=new ArrayList<IRegisteredSubtaskEntry>();
    for (int iC=0; iC < saSheets.length; iC++) {
      try {
        StringTokenizer tokens=new StringTokenizer(saSheets[iC],"String_Node_Str");
        String sNodeIndex=tokens.nextToken();
        String sNodePath=tokens.nextToken();
        String sDisplayName=tokens.nextToken();
        String sSheetClass=tokens.nextToken();
        DefaultRegisteredSubtaskEntryImpl entry=new DefaultRegisteredSubtaskEntryImpl(sNodeIndex,sNodePath,sDisplayName,(ISubtaskSheet)Class.forName(sSheetClass).newInstance());
        cSheets.add(entry);
      }
 catch (      InstantiationException e) {
        logger.log(e);
      }
catch (      IllegalAccessException e) {
        logger.log(e);
      }
catch (      ClassNotFoundException e) {
        logger.log(e);
      }
    }
    mSheets.put("String_Node_Str",cSheets);
  }
}

Fixed version (ground truth):
private void initUISheetExtensions(String defaultExtensionId){
  mSheets=new LinkedHashMap<String,Collection<IRegisteredSubtaskEntry>>();
  if (UIHelper.isEclipseMode()) {
    IExtensionRegistry pluginRegistry=Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint=pluginRegistry.getExtensionPoint("String_Node_Str","String_Node_Str");
    IExtension[] extensions=extensionPoint.getExtensions();
    for (int iC=0; iC < extensions.length; iC++) {
      IExtension extension=extensions[iC];
      IConfigurationElement[] configElements=extension.getConfigurationElements();
      String id=extension.getSimpleIdentifier();
      if (id == null) {
        id=defaultExtensionId;
      }
      Set<IRegisteredSubtaskEntry> cSheets=new LinkedHashSet<IRegisteredSubtaskEntry>();
      for (int i=0; i < configElements.length; i++) {
        IConfigurationElement currentTag=configElements[i];
        if (currentTag.getName().equals("String_Node_Str")) {
          try {
            cSheets.add(new DefaultRegisteredSubtaskEntryImpl(currentTag.getAttribute("String_Node_Str"),currentTag.getAttribute("String_Node_Str"),currentTag.getAttribute("String_Node_Str"),(ISubtaskSheet)currentTag.createExecutableExtension("String_Node_Str")));
          }
 catch (          FrameworkException e) {
            logger.log(e);
          }
        }
      }
      if (!cSheets.isEmpty()) {
        if (mSheets.containsKey(id)) {
          Collection<IRegisteredSubtaskEntry> oldSheets=mSheets.get(id);
          Map<Integer,IRegisteredSubtaskEntry> oldSheetsMap=new HashMap<Integer,IRegisteredSubtaskEntry>();
          for (          IRegisteredSubtaskEntry entry : oldSheets) {
            oldSheetsMap.put(entry.getNodeIndex(),entry);
          }
          for (          IRegisteredSubtaskEntry entry : cSheets) {
            IRegisteredSubtaskEntry oldEntry=oldSheetsMap.get(entry.getNodeIndex());
            if (oldEntry == null || ((DefaultRegisteredSubtaskEntryImpl)entry).getPriority() > ((DefaultRegisteredSubtaskEntryImpl)oldEntry).getPriority()) {
              oldSheets.add(entry);
            }
          }
        }
 else {
          mSheets.put(id,cSheets);
        }
      }
    }
  }
 else {
    List<IRegisteredSubtaskEntry> cSheets=new ArrayList<IRegisteredSubtaskEntry>();
    for (int iC=0; iC < saSheets.length; iC++) {
      try {
        StringTokenizer tokens=new StringTokenizer(saSheets[iC],"String_Node_Str");
        String sNodeIndex=tokens.nextToken();
        String sNodePath=tokens.nextToken();
        String sDisplayName=tokens.nextToken();
        String sSheetClass=tokens.nextToken();
        DefaultRegisteredSubtaskEntryImpl entry=new DefaultRegisteredSubtaskEntryImpl(sNodeIndex,sNodePath,sDisplayName,(ISubtaskSheet)Class.forName(sSheetClass).newInstance());
        cSheets.add(entry);
      }
 catch (      InstantiationException e) {
        logger.log(e);
      }
catch (      IllegalAccessException e) {
        logger.log(e);
      }
catch (      ClassNotFoundException e) {
        logger.log(e);
      }
    }
    mSheets.put("String_Node_Str",cSheets);
  }
}