nus-yam/ex-repair huggingface dataset:
Program: 69404
Project: 69404
Buggy source:
public IReportItemExecutor getNextChild(){
  IReportItemExecutor nextExecutor=null;
  try {
    while (walker.hasNext()) {
      ColumnEvent ev=walker.next();
switch (currentChangeType) {
case ColumnEvent.ROW_EDGE_CHANGE:
        if (blankStarted && ev.type != ColumnEvent.ROW_EDGE_CHANGE) {
          nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
          ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
          blankStarted=false;
          hasLast=false;
        }
      break;
  }
  if (!blankStarted && (ev.type == ColumnEvent.ROW_EDGE_CHANGE)) {
    blankStarted=true;
    rowSpan=1;
    colSpan=0;
    hasLast=true;
  }
  currentEdgePosition=ev.dataPosition;
  currentChangeType=ev.type;
  colSpan++;
  currentColIndex++;
  if (nextExecutor != null) {
    return nextExecutor;
  }
}
}
 catch (OLAPException e) {
logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
}
if (hasLast) {
hasLast=false;
if (blankStarted) {
  nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
  ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
  blankStarted=false;
}
}
return nextExecutor;
}

Fixed version (ground truth):
public IReportItemExecutor getNextChild(){
  IReportItemExecutor nextExecutor=null;
  try {
    while (walker.hasNext()) {
      ColumnEvent ev=walker.next();
switch (currentChangeType) {
case ColumnEvent.ROW_EDGE_CHANGE:
case ColumnEvent.MEASURE_HEADER_CHANGE:
        if (blankStarted && ev.type != ColumnEvent.ROW_EDGE_CHANGE && ev.type != ColumnEvent.MEASURE_HEADER_CHANGE) {
          nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
          ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
          blankStarted=false;
          hasLast=false;
        }
      break;
  }
  if (!blankStarted && (ev.type == ColumnEvent.ROW_EDGE_CHANGE)) {
    blankStarted=true;
    rowSpan=1;
    colSpan=0;
    hasLast=true;
  }
 else   if (!emptyStarted && ev.type != ColumnEvent.ROW_EDGE_CHANGE && ev.type != ColumnEvent.MEASURE_HEADER_CHANGE) {
    emptyStarted=true;
    rowSpan=1;
    colSpan=0;
    hasLast=true;
  }
  currentEdgePosition=ev.dataPosition;
  currentChangeType=ev.type;
  colSpan++;
  currentColIndex++;
  if (nextExecutor != null) {
    return nextExecutor;
  }
}
}
 catch (OLAPException e) {
logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
}
if (hasLast) {
hasLast=false;
if (blankStarted) {
  nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
  ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
  blankStarted=false;
}
 else if (emptyStarted) {
  nextExecutor=new CrosstabCellExecutor(this,null,rowSpan,colSpan,currentColIndex - colSpan + 1);
  ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
  emptyStarted=false;
}
}
return nextExecutor;
}
Program: 69405
Project: 69405
Buggy source:
private void prepareChildren(){
  currentChangeType=ColumnEvent.UNKNOWN_CHANGE;
  currentColIndex=-1;
  currentEdgePosition=-1;
  blankStarted=false;
  rowSpan=1;
  colSpan=0;
  hasLast=false;
  walker.reload();
}

Fixed version (ground truth):
private void prepareChildren(){
  currentChangeType=ColumnEvent.UNKNOWN_CHANGE;
  currentColIndex=-1;
  currentEdgePosition=-1;
  blankStarted=false;
  emptyStarted=false;
  rowSpan=1;
  colSpan=0;
  hasLast=false;
  walker.reload();
}
Program: 69406
Project: 69406
Buggy source:
protected boolean layoutNodes() throws BirtException {
  boolean hasNext=false;
  if (childLayout != null) {
    hasNext=childLayout.layout();
    if (childLayout.isFinished()) {
      childLayout.close();
      childExecutor.close();
      childLayout=null;
      childExecutor=null;
    }
    if (hasNext) {
      return true;
    }
  }
  while (executor.hasNextChild() && !context.getCancelFlag()) {
    childExecutor=(IReportItemExecutor)executor.getNextChild();
    IContent childContent=childExecutor.execute();
    if (childContent != null) {
      childLayout=engine.createLayoutManager(this,childContent,childExecutor,emitter);
      hasNext=childLayout.layout();
      if (!executor.hasNextChild()) {
        childContent.setLastChild(true);
      }
 else {
        childContent.setLastChild(false);
      }
      if (hasNext) {
        if (childLayout.isFinished()) {
          childLayout.close();
          childExecutor.close();
          childLayout=null;
          childExecutor=null;
        }
        return true;
      }
      childLayout.close();
      childLayout=null;
    }
    childExecutor.close();
    childExecutor=null;
  }
  return false;
}

Fixed version (ground truth):
protected boolean layoutNodes() throws BirtException {
  boolean hasNext=false;
  if (childLayout != null) {
    hasNext=childLayout.layout();
    if (childLayout.isFinished()) {
      childLayout.close();
      childExecutor.close();
      childLayout=null;
      childExecutor=null;
    }
    if (hasNext) {
      return true;
    }
  }
  while (executor.hasNextChild() && !context.getCancelFlag()) {
    childExecutor=(IReportItemExecutor)executor.getNextChild();
    childContent=childExecutor.execute();
    if (childContent != null) {
      childLayout=engine.createLayoutManager(this,childContent,childExecutor,emitter);
      hasNext=childLayout.layout();
      if (hasNext) {
        if (childLayout.isFinished()) {
          childLayout.close();
          childExecutor.close();
          childLayout=null;
          childExecutor=null;
        }
        return true;
      }
      childLayout.close();
      childLayout=null;
    }
    childExecutor.close();
    childExecutor=null;
  }
  if (childContent != null) {
    childContent.setLastChild(true);
  }
  return false;
}
Program: 69407
Project: 69407
Buggy source:
private void initalizeChildren() throws BirtException {
  while (executor.hasNextChild()) {
    IReportItemExecutor childExecutor=(IReportItemExecutor)executor.getNextChild();
    IContent childContent=childExecutor.execute();
    if (childContent == null) {
      childrenLayouts.add(null);
    }
 else {
      if (!executor.hasNextChild()) {
        childContent.setLastChild(true);
      }
 else {
        childContent.setLastChild(false);
      }
      ILayoutManager childLayout=engine.createLayoutManager(this,childContent,childExecutor,emitter);
      childrenLayouts.add(childLayout);
    }
    childrenExecutors.add(childExecutor);
    childrenFinished.add(Boolean.FALSE);
  }
}

Fixed version (ground truth):
private void initalizeChildren() throws BirtException {
  IContent childContent=null;
  while (executor.hasNextChild()) {
    IReportItemExecutor childExecutor=(IReportItemExecutor)executor.getNextChild();
    childContent=childExecutor.execute();
    if (childContent == null) {
      childrenLayouts.add(null);
    }
 else {
      ILayoutManager childLayout=engine.createLayoutManager(this,childContent,childExecutor,emitter);
      childrenLayouts.add(childLayout);
    }
    childrenExecutors.add(childExecutor);
    childrenFinished.add(Boolean.FALSE);
  }
  if (childContent != null) {
    childContent.setLastChild(true);
  }
}
Program: 69408
Project: 69408
Buggy source:
protected boolean layoutNodes() throws BirtException {
  boolean hasNext=false;
  if (childLayout != null) {
    hasNext=childLayout.layout();
    if (childLayout.isFinished()) {
      childLayout.close();
      childExecutor.close();
      childLayout=null;
      childExecutor=null;
    }
    if (hasNext) {
      return true;
    }
  }
  while (executor.hasNextChild() && !context.getCancelFlag()) {
    childExecutor=(IReportItemExecutor)executor.getNextChild();
    IContent childContent=childExecutor.execute();
    if (childContent != null) {
      childLayout=engine.createLayoutManager(this,childContent,childExecutor,emitter);
      hasNext=childLayout.layout();
      if (hasNext) {
        if (childLayout.isFinished()) {
          childLayout.close();
          childExecutor.close();
          childLayout=null;
          childExecutor=null;
        }
        return true;
      }
      childLayout.close();
      childLayout=null;
    }
    childExecutor.close();
    childExecutor=null;
  }
  return false;
}

Fixed version (ground truth):
protected boolean layoutNodes() throws BirtException {
  boolean hasNext=false;
  if (childLayout != null) {
    hasNext=childLayout.layout();
    if (childLayout.isFinished()) {
      childLayout.close();
      childExecutor.close();
      childLayout=null;
      childExecutor=null;
    }
    if (hasNext) {
      return true;
    }
  }
  while (executor.hasNextChild() && !context.getCancelFlag()) {
    childExecutor=(IReportItemExecutor)executor.getNextChild();
    IContent childContent=childExecutor.execute();
    if (childContent != null) {
      childLayout=engine.createLayoutManager(this,childContent,childExecutor,emitter);
      hasNext=childLayout.layout();
      if (!executor.hasNextChild()) {
        childContent.setLastChild(true);
      }
 else {
        childContent.setLastChild(false);
      }
      if (hasNext) {
        if (childLayout.isFinished()) {
          childLayout.close();
          childExecutor.close();
          childLayout=null;
          childExecutor=null;
        }
        return true;
      }
      childLayout.close();
      childLayout=null;
    }
    childExecutor.close();
    childExecutor=null;
  }
  return false;
}
Program: 69409
Project: 69409
Buggy source:
private void initalizeChildren() throws BirtException {
  while (executor.hasNextChild()) {
    IReportItemExecutor childExecutor=(IReportItemExecutor)executor.getNextChild();
    IContent childContent=childExecutor.execute();
    if (childContent == null) {
      childrenLayouts.add(null);
    }
 else {
      ILayoutManager childLayout=engine.createLayoutManager(this,childContent,childExecutor,emitter);
      childrenLayouts.add(childLayout);
    }
    childrenExecutors.add(childExecutor);
    childrenFinished.add(Boolean.FALSE);
  }
}

Fixed version (ground truth):
private void initalizeChildren() throws BirtException {
  while (executor.hasNextChild()) {
    IReportItemExecutor childExecutor=(IReportItemExecutor)executor.getNextChild();
    IContent childContent=childExecutor.execute();
    if (childContent == null) {
      childrenLayouts.add(null);
    }
 else {
      if (!executor.hasNextChild()) {
        childContent.setLastChild(true);
      }
 else {
        childContent.setLastChild(false);
      }
      ILayoutManager childLayout=engine.createLayoutManager(this,childContent,childExecutor,emitter);
      childrenLayouts.add(childLayout);
    }
    childrenExecutors.add(childExecutor);
    childrenFinished.add(Boolean.FALSE);
  }
}
Program: 69410
Project: 69410
Buggy source:
private void start(ContainerArea area){
  if (startContent == null) {
    startContent=createSizeBasedContent(area);
    currentContent=startContent;
  }
 else {
    if (currentContent != null) {
      if (InstanceIDComparator.isNextWith(currentContent.content,area.content)) {
        currentContent=createSizeBasedContent(area);
      }
 else       if (InstanceIDComparator.equals(startContent.content,currentContent.content)) {
        if (startContent.content instanceof IContainerContent) {
          startContent=createSizeBasedContent(area);
          currentContent=startContent;
        }
      }
 else {
        fixedLayoutPageHints.add(new SizeBasedContent[]{startContent,currentContent});
        startContent=createSizeBasedContent(area);
        currentContent=startContent;
      }
    }
  }
}

Fixed version (ground truth):
private void start(ContainerArea area){
  if (startContent == null) {
    startContent=createSizeBasedContent(area);
    currentContent=startContent;
  }
 else {
    if (currentContent != null) {
      if (InstanceIDComparator.isNextWith(currentContent.content,area.content)) {
        currentContent=createSizeBasedContent(area);
      }
 else       if (InstanceIDComparator.equals(currentContent.content,area.content)) {
      }
 else {
        fixedLayoutPageHints.add(new SizeBasedContent[]{startContent,currentContent});
        startContent=createSizeBasedContent(area);
        currentContent=startContent;
      }
    }
  }
}
Program: 69411
Project: 69411
Buggy source:
static boolean isNextWith(IContent content1,IContent content2){
  if (content1 == null || content2 == null || content1 == content2) {
    return false;
  }
  InstanceID id1=content1.getInstanceID();
  InstanceID id2=content2.getInstanceID();
  if (id1 == null || id2 == null) {
    return false;
  }
  if (id2.getUniqueID() == 0) {
    return equals(content1,(IContent)content2.getParent());
  }
 else   if ((content1 != null) && content1.isLastChild()) {
    content1=(IContent)content1.getParent();
    return isNextWith(content1,content2);
  }
 else   if (id1.getUniqueID() + 1 == id2.getUniqueID()) {
    IContent parent1=(IContent)content1.getParent();
    IContent parent2=(IContent)content2.getParent();
    return equals(parent1,parent2);
  }
  return false;
}

Fixed version (ground truth):
static boolean isNextWith(IContent content1,IContent content2){
  if (content1 == null || content2 == null || content1 == content2) {
    return false;
  }
  InstanceID id1=content1.getInstanceID();
  InstanceID id2=content2.getInstanceID();
  if (id1 == null || id2 == null) {
    return false;
  }
  if (id2.getUniqueID() == 0) {
    IContent parent2=(IContent)content2.getParent();
    if (parent2 instanceof IListBandContent || parent2 instanceof ITableBandContent) {
      InstanceID pid2=parent2.getInstanceID();
      if (pid2 == null) {
        return false;
      }
 else {
        if (pid2.getUniqueID() == 0) {
          return isNextWith(content1,parent2);
        }
 else {
          if (!content1.isLastChild()) {
            return false;
          }
          IContent parent1=(IContent)content1.getParent();
          while (parent1.isLastChild()) {
            parent1=(IContent)parent1.getParent();
          }
          if (parent1 instanceof IListBandContent || parent1 instanceof ITableBandContent) {
            return isSilbing(parent1,parent2);
          }
 else {
            return false;
          }
        }
      }
    }
 else {
      return equals(content1,parent2);
    }
  }
 else {
    if (content1 instanceof IContainerContent) {
      IContainerContent container=(IContainerContent)content1;
      if (container.getChildren().size() > 0) {
        return false;
      }
    }
    if (content1.isLastChild()) {
      IContent parent1=(IContent)content1.getParent();
      while (parent1.isLastChild()) {
        parent1=(IContent)parent1.getParent();
      }
      if (parent1 instanceof IListBandContent || parent1 instanceof ITableBandContent) {
        return false;
      }
 else {
        return isSilbing(parent1,content2);
      }
    }
 else {
      return isSilbing(content1,content2);
    }
  }
}
Program: 69412
Project: 69412
Buggy source:
/** 
 * when generating page hint, inline text must invoke this method first.
 */
public void updatePageHintInfo(InlineTextArea area){
  if (lineBreaks == null || lineBreaks.size() == 0) {
    return;
  }
  int lineNumber=lines.indexOf(area);
  if (lineNumber != 0 && !lineBreaks.contains(lineNumber - 1)) {
    return;
  }
  offsetInContent=0;
  floatPos=0;
  dimension=0;
  widthRestrict=0;
  Collections.sort(lineBreaks);
  int startLineNumber=lineNumber;
  for (int i=0; i < startLineNumber; i++) {
    offsetInContent+=lines.get(i).getAllocatedWidth();
  }
  for (Iterator<Integer> iter=lineBreaks.iterator(); iter.hasNext(); ) {
    int breakLineNumber=iter.next();
    if (breakLineNumber >= startLineNumber) {
      InlineTextArea startLine=lines.get(startLineNumber);
      floatPos=startLine.getAllocatedX();
      for (int i=startLineNumber; i <= breakLineNumber; i++) {
        dimension+=lines.get(i).getAllocatedWidth();
        widthRestrict=startLine.parent.getWidth();
      }
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * when generating page hint, inline text must invoke this method first.
 */
public void updatePageHintInfo(InlineTextArea area){
  if (lineBreaks == null || lineBreaks.size() == 0) {
    return;
  }
  offsetInContent=0;
  floatPos=0;
  dimension=0;
  widthRestrict=0;
  int lineNumber=lines.indexOf(area);
  if (lineNumber != 0 && !lineBreaks.contains(lineNumber - 1)) {
    return;
  }
  Collections.sort(lineBreaks);
  int startLineNumber=lineNumber;
  for (int i=0; i < startLineNumber; i++) {
    offsetInContent+=lines.get(i).getAllocatedWidth();
  }
  for (Iterator<Integer> iter=lineBreaks.iterator(); iter.hasNext(); ) {
    int breakLineNumber=iter.next();
    if (breakLineNumber >= startLineNumber) {
      InlineTextArea startLine=lines.get(startLineNumber);
      floatPos=startLine.getAllocatedX();
      for (int i=startLineNumber; i <= breakLineNumber; i++) {
        dimension+=lines.get(i).getAllocatedWidth();
        widthRestrict=startLine.parent.getWidth();
      }
      break;
    }
  }
}
Program: 69413
Project: 69413
Buggy source:
public Object evaluate(ScriptContext scriptContext,ICompiledScript compiledScript) throws BirtException {
  assert(compiledScript instanceof CompiledJavascript);
  Script script=((CompiledJavascript)compiledScript).getCompiledScript();
  Object value=script.exec(context,getJSScope(scriptContext));
  return jsToJava(value);
}

Fixed version (ground truth):
public Object evaluate(ScriptContext scriptContext,ICompiledScript compiledScript) throws BirtException {
  assert(compiledScript instanceof CompiledJavascript);
  try {
    Script script=((CompiledJavascript)compiledScript).getCompiledScript();
    Object value=script.exec(context,getJSScope(scriptContext));
    return jsToJava(value);
  }
 catch (  JavaScriptException e) {
    throw new BirtException(e.getLocalizedMessage());
  }
}
Program: 69414
Project: 69414
Buggy source:
/** 
 * Splits text for fixed layout reports.
 */
private void splitText(){
  Integer taskType=(Integer)engine.getOption(EngineTask.TASK_TYPE);
  if (taskType.intValue() == IEngineTask.TASK_RENDER && context.isFixedLayout()) {
    SizeBasedContent sizeBasedContent=context.getPageHintManager().getSizeBasedContentMapping().get(content.getInstanceID().toUniqueString());
    if (sizeBasedContent == null || sizeBasedContent.dimension == -1) {
      return;
    }
    HtmlRegionArea container=new HtmlRegionArea();
    container.setWidth(sizeBasedContent.width);
    IContainerContent containerContent=content.getReportContent().createContainerContent();
    containerContent.getChildren().add(content);
    LayoutContext pdfLayoutContext=new LayoutContext();
    pdfLayoutContext.setFormat("String_Node_Str");
    pdfLayoutContext.setFixedLayout(true);
    pdfLayoutContext.setInHtmlRender(true);
    pdfLayoutContext.setLocale(engine.locale);
    pdfLayoutContext.setHtmlLayoutContext(context);
    pdfLayoutContext.setMaxBP(Integer.MAX_VALUE);
    RegionLayoutEngine rle=new RegionLayoutEngine(container,pdfLayoutContext);
    try {
      rle.layout(containerContent);
    }
 catch (    BirtException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Splits text for fixed layout reports.
 */
private void splitText(){
  Integer taskType=(Integer)engine.getOption(EngineTask.TASK_TYPE);
  if (taskType.intValue() == IEngineTask.TASK_RENDER && context.isFixedLayout()) {
    SizeBasedContent sizeBasedContent=context.getPageHintManager().getSizeBasedContentMapping().get(content.getInstanceID().toUniqueString());
    if (sizeBasedContent == null || sizeBasedContent.dimension == -1) {
      return;
    }
    HtmlRegionArea container=new HtmlRegionArea();
    container.setWidth(sizeBasedContent.width);
    IReportContent report=content.getReportContent();
    IContainerContent containerContent=report.createContainerContent();
    containerContent.getChildren().add(content);
    LayoutContext pdfLayoutContext=new LayoutContext();
    pdfLayoutContext.setFormat("String_Node_Str");
    pdfLayoutContext.setFixedLayout(true);
    pdfLayoutContext.setInHtmlRender(true);
    pdfLayoutContext.setLocale(engine.locale);
    pdfLayoutContext.setHtmlLayoutContext(context);
    pdfLayoutContext.setMaxBP(Integer.MAX_VALUE);
    pdfLayoutContext.setReport(report);
    RegionLayoutEngine rle=new RegionLayoutEngine(container,pdfLayoutContext);
    try {
      rle.layout(containerContent);
    }
 catch (    BirtException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}
Program: 69415
Project: 69415
Buggy source:
/** 
 * Creates a new sort based on model sort key definition
 * @throws AdapterException 
 */
public SortAdapter(IModelAdapter adapter,SortKeyHandle keyHandle) throws AdapterException {
  ExpressionHandle handle=keyHandle.getExpressionProperty(SortKey.KEY_MEMBER);
  if (handle == null)   return;
  IScriptExpression expr=adapter.adaptExpression((Expression)handle.getValue());
  this.setExpression(expr);
  this.setSortStrength(keyHandle.getStrength());
  if (keyHandle.getLocale() != null)   this.setSortLocale(keyHandle.getLocale());
}

Fixed version (ground truth):
/** 
 * Creates a new sort based on model sort key definition
 * @throws AdapterException 
 */
public SortAdapter(IModelAdapter adapter,SortKeyHandle keyHandle) throws AdapterException {
  ExpressionHandle handle=keyHandle.getExpressionProperty(SortKey.KEY_MEMBER);
  if (handle == null)   return;
  IScriptExpression expr=adapter.adaptExpression((Expression)handle.getValue());
  this.setExpression(expr);
  this.setSortDirection(sortDirectionFromModel(keyHandle.getDirection()));
  this.setSortStrength(keyHandle.getStrength());
  if (keyHandle.getLocale() != null)   this.setSortLocale(keyHandle.getLocale());
}
Program: 69416
Project: 69416
Buggy source:
public void removeTabItem(String title){
  CTabItem[] items=tabFolder.getItems();
  for (int i=0; i < items.length; i++) {
    if (items[i].getText().equals(title)) {
      itemMap.remove(items[i]);
      items[i].dispose();
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes the tab with given key.
 * @param itemKey
 */
public void removeTabItem(String itemKey){
  CTabItem[] items=tabFolder.getItems();
  for (int i=0; i < items.length; i++) {
    if (items[i].getText().equals(itemKey)) {
      itemMap.remove(items[i]);
      items[i].dispose();
    }
  }
}
Program: 69417
Project: 69417
Buggy source:
public boolean existTabItem(String title){
  CTabItem[] items=tabFolder.getItems();
  for (int i=0; i < items.length; i++) {
    if (items[i].getText().equals(title))     return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if a tab with given key exists.
 * @param itemKey
 * @return
 */
public boolean existTabItem(String itemKey){
  CTabItem[] items=tabFolder.getItems();
  for (int i=0; i < items.length; i++) {
    if (items[i].getText().equals(itemKey))     return true;
  }
  return false;
}
Program: 69418
Project: 69418
Buggy source:
protected void createTabItem(String itemKey,String getItemIndex){
  if (existTabItem(itemKey))   return;
  CTabItem tabItem=new CTabItem(tabFolder,SWT.NONE,getItemIndex(getItemIndex) + 1);
  tabItem.setText(itemKey);
  itemMap.put(tabItem,null);
}

Fixed version (ground truth):
/** 
 * Creates a new tab after the given preceding tab.
 * @param itemKey
 * @param precedingItemKey
 */
protected void createTabItem(String itemKey,String precedingItemKey){
  if (existTabItem(itemKey))   return;
  CTabItem tabItem=new CTabItem(tabFolder,SWT.NONE,getItemIndex(precedingItemKey) + 1);
  tabItem.setText(itemKey);
  itemMap.put(tabItem,null);
}
Program: 69419
Project: 69419
Buggy source:
public int getItemIndex(String title){
  if (title == null)   return -1;
  CTabItem[] items=tabFolder.getItems();
  for (int i=0; i < items.length; i++) {
    if (items[i].getText().equals(title))     return i;
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Returns the index of the tab with given key.
 * @param title
 * @return 0-based index. -1 means no tab found.
 */
public int getItemIndex(String itemKey){
  if (itemKey == null)   return -1;
  CTabItem[] items=tabFolder.getItems();
  for (int i=0; i < items.length; i++) {
    if (items[i].getText().equals(itemKey))     return i;
  }
  return -1;
}
Program: 69420
Project: 69420
Buggy source:
/** 
 * overwrite to add additional tabs.
 */
abstract protected void createTabItems();

Fixed version (ground truth):
/** 
 * The subclass should overwrite this to add additional tabs.
 */
abstract protected void createTabItems();
Program: 69421
Project: 69421
Buggy source:
protected void buildItemContent(CTabItem item){
  if (itemMap.containsKey(item) && itemMap.get(item) == null) {
    String title=tabFolder.getSelection().getText();
    TabPage page=buildTabContent(title);
    if (page != null) {
      setPageInput(page);
      refresh(tabFolder,page,true);
      item.setControl(page.getControl());
      itemMap.put(item,page);
    }
  }
 else   if (itemMap.get(item) != null) {
    setPageInput(itemMap.get(item));
    refresh(tabFolder,itemMap.get(item),false);
  }
}

Fixed version (ground truth):
/** 
 * Builds and initialize the content for each tab.
 * @param item
 */
protected void buildItemContent(CTabItem item){
  if (itemMap.containsKey(item) && itemMap.get(item) == null) {
    String title=tabFolder.getSelection().getText();
    TabPage page=buildTabContent(title);
    if (page != null) {
      setPageInput(page);
      refresh(tabFolder,page,true);
      item.setControl(page.getControl());
      itemMap.put(item,page);
    }
  }
 else   if (itemMap.get(item) != null) {
    setPageInput(itemMap.get(item));
    refresh(tabFolder,itemMap.get(item),false);
  }
}
Program: 69422
Project: 69422
Buggy source:
/** 
 * Creats default content for each tab.
 * @param tabKey
 */
protected TabPage buildTabContent(String tabKey){
  TabPage page=null;
  if (tabKey.equals(BINDINGTITLE)) {
    if (isSupportAggregationBinding()) {
      page=new AggregateOnBindingPage();
    }
 else {
      page=new BindingPage();
    }
  }
 else   if (tabKey.equals(SORTINGTITLE)) {
    page=new FormPage(FormPropertyDescriptor.FULL_FUNCTION,new SortingHandleProvider(),true,true);
  }
 else   if (tabKey.equals(FILTERTITLE)) {
    AbstractFilterHandleProvider filterProvider=(AbstractFilterHandleProvider)ElementAdapterManager.getAdapter(this,AbstractFilterHandleProvider.class);
    if (filterProvider == null) {
      filterProvider=new FilterHandleProvider();
    }
    page=new FormPage(FormPropertyDescriptor.FULL_FUNCTION,filterProvider,true,true);
  }
 else   if (tabKey.equals(HIGHLIGHTSTITLE)) {
    page=new PreviewPage(true);
    ((PreviewPage)page).setPreview(new HighlightPropertyDescriptor(true));
    ((PreviewPage)page).setProvider(new HighlightDescriptorProvider());
  }
 else   if (tabKey.equals(MAPTITLE)) {
    page=new PreviewPage(true);
    ((PreviewPage)page).setPreview(new MapPropertyDescriptor(true));
    ((PreviewPage)page).setProvider(new MapDescriptorProvider());
  }
  return page;
}

Fixed version (ground truth):
/** 
 * Creats the page content for each tab. Note this doesn't include the default cateogry-styled tab, which is handled separately.
 * @param tabKey
 */
protected TabPage buildTabContent(String tabKey){
  TabPage page=null;
  if (tabKey.equals(BINDINGTITLE)) {
    if (isSupportAggregationBinding()) {
      page=new AggregateOnBindingPage();
    }
 else {
      page=new BindingPage();
    }
  }
 else   if (tabKey.equals(SORTINGTITLE)) {
    page=new FormPage(FormPropertyDescriptor.FULL_FUNCTION,new SortingHandleProvider(),true,true);
  }
 else   if (tabKey.equals(FILTERTITLE)) {
    AbstractFilterHandleProvider filterProvider=(AbstractFilterHandleProvider)ElementAdapterManager.getAdapter(this,AbstractFilterHandleProvider.class);
    if (filterProvider == null) {
      filterProvider=new FilterHandleProvider();
    }
    page=new FormPage(FormPropertyDescriptor.FULL_FUNCTION,filterProvider,true,true);
  }
 else   if (tabKey.equals(HIGHLIGHTSTITLE)) {
    page=new PreviewPage(true);
    ((PreviewPage)page).setPreview(new HighlightPropertyDescriptor(true));
    ((PreviewPage)page).setProvider(new HighlightDescriptorProvider());
  }
 else   if (tabKey.equals(MAPTITLE)) {
    page=new PreviewPage(true);
    ((PreviewPage)page).setPreview(new MapPropertyDescriptor(true));
    ((PreviewPage)page).setProvider(new MapDescriptorProvider());
  }
  return page;
}
Program: 69423
Project: 69423
Buggy source:
public void setCategoryProvider(ICategoryProvider provider){
  this.customProvider=provider;
}

Fixed version (ground truth):
/** 
 * Overrides the default category provider for the basic category-styled page. Note this is only effective when called before the <code>createTabItems(List)</code> method is called.
 */
public void setCategoryProvider(ICategoryProvider provider){
  this.customProvider=provider;
}
Program: 69424
Project: 69424
Buggy source:
public String getSelectedTabText(){
  return selectedTabText;
}

Fixed version (ground truth):
/** 
 * Returns the text of current selected tab.
 * @return
 */
public String getSelectedTabText(){
  return selectedTabText;
}
Program: 69425
Project: 69425
Buggy source:
/** 
 * Creates attribute pages
 * @param tabFolder The attribute tabFolder.
 * @param input The current selection.
 */
public void createTabItems(final List input){
  ISafeRunnable runnable=new ISafeRunnable(){
    public void run() throws Exception {
      CTabItem[] oldPages=tabFolder.getItems();
      int index=tabFolder.getSelectionIndex();
      for (int i=0; i < oldPages.length; i++) {
        if (oldPages[i].isDisposed())         continue;
        if (index == i)         continue;
        if (oldPages[i].getControl() != null) {
          oldPages[i].getControl().dispose();
        }
        oldPages[i].dispose();
      }
      if (index > -1 && !oldPages[index].isDisposed()) {
        oldPages[index].getControl().dispose();
        oldPages[index].dispose();
      }
    }
    public void handleException(    Throwable exception){
    }
  }
;
  SafeRunner.run(runnable);
}

Fixed version (ground truth):
/** 
 * Creates the tab items for the page
 * @param tabFolder The attribute tabFolder.
 * @param input The current selection.
 */
public void createTabItems(final List input){
  ISafeRunnable runnable=new ISafeRunnable(){
    public void run() throws Exception {
      CTabItem[] oldPages=tabFolder.getItems();
      int index=tabFolder.getSelectionIndex();
      for (int i=0; i < oldPages.length; i++) {
        if (oldPages[i].isDisposed())         continue;
        if (index == i)         continue;
        if (oldPages[i].getControl() != null) {
          oldPages[i].getControl().dispose();
        }
        oldPages[i].dispose();
      }
      if (index > -1 && !oldPages[index].isDisposed()) {
        oldPages[index].getControl().dispose();
        oldPages[index].dispose();
      }
    }
    public void handleException(    Throwable exception){
    }
  }
;
  SafeRunner.run(runnable);
}
Program: 69426
Project: 69426
Buggy source:
public void setSelectedTabText(String selectedTabText){
  this.selectedTabText=selectedTabText;
}

Fixed version (ground truth):
/** 
 * Sets the text of current selected tab.
 * @param selectedTabText
 */
public void setSelectedTabText(String selectedTabText){
  this.selectedTabText=selectedTabText;
}
Program: 69427
Project: 69427
Buggy source:
Control getControl();

Fixed version (ground truth):
/** 
 * Returns the page control.
 * @return
 */
Control getControl();
Program: 69428
Project: 69428
Buggy source:
void refresh();

Fixed version (ground truth):
/** 
 * Refresh the page content based on current input
 */
void refresh();
Program: 69429
Project: 69429
Buggy source:
Object getInput();

Fixed version (ground truth):
/** 
 * Returns the input.
 * @return
 */
Object getInput();
Program: 69430
Project: 69430
Buggy source:
void createControl(Composite parent,Object input);

Fixed version (ground truth):
/** 
 * Creates the content of the page control.
 * @param parent
 * @param input
 */
void createControl(Composite parent,Object input);
Program: 69431
Project: 69431
Buggy source:
public Object evaluate(String expression){
  try {
    return fResultIterator.getValue(expression);
  }
 catch (  BirtException e) {
    sLogger.log(e);
  }
  return null;
}

Fixed version (ground truth):
public Object evaluate(String expression){
  try {
    return fResultIterator.getValue(expression);
  }
 catch (  BirtException e) {
    sLogger.log(e);
    return e;
  }
}
Program: 69432
Project: 69432
Buggy source:
public void setAttributes(Map<String,Object> attributes){
  if (attributes != null) {
    this.attributes.putAll(attributes);
  }
}

Fixed version (ground truth):
public void setAttributes(Map<String,Object> attributes){
  if (attributes != null) {
    for (    Entry<String,Object> attribute : attributes.entrySet()) {
      setAttribute(attribute.getKey(),attribute.getValue());
    }
  }
}
Program: 69433
Project: 69433
Buggy source:
public void setAttribute(String name,Object value){
  attributes.put(name,value);
}

Fixed version (ground truth):
public void setAttribute(String name,Object value){
  attributes.put(name,value);
  for (  IScriptContext context : scriptContexts.values()) {
    context.setAttribute(name,value);
  }
}
Program: 69434
Project: 69434
Buggy source:
public void removeAttribute(String name){
  attributes.remove(name);
}

Fixed version (ground truth):
public void removeAttribute(String name){
  attributes.remove(name);
  for (  IScriptContext context : scriptContexts.values()) {
    context.removeAttribute(name);
  }
}
Program: 69438
Project: 69438
Buggy source:
/** 
 * Sets default aggregation functions for model
 * @param cm model
 * @since 2.5.1
 */
public static void updateDefaultAggregations(Chart cm){
  SeriesGrouping sg=getBaseSeriesDefinitions(cm).get(0).getGrouping();
  if (sg.getGroupType().getValue() == DataType.DATE_TIME) {
    for (    SeriesDefinition vsd : getAllOrthogonalSeriesDefinitions(cm)) {
      Series vs=vsd.getDesignTimeSeries();
      if (vs instanceof StockSeries) {
        EList<Query> queries=vs.getDataDefinition();
        while (queries.size() < 4) {
          queries.add(QueryImpl.create("String_Node_Str"));
        }
        setSeriesAggregation(queries.get(0),"String_Node_Str");
        setSeriesAggregation(queries.get(1),"String_Node_Str");
        setSeriesAggregation(queries.get(2),"String_Node_Str");
        setSeriesAggregation(queries.get(3),"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets default aggregation functions for model
 * @param cm model
 * @since 2.5.1
 */
public static void updateDefaultAggregations(Chart cm){
  for (  SeriesDefinition vsd : getAllOrthogonalSeriesDefinitions(cm)) {
    Series vs=vsd.getDesignTimeSeries();
    if (vs instanceof StockSeries) {
      EList<Query> queries=vs.getDataDefinition();
      while (queries.size() < 4) {
        queries.add(QueryImpl.create("String_Node_Str"));
      }
      setSeriesAggregation(queries.get(0),"String_Node_Str");
      setSeriesAggregation(queries.get(1),"String_Node_Str");
      setSeriesAggregation(queries.get(2),"String_Node_Str");
      setSeriesAggregation(queries.get(3),"String_Node_Str");
    }
  }
}
Program: 69439
Project: 69439
Buggy source:
/** 
 * Evaluate data for all expressions, include base series, optional Y series grouping and value series.
 * @param idre
 * @param columns
 * @param areValueSeries
 * @return
 * @since 2.3
 */
public List<Object[]> evaluateRowSet(IDataRowExpressionEvaluator idre,final Object[] columns){
  List<Object[]> liResultSet=new ArrayList<Object[]>();
  final int iColumnCount=columns.length;
  Object[] oaTuple;
  final int MAX_ROW_COUNT=ChartUtil.getSupportedMaxRowCount(rtc);
  if (idre.first()) {
    int count=0;
    do {
      if (MAX_ROW_COUNT > 0 && count++ >= MAX_ROW_COUNT) {
        break;
      }
      oaTuple=new Object[iColumnCount];
      for (int i=0; i < columns.length; i++) {
        Object value=idre.evaluate((String)columns[i]);
        if (value instanceof Date) {
          value=new CDateTime((Date)value);
        }
 else         if (value instanceof Calendar) {
          value=new CDateTime((Calendar)value);
        }
        oaTuple[i]=value;
      }
      liResultSet.add(oaTuple);
    }
 while (idre.next());
  }
  return liResultSet;
}

Fixed version (ground truth):
/** 
 * Evaluate data for all expressions, include base series, optional Y series grouping and value series.
 * @param idre
 * @param columns
 * @param areValueSeries
 * @return the evaluated results.
 * @since 2.3
 */
public List<Object[]> evaluateRowSet(IDataRowExpressionEvaluator idre,final Object[] columns) throws ChartException {
  List<Object[]> liResultSet=new ArrayList<Object[]>();
  final int iColumnCount=columns.length;
  Object[] oaTuple;
  final int MAX_ROW_COUNT=ChartUtil.getSupportedMaxRowCount(rtc);
  if (idre.first()) {
    int count=0;
    do {
      if (MAX_ROW_COUNT > 0 && count++ >= MAX_ROW_COUNT) {
        break;
      }
      oaTuple=new Object[iColumnCount];
      for (int i=0; i < columns.length; i++) {
        Object value=idre.evaluate((String)columns[i]);
        if (value instanceof Date) {
          value=new CDateTime((Date)value);
        }
 else         if (value instanceof Calendar) {
          value=new CDateTime((Calendar)value);
        }
 else         if (value instanceof BirtException) {
          throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,(BirtException)value);
        }
        oaTuple[i]=value;
      }
      liResultSet.add(oaTuple);
    }
 while (idre.next());
  }
  return liResultSet;
}
Program: 69440
Project: 69440
Buggy source:
public void showSelectionPage(PropertyNode selectedNode){
  super.showSelectionPage(selectedNode);
  if (showPage) {
    if (historyBar != null) {
      historyBar.addHistoryNode(selectedNode);
    }
    if (!internalPages.contains(selectedNode.getId())) {
      getShell().pack();
    }
  }
}

Fixed version (ground truth):
public void showSelectionPage(PropertyNode selectedNode){
  super.showSelectionPage(selectedNode);
  if (showPage) {
    if (historyBar != null) {
      historyBar.addHistoryNode(selectedNode);
    }
    if (!PageLayoutManager.isRegisteredPage(selectedNode.getId())) {
      getShell().pack();
    }
  }
}
Program: 69441
Project: 69441
Buggy source:
/** 
 * Splits text for fixed layout reports.
 */
private void splitText(){
  Integer taskType=(Integer)engine.getOption(EngineTask.TASK_TYPE);
  if (taskType.intValue() == IEngineTask.TASK_RENDER && context.isFixedLayout()) {
    SizeBasedContent sizeBasedContent=context.getPageHintManager().getSizeBasedContentMapping().get(content.getInstanceID().toUniqueString());
    HtmlRegionArea container=new HtmlRegionArea();
    container.setWidth(sizeBasedContent.width);
    IContainerContent containerContent=content.getReportContent().createContainerContent();
    containerContent.getChildren().add(content);
    LayoutContext pdfLayoutContext=new LayoutContext();
    pdfLayoutContext.setFormat("String_Node_Str");
    pdfLayoutContext.setFixedLayout(true);
    pdfLayoutContext.setInHtmlRender(true);
    pdfLayoutContext.setLocale(engine.locale);
    pdfLayoutContext.setHtmlLayoutContext(context);
    pdfLayoutContext.setMaxBP(Integer.MAX_VALUE);
    RegionLayoutEngine rle=new RegionLayoutEngine(container,pdfLayoutContext);
    try {
      rle.layout(containerContent);
    }
 catch (    BirtException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Splits text for fixed layout reports.
 */
private void splitText(){
  Integer taskType=(Integer)engine.getOption(EngineTask.TASK_TYPE);
  if (taskType.intValue() == IEngineTask.TASK_RENDER && context.isFixedLayout()) {
    SizeBasedContent sizeBasedContent=context.getPageHintManager().getSizeBasedContentMapping().get(content.getInstanceID().toUniqueString());
    if (sizeBasedContent == null || sizeBasedContent.dimension == -1) {
      return;
    }
    HtmlRegionArea container=new HtmlRegionArea();
    container.setWidth(sizeBasedContent.width);
    IContainerContent containerContent=content.getReportContent().createContainerContent();
    containerContent.getChildren().add(content);
    LayoutContext pdfLayoutContext=new LayoutContext();
    pdfLayoutContext.setFormat("String_Node_Str");
    pdfLayoutContext.setFixedLayout(true);
    pdfLayoutContext.setInHtmlRender(true);
    pdfLayoutContext.setLocale(engine.locale);
    pdfLayoutContext.setHtmlLayoutContext(context);
    pdfLayoutContext.setMaxBP(Integer.MAX_VALUE);
    RegionLayoutEngine rle=new RegionLayoutEngine(container,pdfLayoutContext);
    try {
      rle.layout(containerContent);
    }
 catch (    BirtException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}
Program: 69444
Project: 69444
Buggy source:
/** 
 * @param binding
 * @param modelCmptdColumn
 * @throws AdapterException
 */
private void populateArgument(IBinding binding,ComputedColumnHandle modelCmptdColumn) throws AdapterException {
  Iterator it=modelCmptdColumn.argumentsIterator();
  while (it != null && it.hasNext()) {
    AggregationArgumentHandle arg=(AggregationArgumentHandle)it.next();
    try {
      binding.addArgument(this.adaptExpression((Expression)arg.getExpressionProperty(AggregationArgument.VALUE_MEMBER).getValue()));
    }
 catch (    DataException e) {
      throw new AdapterException(e.getLocalizedMessage(),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param binding
 * @param modelCmptdColumn
 * @throws AdapterException
 */
private void populateArgument(IBinding binding,ComputedColumnHandle modelCmptdColumn) throws AdapterException {
  Iterator it=modelCmptdColumn.argumentsIterator();
  while (it != null && it.hasNext()) {
    AggregationArgumentHandle arg=(AggregationArgumentHandle)it.next();
    try {
      Expression expr=(Expression)arg.getExpressionProperty(AggregationArgument.VALUE_MEMBER).getValue();
      if (expr != null)       binding.addArgument(this.adaptExpression(expr));
    }
 catch (    DataException e) {
      throw new AdapterException(e.getLocalizedMessage(),e);
    }
  }
}
Program: 69445
Project: 69445
Buggy source:
private void defineName(String name,String refer){
  writer.openTag("String_Node_Str");
  writer.attribute("String_Node_Str",name);
  writer.attribute("String_Node_Str",refer);
  writer.closeTag("String_Node_Str");
}

Fixed version (ground truth):
public String defineName(String cells){
  return null;
}
Program: 69447
Project: 69447
Buggy source:
/** 
 * This method is called when the plug-in is stopped
 */
public void stop(BundleContext context) throws Exception {
  super.stop(context);
  Platform.setPlatform(null);
  Platform.setContextClassLoader(null);
  FunctionProvider.setFunctionProvider(null);
}

Fixed version (ground truth):
/** 
 * This method is called when the plug-in is stopped
 */
public void stop(BundleContext context) throws Exception {
  super.stop(context);
  Platform.setPlatform(null);
  Platform.setContextClassLoader(null);
  FunctionProvider.setFunctionProvider(null);
  ScriptEngineFactoryManager.setInstance(null);
}
Program: 69448
Project: 69448
Buggy source:
/** 
 * This method is called upon plug-in activation.
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  Platform.setPlatform(new EclipsePlatform(context));
  ClassLoader contextClassLoader=(ClassLoader)AccessController.doPrivileged(new PrivilegedAction<Object>(){
    public Object run(){
      return Thread.currentThread().getContextClassLoader();
    }
  }
);
  Platform.setContextClassLoader(contextClassLoader);
  FunctionProvider.setFunctionProvider(new FunctionProviderImpl());
}

Fixed version (ground truth):
/** 
 * This method is called upon plug-in activation.
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  Platform.setPlatform(new EclipsePlatform(context));
  ClassLoader contextClassLoader=(ClassLoader)AccessController.doPrivileged(new PrivilegedAction<Object>(){
    public Object run(){
      return Thread.currentThread().getContextClassLoader();
    }
  }
);
  Platform.setContextClassLoader(contextClassLoader);
  FunctionProvider.setFunctionProvider(new FunctionProviderImpl());
  ScriptEngineFactoryManager.setInstance(new ScriptEngineFactoryManagerImpl());
}
Program: 69449
Project: 69449
Buggy source:
private ScriptContext(ScriptContext scriptContext,Object scope,Map<String,Object> attributes){
  if (scriptContext == null) {
    engines=new HashMap<String,IScriptEngine>();
  }
 else {
    engines=scriptContext.engines;
  }
  this.attributes=new HashMap<String,Object>();
  if (attributes != null) {
    this.attributes.putAll(attributes);
  }
  parent=scriptContext;
  scriptContexts=new HashMap<String,IScriptContext>();
  this.scope=scope;
  this.engineFactoryManager=new ScriptEngineFactoryManager();
}

Fixed version (ground truth):
private ScriptContext(ScriptContext scriptContext,Object scope,Map<String,Object> attributes){
  if (scriptContext == null) {
    engines=new HashMap<String,IScriptEngine>();
  }
 else {
    engines=scriptContext.engines;
  }
  this.attributes=new HashMap<String,Object>();
  if (attributes != null) {
    this.attributes.putAll(attributes);
  }
  parent=scriptContext;
  scriptContexts=new HashMap<String,IScriptContext>();
  this.scope=scope;
}
Program: 69450
Project: 69450
Buggy source:
public IScriptEngine getScriptEngine(String scriptName) throws BirtException {
  if (scriptName == null) {
    throw new NullPointerException();
  }
  if (engines.containsKey(scriptName)) {
    return engines.get(scriptName);
  }
  IScriptEngineFactory factory=engineFactoryManager.getScriptEngineFactory(scriptName);
  if (factory == null) {
    throw new BirtException("String_Node_Str" + scriptName);
  }
  return createEngine(factory);
}

Fixed version (ground truth):
public IScriptEngine getScriptEngine(String scriptName) throws BirtException {
  if (scriptName == null) {
    throw new NullPointerException();
  }
  if (engines.containsKey(scriptName)) {
    return engines.get(scriptName);
  }
  IScriptEngineFactory factory=ScriptEngineFactoryManager.getInstance().getScriptEngineFactory(scriptName);
  if (factory == null) {
    throw new BirtException("String_Node_Str" + scriptName);
  }
  return createEngine(factory);
}
Program: 69451
Project: 69451
Buggy source:
public IScriptEngineFactory getScriptEngineFactory(String scriptLanguage){
  if (factories.containsKey(scriptLanguage)) {
    return factories.get(scriptLanguage);
  }
  if (configs.containsKey(scriptLanguage)) {
    IConfigurationElement configuration=configs.get(scriptLanguage);
    try {
      Object object=configuration.createExecutableExtension("String_Node_Str");
      if (object instanceof IScriptEngineFactory) {
        IScriptEngineFactory factory=(IScriptEngineFactory)object;
        factories.put(scriptLanguage,factory);
        return factory;
      }
    }
 catch (    FrameworkException e) {
      logger.log(Level.SEVERE,e.getLocalizedMessage(),e);
    }
  }
  return null;
}

Fixed version (ground truth):
synchronized public IScriptEngineFactory getScriptEngineFactory(String language){
  if (factories.containsKey(language)) {
    return factories.get(language);
  }
  IScriptEngineFactory factory=createFactory(language);
  factories.put(language,factory);
  return factory;
}
Program: 69452
Project: 69452
Buggy source:
public ScriptEngineFactoryManager(){
  factories=new HashMap<String,IScriptEngineFactory>();
}

Fixed version (ground truth):
protected ScriptEngineFactoryManager(){
  factories=new HashMap<String,IScriptEngineFactory>();
}