Program: 66574
Project: 66574
Buggy source:
/** 
 * Return the category map.
 * @return
 */
private Map<String,Category> getCategoryMap(){
  if (categories != null)   return categories;
  categories=new HashMap<String,Category>();
  IExtensionRegistry extReg=Platform.getExtensionRegistry();
  IExtensionPoint extPoint=extReg.getExtensionPoint(EXTENSION_POINT);
  if (extPoint == null)   return categories;
  IExtension[] exts=extPoint.getExtensions();
  if (exts == null) {
    return categories;
  }
  for (int e=0; e < exts.length; e++) {
    try {
      IConfigurationElement[] configElems=exts[e].getConfigurationElements();
      if (configElems == null)       continue;
      for (int i=0; i < configElems.length; i++) {
        boolean isVisible=extractBoolean(configElems[i].getAttribute(ATTRIBUTE_ISVISIBLE),true);
        if (configElems[i].getName().equals(ELEMENT_CATEGORY)) {
          Category category=new Category(configElems[i].getAttribute(ATTRIBUTE_NAME),configElems[i].getAttribute(ATTRIBUTE_DESC),isVisible);
          categories.put(category.getName(),category);
          IScriptFunctionFactory factory=null;
          if (configElems[i].getAttribute(ATTRIBUTE_FACTORYCLASS) != null)           factory=(IScriptFunctionFactory)configElems[i].createExecutableExtension(ATTRIBUTE_FACTORYCLASS);
          IConfigurationElement[] functions=configElems[i].getChildren(ELEMENT_FUNCTION);
          for (int j=0; j < functions.length; j++) {
            IScriptFunction function=getScriptFunction(category,factory,functions[j]);
            if (function != null)             category.addFunction(function);
          }
        }
 else         if (configElems[i].getName().equals(ELEMENT_FUNCTION)) {
          if (categories.get(DEFAULT_CATEGORYNAME) == null) {
            categories.put(DEFAULT_CATEGORYNAME,new Category(DEFAULT_CATEGORYNAME,null,isVisible));
          }
          IScriptFunction function=getScriptFunction(categories.get(DEFAULT_CATEGORYNAME),null,configElems[i]);
          if (function != null)           categories.get(DEFAULT_CATEGORYNAME).addFunction(function);
        }
 else         if (configElems[i].getName().equals(ELEMENT_JSLIB)) {
          populateResources(jsLibs,"String_Node_Str",configElems[i]);
        }
      }
    }
 catch (    BirtException ex) {
      ex.printStackTrace();
    }
  }
  return categories;
}

Fixed version (ground truth):
/** 
 * Return the category map.
 * @return
 */
private synchronized Map<String,Category> getCategoryMap(){
  if (categories != null)   return categories;
  categories=new HashMap<String,Category>();
  IExtensionRegistry extReg=Platform.getExtensionRegistry();
  IExtensionPoint extPoint=extReg.getExtensionPoint(EXTENSION_POINT);
  if (extPoint == null)   return categories;
  IExtension[] exts=extPoint.getExtensions();
  if (exts == null) {
    return categories;
  }
  for (int e=0; e < exts.length; e++) {
    try {
      IConfigurationElement[] configElems=exts[e].getConfigurationElements();
      if (configElems == null)       continue;
      for (int i=0; i < configElems.length; i++) {
        boolean isVisible=extractBoolean(configElems[i].getAttribute(ATTRIBUTE_ISVISIBLE),true);
        if (configElems[i].getName().equals(ELEMENT_CATEGORY)) {
          Category category=new Category(configElems[i].getAttribute(ATTRIBUTE_NAME),configElems[i].getAttribute(ATTRIBUTE_DESC),isVisible);
          categories.put(category.getName(),category);
          IScriptFunctionFactory factory=null;
          if (configElems[i].getAttribute(ATTRIBUTE_FACTORYCLASS) != null)           factory=(IScriptFunctionFactory)configElems[i].createExecutableExtension(ATTRIBUTE_FACTORYCLASS);
          IConfigurationElement[] functions=configElems[i].getChildren(ELEMENT_FUNCTION);
          for (int j=0; j < functions.length; j++) {
            IScriptFunction function=getScriptFunction(category,factory,functions[j]);
            if (function != null)             category.addFunction(function);
          }
        }
 else         if (configElems[i].getName().equals(ELEMENT_FUNCTION)) {
          if (categories.get(DEFAULT_CATEGORYNAME) == null) {
            categories.put(DEFAULT_CATEGORYNAME,new Category(DEFAULT_CATEGORYNAME,null,isVisible));
          }
          IScriptFunction function=getScriptFunction(categories.get(DEFAULT_CATEGORYNAME),null,configElems[i]);
          if (function != null)           categories.get(DEFAULT_CATEGORYNAME).addFunction(function);
        }
 else         if (configElems[i].getName().equals(ELEMENT_JSLIB)) {
          populateResources(jsLibs,"String_Node_Str",configElems[i]);
        }
      }
    }
 catch (    BirtException ex) {
      ex.printStackTrace();
    }
  }
  return categories;
}