nus-yam/ex-repair huggingface dataset:
Program: 65558
Project: 65558
Buggy source:
public ModuleHandle getReportModuleHandle(Object element,boolean reset){
  if (model == null || reset) {
    IEditorInput input=(IEditorInput)element;
    IPath path=getInputPath(input);
    if (path != null) {
      String fileName=path.toOSString();
      try {
        Map properties=new HashMap();
        String designerVersion=MessageFormat.format(VERSION_MESSAGE,new String[]{ReportPlugin.getVersion(),ReportPlugin.getBuildInfo()});
        properties.put(IModuleModel.CREATED_BY_PROP,designerVersion);
        properties.put(IModuleOption.CREATED_BY_KEY,designerVersion);
        String projectFolder=getProjectFolder(input);
        if (projectFolder != null) {
          properties.put(IModuleOption.RESOURCE_FOLDER_KEY,projectFolder);
        }
        model=SessionHandleAdapter.getInstance().init(fileName,new FileInputStream(path.toFile()),properties);
      }
 catch (      DesignFileException e) {
        ExceptionHandler.handle(e,true);
      }
catch (      IOException e) {
        ExceptionHandler.handle(e,true);
      }
    }
  }
  return model;
}

Fixed version (ground truth):
public ModuleHandle getReportModuleHandle(Object element,boolean reset){
  if (model == null || reset) {
    IEditorInput input=(IEditorInput)element;
    IPath path=getInputPath(input);
    if (path != null) {
      String fileName=path.toOSString();
      try {
        Map properties=new HashMap();
        String designerVersion=MessageFormat.format(VERSION_MESSAGE,new String[]{ReportPlugin.getVersion(),ReportPlugin.getBuildInfo()});
        properties.put(IModuleModel.CREATED_BY_PROP,designerVersion);
        properties.put(IModuleOption.CREATED_BY_KEY,designerVersion);
        if (fileName.endsWith("String_Node_Str" + IReportElementConstants.TEMPLATE_FILE_EXTENSION)) {
          properties.put(IModuleOption.PARSER_SEMANTIC_CHECK_KEY,false);
        }
        String projectFolder=getProjectFolder(input);
        if (projectFolder != null) {
          properties.put(IModuleOption.RESOURCE_FOLDER_KEY,projectFolder);
        }
        model=SessionHandleAdapter.getInstance().init(fileName,new FileInputStream(path.toFile()),properties);
      }
 catch (      DesignFileException e) {
        ExceptionHandler.handle(e,true);
      }
catch (      IOException e) {
        ExceptionHandler.handle(e,true);
      }
    }
  }
  return model;
}
Program: 65562
Project: 65562
Buggy source:
protected void checkOkButtonStatus(){
  if (nameText.getText() == null || nameText.getText().trim().equals("String_Node_Str") || functionCombo.getSelectionIndex() == -1 || typeCombo.getSelectionIndex() == -1) {
    if (getButton(IDialogConstants.OK_ID) != null) {
      getButton(IDialogConstants.OK_ID).setEnabled(false);
      setMessage(null);
      setErrorMessage(Messages.getString("String_Node_Str"));
      return;
    }
  }
 else   if (!UIUtil.validateDimensionName(nameText.getText())) {
    if (getButton(IDialogConstants.OK_ID) != null) {
      getButton(IDialogConstants.OK_ID).setEnabled(false);
      setMessage(null);
      setErrorMessage(Messages.getString("String_Node_Str"));
      return;
    }
  }
  IAggrFunction function=getFunctionByDisplayName(functionCombo.getText());
  if (function != null && function.getParameterDefn().length > 0) {
    IParameterDefn param=function.getParameterDefn()[0];
    if (!param.isOptional()) {
      if (expressionText.getText() == null || expressionText.getText().trim().length() == 0) {
        if (getButton(IDialogConstants.OK_ID) != null) {
          getButton(IDialogConstants.OK_ID).setEnabled(false);
          setErrorMessage(null);
          setMessage(null);
          return;
        }
      }
    }
  }
  if (getButton(IDialogConstants.OK_ID) != null) {
    getButton(IDialogConstants.OK_ID).setEnabled(true);
    setErrorMessage(null);
    setMessage(null);
  }
}

Fixed version (ground truth):
protected void checkOkButtonStatus(){
  if (nameText.getText() == null || nameText.getText().trim().equals("String_Node_Str") || functionCombo.getSelectionIndex() == -1 || typeCombo.getSelectionIndex() == -1) {
    if (getButton(IDialogConstants.OK_ID) != null) {
      getButton(IDialogConstants.OK_ID).setEnabled(false);
      setMessage(null);
      setErrorMessage(Messages.getString("String_Node_Str"));
      return;
    }
  }
 else   if (!UIUtil.validateDimensionName(nameText.getText())) {
    if (getButton(IDialogConstants.OK_ID) != null) {
      getButton(IDialogConstants.OK_ID).setEnabled(false);
      setMessage(null);
      setErrorMessage(Messages.getString("String_Node_Str"));
      return;
    }
  }
  IAggrFunction function=getFunctionByDisplayName(functionCombo.getText());
  if (function != null && function.getParameterDefn().length > 0) {
    IParameterDefn param=function.getParameterDefn()[0];
    if (!param.isOptional()) {
      if (expressionText.getText() == null || expressionText.getText().trim().length() == 0) {
        if (getButton(IDialogConstants.OK_ID) != null) {
          getButton(IDialogConstants.OK_ID).setEnabled(false);
          setMessage(null);
          setErrorMessage(Messages.getString("String_Node_Str"));
          return;
        }
      }
    }
  }
  if (getButton(IDialogConstants.OK_ID) != null) {
    getButton(IDialogConstants.OK_ID).setEnabled(true);
    setErrorMessage(null);
    setMessage(Messages.getString("String_Node_Str"));
  }
}
Program: 65565
Project: 65565
Buggy source:
public void setCustomFieldValue(int fieldIndex,Object value) throws DataException {
  if (resultClass.isCustomField(fieldIndex))   fields[fieldIndex - 1]=value;
 else   throw new DataException(ResourceConstants.INVALID_CUSTOM_FIELD_INDEX,Integer.valueOf(fieldIndex));
}

Fixed version (ground truth):
public void setCustomFieldValue(int fieldIndex,Object value) throws DataException {
  if (resultClass.isCustomField(fieldIndex))   fields[fieldIndex - 1]=value;
 else   throw new DataException(ResourceConstants.INVALID_CUSTOM_FIELD_INDEX,Integer.valueOf(fieldIndex));
  if (resultClass.getFieldValueClass(fieldIndex).getName().equals(AnyType.class.getName())) {
    if (value != null) {
      ((ResultClass)resultClass).getFieldMetaData(fieldIndex).setDataType(value.getClass());
    }
  }
}
Program: 65567
Project: 65567
Buggy source:
/** 
 * @return
 * @throws SemanticException
 */
private DataSetHandle createDataSetODAV2() throws SemanticException {
  String dataSetTypeName=null;
  if (getSelectedDataSet() instanceof Object[]) {
    DataSetType dataSetElement=(DataSetType)((Object[])getSelectedDataSet())[0];
    dataSetTypeName=dataSetElement.getID();
  }
 else   if (getSelectedDataSet() instanceof DataSetTypeElement) {
    dataSetTypeName=((DataSetTypeElement)getSelectedDataSet()).getDataSetTypeName();
  }
  return createDataSet(dataSetTypeName);
}

Fixed version (ground truth):
/** 
 * @return
 * @throws SemanticException
 */
private DataSetHandle createDataSetODAV2() throws SemanticException {
  String dataSetTypeName=null;
  if (getSelectedDataSet() instanceof Object[]) {
    DataSetType dataSetElement=(DataSetType)((Object[])getSelectedDataSet())[0];
    dataSetTypeName=dataSetElement.getID();
  }
 else   if (getSelectedDataSet() instanceof OdaDataSetTypeElement) {
    dataSetTypeName=((OdaDataSetTypeElement)getSelectedDataSet()).getDataSetType().getID();
  }
 else   if (getSelectedDataSet() instanceof DataSetTypeElement) {
    dataSetTypeName=((DataSetTypeElement)getSelectedDataSet()).getDataSetTypeName();
  }
  return createDataSet(dataSetTypeName);
}
Program: 65569
Project: 65569
Buggy source:
/** 
 * whether to save empty parameter
 * @param parameters
 * @return
 */
private boolean doSaveEmptyParameter(PropertyHandle parameters){
  if (isJointOrDerivedDataSetHandle) {
    return true;
  }
  if (parameters == null) {
    parameters=((DataSetHandle)getContainer().getModel()).getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
  }
  if (parameters != null) {
    Iterator iter=parameters.iterator();
    String paramName=null;
    if (iter != null) {
      while (iter.hasNext()) {
        DataSetParameterHandle parameter=(DataSetParameterHandle)iter.next();
        if (isOdaDataSetHandle)         paramName=((OdaDataSetParameterHandle)parameter).getParamName();
        if (parameter.isInput() && paramName == null && (parameter.getDefaultValue() == null || parameter.getDefaultValue().trim().length() == 0)) {
          setNoneValuedParameterName(parameter.getName());
          return false;
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * whether to save empty parameter
 * @param parameters
 * @return
 */
private boolean doSaveEmptyParameter(PropertyHandle parameters){
  if (isJointOrDerivedDataSetHandle) {
    return true;
  }
  if (parameters == null) {
    parameters=((DataSetHandle)getContainer().getModel()).getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
  }
  if (parameters != null) {
    Iterator iter=parameters.iterator();
    String paramName=null;
    if (iter != null) {
      while (iter.hasNext()) {
        DataSetParameterHandle parameter=(DataSetParameterHandle)iter.next();
        if (isOdaDataSetHandle)         paramName=((OdaDataSetParameterHandle)parameter).getParamName();
        if (parameter.isInput() && paramName == null && (!parameter.isOutput()) && (parameter.getDefaultValue() == null || parameter.getDefaultValue().trim().length() == 0)) {
          setNoneValuedParameterName(parameter.getName());
          return false;
        }
      }
    }
  }
  return true;
}
Program: 65570
Project: 65570
Buggy source:
/** 
 * @return
 * @throws SemanticException
 */
private boolean modifyJointCondition() throws SemanticException {
  JointDataSetHandle handle=null;
  if (leftDataSetName == null || rightDataSetName == null)   return false;
  if (propertyPageContainer instanceof DataSetEditor) {
    boolean selectionChanged=true;
    handle=(JointDataSetHandle)((DataSetEditor)propertyPageContainer).getModel();
    Iterator iter=handle.getPropertyHandle(JointDataSet.JOIN_CONDITONS_PROP).iterator();
    JoinConditionHandle conditionHandle;
    while (iter.hasNext()) {
      conditionHandle=(JoinConditionHandle)iter.next();
      if ((conditionHandle.getLeftDataSet() != null && conditionHandle.getLeftDataSet().equals(this.leftDataSetName)) && (conditionHandle.getLeftDataSet() != null && conditionHandle.getRightDataSet().equals(this.rightDataSetName))) {
        selectionChanged=false;
        conditionHandle.setJoinType(joinType);
      }
    }
    if (selectionChanged) {
      List datasetName=handle.getDataSetNames();
      for (int i=0; i < datasetName.size(); i++) {
        try {
          handle.removeDataSet((String)datasetName.get(i));
        }
 catch (        SemanticException e) {
        }
      }
      if (leftDataSetName.equals(rightDataSetName))       handle.addDataSet(leftDataSetName);
 else {
        handle.addDataSet(leftDataSetName);
        handle.addDataSet(rightDataSetName);
      }
      setParameters(handle);
      addColumnHints(handle);
      if (propertyHandle != null) {
        JoinCondition condition=createJoinCondition();
        propertyHandle.removeItem(0);
        propertyHandle.addItem(condition);
        return true;
      }
 else       return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws SemanticException
 */
private boolean modifyJointCondition() throws SemanticException {
  JointDataSetHandle handle=null;
  if (leftDataSetName == null || rightDataSetName == null)   return false;
  if (propertyPageContainer instanceof DataSetEditor) {
    handle=(JointDataSetHandle)((DataSetEditor)propertyPageContainer).getModel();
    if (selectionChanged) {
      selectionChanged=false;
      List datasetName=handle.getDataSetNames();
      for (int i=0; i < datasetName.size(); i++) {
        try {
          handle.removeDataSet((String)datasetName.get(i));
        }
 catch (        SemanticException e) {
        }
      }
      if (leftDataSetName.equals(rightDataSetName))       handle.addDataSet(leftDataSetName);
 else {
        handle.addDataSet(leftDataSetName);
        handle.addDataSet(rightDataSetName);
      }
      setParameters(handle);
      addColumnHints(handle);
      if (propertyHandle != null) {
        JoinCondition condition=createJoinCondition();
        propertyHandle.removeItem(0);
        propertyHandle.addItem(condition);
        return true;
      }
 else       return false;
    }
  }
  return true;
}
Program: 65571
Project: 65571
Buggy source:
public void pageActivated(){
  if (this.propertyPageContainer != null) {
    setPageMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
    JointDataSetHandle handle=(JointDataSetHandle)this.propertyPageContainer.getModel();
    if (!nameEditor.isDisposed())     this.nameEditor.dispose();
    if (!nameLabel.isDisposed())     this.nameLabel.dispose();
    if (this.dataSetList != null) {
      for (int i=0; i < dataSetList.size(); i++) {
        if (dataSetList.get(i) instanceof JointDataSetHandle && ((JointDataSetHandle)dataSetList.get(i)).getDataSetNames().equals(handle.getDataSetNames())) {
          this.dataSetList.remove(i);
        }
      }
    }
    this.leftDataSetChooser.setInput(this.dataSetList);
    this.rightDataSetChooser.setInput(this.dataSetList);
    propertyHandle=handle.getPropertyHandle(JointDataSet.JOIN_CONDITONS_PROP);
    Iterator conditionIter=handle.joinConditionsIterator();
    JoinConditionHandle condition;
    while (conditionIter.hasNext()) {
      condition=(JoinConditionHandle)conditionIter.next();
      populateDataSet(condition.getLeftDataSet(),condition.getLeftExpression(),LEFT_DATASET);
      populateDataSet(condition.getRightDataSet(),condition.getRightExpression(),RIGHT_DATASET);
      populateJoinType(condition.getJoinType());
    }
  }
}

Fixed version (ground truth):
public void pageActivated(){
  if (this.propertyPageContainer != null) {
    setPageMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
    JointDataSetHandle handle=(JointDataSetHandle)this.propertyPageContainer.getModel();
    if (!nameEditor.isDisposed())     this.nameEditor.dispose();
    if (!nameLabel.isDisposed())     this.nameLabel.dispose();
    if (this.dataSetList != null) {
      for (int i=0; i < dataSetList.size(); i++) {
        if (dataSetList.get(i) instanceof JointDataSetHandle && ((JointDataSetHandle)dataSetList.get(i)).getDataSetNames().equals(handle.getDataSetNames())) {
          this.dataSetList.remove(i);
        }
      }
    }
    this.leftDataSetChooser.setInput(this.dataSetList);
    this.rightDataSetChooser.setInput(this.dataSetList);
    propertyHandle=handle.getPropertyHandle(JointDataSet.JOIN_CONDITONS_PROP);
    Iterator conditionIter=handle.joinConditionsIterator();
    JoinConditionHandle condition;
    while (conditionIter.hasNext()) {
      condition=(JoinConditionHandle)conditionIter.next();
      populateDataSet(condition.getLeftDataSet(),condition.getLeftExpression(),LEFT_DATASET);
      populateDataSet(condition.getRightDataSet(),condition.getRightExpression(),RIGHT_DATASET);
      populateJoinType(condition.getJoinType());
    }
  }
  selectionChanged=false;
}
Program: 65572
Project: 65572
Buggy source:
public Control createPageControl(Composite parent){
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.numColumns=1;
  composite.setLayout(layout);
  dataSetList=getDataSets();
  if (getPageDescription() != null) {
    Label pageDescription=new Label(composite,SWT.NONE);
    pageDescription.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    pageDescription.setText(getPageDescription());
    pageDescription.setToolTipText(getPageDescription());
  }
  topComposite=new Composite(composite,SWT.NONE);
  createTopComposite(topComposite);
  bottomComposite=new Composite(composite,SWT.NONE);
  createBottomComposite(bottomComposite);
  joinType=DesignChoiceConstants.JOIN_TYPE_INNER;
  Utility.setSystemHelp(composite,IHelpConstants.CONEXT_ID_JOINTDATASET);
  return composite;
}

Fixed version (ground truth):
public Control createPageControl(Composite parent){
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.numColumns=1;
  composite.setLayout(layout);
  dataSetList=getDataSets();
  if (getPageDescription() != null) {
    Label pageDescription=new Label(composite,SWT.NONE);
    pageDescription.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    pageDescription.setText(getPageDescription());
    pageDescription.setToolTipText(getPageDescription());
  }
  topComposite=new Composite(composite,SWT.NONE);
  createTopComposite(topComposite);
  bottomComposite=new Composite(composite,SWT.NONE);
  createBottomComposite(bottomComposite);
  joinType=DesignChoiceConstants.JOIN_TYPE_INNER;
  selectionChanged=false;
  Utility.setSystemHelp(composite,IHelpConstants.CONEXT_ID_JOINTDATASET);
  return composite;
}
Program: 65573
Project: 65573
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (e.getSource() instanceof Button) {
    if (((Button)e.getSource()).equals(innerJoinButton))     joinType=DesignChoiceConstants.JOIN_TYPE_INNER;
 else     if (((Button)e.getSource()).equals(leftOuterJoinButton))     joinType=DesignChoiceConstants.JOIN_TYPE_LEFT_OUT;
 else     if (((Button)e.getSource()).equals(rightOuterJoinButton))     joinType=DesignChoiceConstants.JOIN_TYPE_RIGHT_OUT;
 else     if (((Button)e.getSource()).equals(fullOuterJoinButton))     joinType=DesignChoiceConstants.JOIN_TYPE_FULL_OUT;
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  selectionChanged=true;
  if (e.getSource() instanceof Button) {
    if (((Button)e.getSource()).equals(innerJoinButton))     joinType=DesignChoiceConstants.JOIN_TYPE_INNER;
 else     if (((Button)e.getSource()).equals(leftOuterJoinButton))     joinType=DesignChoiceConstants.JOIN_TYPE_LEFT_OUT;
 else     if (((Button)e.getSource()).equals(rightOuterJoinButton))     joinType=DesignChoiceConstants.JOIN_TYPE_RIGHT_OUT;
 else     if (((Button)e.getSource()).equals(fullOuterJoinButton))     joinType=DesignChoiceConstants.JOIN_TYPE_FULL_OUT;
  }
}
Program: 65575
Project: 65575
Buggy source:
public void pageActivated(){
  getContainer().setMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
  if (modelChanged || ((DataSetEditor)this.getContainer()).modelChanged()) {
    modelChanged=false;
    new UIJob("String_Node_Str"){
      public IStatus runInUIThread(      IProgressMonitor monitor){
        updateResultsProcess();
        return Status.OK_STATUS;
      }
    }
.schedule();
  }
}

Fixed version (ground truth):
public void pageActivated(){
  getContainer().setMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
  if (modelChanged) {
    modelChanged=false;
    new UIJob("String_Node_Str"){
      public IStatus runInUIThread(      IProgressMonitor monitor){
        updateResultsProcess();
        return Status.OK_STATUS;
      }
    }
.schedule();
  }
}
Program: 65576
Project: 65576
Buggy source:
public boolean performFinish(){
  return page.createSelectedDataSource();
}

Fixed version (ground truth):
public boolean performFinish(){
  return page.performFinish();
}
Program: 65577
Project: 65577
Buggy source:
public final void testGetMaxQueries() throws DataException {
  assertEquals(m_connection.getMaxQueries(),0);
}

Fixed version (ground truth):
public final void testGetMaxQueries() throws DataException {
  assertEquals(1,m_connection.getMaxQueries());
}
Program: 65580
Project: 65580
Buggy source:
public void close() throws DataException {
  filterByRow.setWorkingFilterSet(FilterByRow.NO_FILTER);
  filterByRow=null;
  rowFilter.close();
  rowFilter=null;
}

Fixed version (ground truth):
public void close() throws DataException {
  filterByRow.setWorkingFilterSet(FilterByRow.NO_FILTER);
  filterByRow.close();
  filterByRow=null;
  rowFilter.close();
  rowFilter=null;
}
Program: 65581
Project: 65581
Buggy source:
public JavascriptEngine(JavascriptEngineFactory factory,ScriptableObject root) throws BirtException {
  this.factory=factory;
  try {
    this.context=Context.enter();
    this.global=new ImporterTopLevel();
    this.root=root;
    if (root != null) {
      new LazilyLoadedCtor(global,"String_Node_Str","String_Node_Str",false);
      global.exportAsJSClass(3,global,false);
      global.delete("String_Node_Str");
      global.setPrototype(root);
    }
 else {
      global.initStandardObjects(context,true);
    }
    if (global.get(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.FUNCITON_BEAN_NAME,global) == org.mozilla.javascript.UniqueTag.NOT_FOUND) {
      IScriptFunctionContext functionContext=new IScriptFunctionContext(){
        public Object findProperty(        String name){
          return propertyMap.get(name);
        }
      }
;
      Object sObj=Context.javaToJS(functionContext,global);
      global.put(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.FUNCITON_BEAN_NAME,global,sObj);
    }
    initWrapFactory();
  }
 catch (  Exception ex) {
    Context.exit();
    throw new BirtException();
  }
}

Fixed version (ground truth):
public JavascriptEngine(JavascriptEngineFactory factory,ScriptableObject root) throws BirtException {
  this.factory=factory;
  try {
    this.context=Context.enter();
    this.global=new ImporterTopLevel();
    this.root=root;
    if (root != null) {
      new LazilyLoadedCtor(global,"String_Node_Str","String_Node_Str",false);
      global.exportAsJSClass(3,global,false);
      global.delete("String_Node_Str");
      global.setPrototype(root);
    }
 else {
      global.initStandardObjects(context,true);
    }
    if (global.get(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.FUNCTION_BEAN_NAME,global) == org.mozilla.javascript.UniqueTag.NOT_FOUND) {
      IScriptFunctionContext functionContext=new IScriptFunctionContext(){
        public Object findProperty(        String name){
          return propertyMap.get(name);
        }
      }
;
      Object sObj=Context.javaToJS(functionContext,global);
      global.put(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.FUNCTION_BEAN_NAME,global,sObj);
    }
    initWrapFactory();
  }
 catch (  Exception ex) {
    Context.exit();
    throw new BirtException();
  }
}
Program: 65582
Project: 65582
Buggy source:
private void writeManifest() throws IOException {
  zipStream.putNextEntry(new ZipEntry(MANIFEST_URI));
  ManifestWriter writer=new ManifestWriter(zipStream);
  writer.start(rootMime);
  for (  PackageEntry entry : entries.values()) {
    writer.writeEntry(entry);
  }
  writer.end();
  zipStream.closeEntry();
}

Fixed version (ground truth):
private void writeManifest() throws IOException {
  zipStream.putNextEntry(new ZipEntry(MANIFEST_URI));
  zipStream.write(GetByteArrayFromManifestWriter());
  zipStream.closeEntry();
}
Program: 65583
Project: 65583
Buggy source:
public void testFontMappingHandler() throws IOException, FactoryConfigurationError, ParserConfigurationException, SAXException {
  fontMappingManager=getFontMappingManager("String_Node_Str",Locale.CHINA);
  assertEquals("String_Node_Str",fontMappingManager.getAliasedFont("String_Node_Str"));
  assertEquals(16,fontMappingManager.getFontEncodings().size());
  assertEquals(2,fontMappingManager.getSearchSequences().size());
  CompositeFont cf=fontMappingManager.getCompositeFont(FontMappingManager.FONT_NAME_ALL_FONTS);
  assertTrue(cf != null);
  assertEquals("String_Node_Str",cf.getUsedFont('a'));
  assertEquals("String_Node_Str",cf.getUsedFont('\u624b'));
  assertEquals("String_Node_Str",cf.getUsedFont('b'));
  fontMappingManager=getFontMappingManager("String_Node_Str",Locale.JAPANESE);
  assertEquals("String_Node_Str",fontMappingManager.getAliasedFont("String_Node_Str"));
  assertEquals(16,fontMappingManager.getFontEncodings().size());
  cf=fontMappingManager.getCompositeFont(FontMappingManager.FONT_NAME_ALL_FONTS);
  assertTrue(cf != null);
  assertEquals("String_Node_Str",cf.getUsedFont('a'));
  assertEquals("String_Node_Str",cf.getUsedFont('手'));
  assertEquals("String_Node_Str",cf.getUsedFont('b'));
}

Fixed version (ground truth):
public void testFontMappingHandler() throws IOException, FactoryConfigurationError, ParserConfigurationException, SAXException {
  fontMappingManager=getFontMappingManager("String_Node_Str",Locale.CHINA);
  assertEquals("String_Node_Str",fontMappingManager.getAliasedFont("String_Node_Str"));
  assertEquals(16,fontMappingManager.getFontEncodings().size());
  assertEquals(2,fontMappingManager.getSearchSequences().size());
  CompositeFont cf=fontMappingManager.getCompositeFont(FontMappingManager.FONT_NAME_ALL_FONTS);
  assertTrue(cf != null);
  assertEquals("String_Node_Str",cf.getUsedFont('a'));
  assertEquals("String_Node_Str",cf.getUsedFont('\u624b'));
  assertEquals("String_Node_Str",cf.getUsedFont('b'));
  fontMappingManager=getFontMappingManager("String_Node_Str",Locale.JAPANESE);
  assertEquals("String_Node_Str",fontMappingManager.getAliasedFont("String_Node_Str"));
  assertEquals(16,fontMappingManager.getFontEncodings().size());
  cf=fontMappingManager.getCompositeFont(FontMappingManager.FONT_NAME_ALL_FONTS);
  assertTrue(cf != null);
  assertEquals("String_Node_Str",cf.getUsedFont('a'));
  assertEquals("String_Node_Str",cf.getUsedFont('\u624b'));
  assertEquals("String_Node_Str",cf.getUsedFont('b'));
}
Program: 65584
Project: 65584
Buggy source:
/** 
 * returns the parameter data type. See the ColumnDefn class for the valid data type constants.
 * @return the parameter data type
 */
int getDataType();

Fixed version (ground truth):
/** 
 * returns the parameter data type. The valid data type could be <code>IParameterDefn.TYPE_ANY</code>, <code>IParameterDefn.TYPE_STRING</code>, <code>IParameterDefn.TYPE_FLOAT</code>, <code>IParameterDefn.TYPE_DECIMAL</code>, <code>IParameterDefn.TYPE_DATE_TIME</code>, <code>IParameterDefn.TYPE_BOOLEAN</code>, <code>IParameterDefn.TYPE_INTEGER</code>, <code>IParameterDefn.TYPE_DATE</code>, <code>IParameterDefn.TYPE_TIME</code>.
 * @return the parameter data type
 */
int getDataType();
Program: 65586
Project: 65586
Buggy source:
static boolean isDirectColumnRef(String expression,String indicator) throws BirtException {
  ExpressionParserUtility util=new ExpressionParserUtility();
  util.isDirectColumnRef=false;
  compileColumnExpression(util,expression,indicator);
  return util.isDirectColumnRef;
}

Fixed version (ground truth):
public boolean isDirectColumnRef(){
  return this.isDirectColumnRef;
}
Program: 65587
Project: 65587
Buggy source:
/** 
 * @return
 * @throws BirtException 
 */
static boolean hasAggregation(String expression,String indicator) throws BirtException {
  ExpressionParserUtility util=new ExpressionParserUtility();
  util.hasAggregation=false;
  compileColumnExpression(util,expression,indicator);
  return util.hasAggregation;
}

Fixed version (ground truth):
public boolean hasAggregation(){
  return this.hasAggregation;
}
Program: 65588
Project: 65588
Buggy source:
/** 
 * @param propValue
 * @return
 */
private static long populateMemBufferSize(Object propValue){
  String targetBufferSize=propValue == null ? "String_Node_Str" : propValue.toString();
  long memoryCacheSize=0;
  if (targetBufferSize != null)   memoryCacheSize=Long.parseLong(targetBufferSize);
  return memoryCacheSize;
}

Fixed version (ground truth):
/** 
 * @param propValue
 * @return
 */
private static long populateMemBufferSize(Object propValue){
  String targetBufferSize=propValue == null ? "String_Node_Str" : propValue.toString();
  long memoryCacheSize=0;
  if (targetBufferSize != null)   memoryCacheSize=Long.parseLong(targetBufferSize);
  return memoryCacheSize > MAGIC_NUMBER ? (memoryCacheSize - MAGIC_NUMBER) : memoryCacheSize;
}
Program: 65589
Project: 65589
Buggy source:
/** 
 * This method is responsible for computing the aggregation result according to the specified aggregation definitions.
 * @param aggregations
 * @param stopSign
 * @return
 * @throws DataException
 * @throws IOException
 * @throws BirtException
 */
private IAggregationResultSet[] onePassExecute(AggregationDefinition[] aggregations,StopSign stopSign) throws DataException, IOException, BirtException {
  IDiskArray[] dimPosition=getFilterResult();
  FactTableRowIterator factTableRowIterator=populateFactTableIterator(stopSign,dimPosition);
  DimensionResultIterator[] dimensionResultIterators=populateDimensionResultIterator(dimPosition,stopSign);
  IDataSet4Aggregation dataSet4Aggregation=new DataSetFromOriginalCube(factTableRowIterator,dimensionResultIterators,computedMeasureHelper);
  AggregationExecutor aggregationCalculatorExecutor=new AggregationExecutor(new CubeDimensionReader(cube),dataSet4Aggregation,aggregations,memoryCacheSize);
  aggregationCalculatorExecutor.setMaxDataObjectRows(maxDataObjectRows);
  return aggregationCalculatorExecutor.execute(stopSign);
}

Fixed version (ground truth):
/** 
 * This method is responsible for computing the aggregation result according to the specified aggregation definitions.
 * @param aggregations
 * @param stopSign
 * @return
 * @throws DataException
 * @throws IOException
 * @throws BirtException
 */
private IAggregationResultSet[] onePassExecute(AggregationDefinition[] aggregations,StopSign stopSign) throws DataException, IOException, BirtException {
  IDiskArray[] dimPosition=getFilterResult();
  FactTableRowIterator factTableRowIterator=populateFactTableIterator(stopSign,dimPosition);
  DimensionResultIterator[] dimensionResultIterators=populateDimensionResultIterator(dimPosition,stopSign);
  IDataSet4Aggregation dataSet4Aggregation=new DataSetFromOriginalCube(factTableRowIterator,dimensionResultIterators,computedMeasureHelper);
  long memoryCacheSize=this.memoryCacheSize;
  if (this.appContext != null) {
    boolean use11SP3CubeQuery=CacheUtil.enableSP3CubeQueryChange(this.appContext);
    if (use11SP3CubeQuery)     memoryCacheSize=-(memoryCacheSize);
  }
  AggregationExecutor aggregationCalculatorExecutor=new AggregationExecutor(new CubeDimensionReader(cube),dataSet4Aggregation,aggregations,memoryCacheSize);
  aggregationCalculatorExecutor.setMaxDataObjectRows(maxDataObjectRows);
  return aggregationCalculatorExecutor.execute(stopSign);
}
Program: 65593
Project: 65593
Buggy source:
private void populateConnectionProp() throws SQLException {
  if (jdbcConn != null) {
    if (this.autoCommit != null)     jdbcConn.setAutoCommit(this.autoCommit);
 else {
      if (DBConfig.getInstance().qualifyPolicy(jdbcConn.getMetaData().getDriverName(),DBConfig.TRY_COMMIT_THEN_CLOSE)) {
        jdbcConn.setAutoCommit(false);
      }
    }
    if (this.isolationMode != Constants.TRANSCATION_ISOLATION_DEFAULT)     jdbcConn.setTransactionIsolation(this.isolationMode);
  }
}

Fixed version (ground truth):
private void populateConnectionProp() throws SQLException {
  if (jdbcConn != null) {
    if (this.autoCommit != null)     jdbcConn.setAutoCommit(this.autoCommit);
 else {
      if (DBConfig.getInstance().qualifyPolicy(jdbcConn.getMetaData().getDriverName(),DBConfig.TRY_COMMIT_THEN_CLOSE)) {
        this.autoCommit=false;
        jdbcConn.setAutoCommit(false);
      }
    }
    if (this.isolationMode != Constants.TRANSCATION_ISOLATION_DEFAULT)     jdbcConn.setTransactionIsolation(this.isolationMode);
  }
}
Program: 65594
Project: 65594
Buggy source:
/** 
 * Updates OLAP elements names in column bindings by using the name map.
 * @param module the module
 * @param cube the cube used by other elements
 * @param nameMap a map. The key is the old name and the value is corresponding new name.
 */
private void updateReferredOLAPColumnBinding(Module module,Cube cube,Map<String,String> nameMap){
  List<BackRef> clients=cube.getClientList();
  for (int i=0; i < clients.size(); i++) {
    BackRef ref=clients.get(i);
    DesignElement client=ref.getElement();
    List<Object> columnBindings=(List)client.getLocalProperty(module,IReportItemModel.BOUND_DATA_COLUMNS_PROP);
    if (columnBindings == null || columnBindings.isEmpty())     return;
    for (int j=0; j < columnBindings.size(); j++) {
      ComputedColumn binding=(ComputedColumn)columnBindings.get(j);
      updateBindingExpr(binding,nameMap);
      updateAggregateOnList(binding,nameMap);
      updateAggregationArguments(binding,nameMap);
      updateCalculationArguments(binding,nameMap);
      updateTimeDimension(binding,nameMap);
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates OLAP elements names in column bindings by using the name map.
 * @param module the module
 * @param cube the cube used by other elements
 * @param nameMap a map. The key is the old name and the value is corresponding new name.
 */
private void updateReferredOLAPColumnBinding(Module module,Cube cube,Map<String,String> nameMap){
  updateDerivedMeasure(module,cube,nameMap);
  List<BackRef> clients=cube.getClientList();
  for (int i=0; i < clients.size(); i++) {
    BackRef ref=clients.get(i);
    DesignElement client=ref.getElement();
    List<Object> columnBindings=(List)client.getLocalProperty(module,IReportItemModel.BOUND_DATA_COLUMNS_PROP);
    if (columnBindings == null || columnBindings.isEmpty())     return;
    for (int j=0; j < columnBindings.size(); j++) {
      ComputedColumn binding=(ComputedColumn)columnBindings.get(j);
      updateBindingExpr(binding,nameMap);
      updateAggregateOnList(binding,nameMap);
      updateAggregationArguments(binding,nameMap);
      updateCalculationArguments(binding,nameMap);
      updateTimeDimension(binding,nameMap);
    }
  }
}
Program: 65595
Project: 65595
Buggy source:
private void populateConnectionProp() throws SQLException {
  if (jdbcConn != null) {
    if (this.autoCommit != null)     jdbcConn.setAutoCommit(this.autoCommit);
    if (this.isolationMode != Constants.TRANSCATION_ISOLATION_DEFAULT)     jdbcConn.setTransactionIsolation(this.isolationMode);
  }
}

Fixed version (ground truth):
private void populateConnectionProp() throws SQLException {
  if (jdbcConn != null) {
    if (this.autoCommit != null)     jdbcConn.setAutoCommit(this.autoCommit);
 else {
      if (DBConfig.getInstance().qualifyPolicy(jdbcConn.getMetaData().getDriverName(),DBConfig.TRY_COMMIT_THEN_CLOSE)) {
        jdbcConn.setAutoCommit(false);
      }
    }
    if (this.isolationMode != Constants.TRANSCATION_ISOLATION_DEFAULT)     jdbcConn.setTransactionIsolation(this.isolationMode);
  }
}
Program: 65597
Project: 65597
Buggy source:
/** 
 * Set report basic settings.
 * @param model
 * @throws IOException
 */
void setReportSettings(Object model) throws IOException {
  ReportDesignHandle handle=(ReportDesignHandle)model;
  try {
    handle.setDisplayName(settingPage.getDisplayName());
    handle.setDescription(settingPage.getDescription());
    handle.setIconFile(settingPage.getPreviewImagePath());
    UIUtil.addCreateBy(handle);
    if (handle.getProperty(ReportDesignHandle.IMAGE_DPI_PROP) != null) {
      UIUtil.setDPI(handle);
    }
  }
 catch (  SemanticException e) {
  }
}

Fixed version (ground truth):
/** 
 * Set report basic settings.
 * @param model
 * @throws IOException
 */
void setReportSettings(Object model) throws IOException {
  ReportDesignHandle handle=(ReportDesignHandle)model;
  try {
    handle.setDisplayName(settingPage.getDisplayName());
    handle.setDescription(settingPage.getDescription());
    handle.setIconFile(settingPage.getPreviewImagePath());
    UIUtil.addCreateBy(handle);
    if (handle.getProperty(ReportDesignHandle.IMAGE_DPI_PROP) == null) {
      UIUtil.setDPI(handle);
    }
  }
 catch (  SemanticException e) {
  }
}
Program: 65598
Project: 65598
Buggy source:
protected void setProvider(IExpressionProvider provider){
  this.provider=provider;
}

Fixed version (ground truth):
public void setProvider(IExpressionProvider provider){
  this.provider=provider;
}
Program: 65599
Project: 65599
Buggy source:
protected void setContextObject(Object contextObject){
  this.contextObject=contextObject;
}

Fixed version (ground truth):
public void setContextObject(Object contextObject){
  this.contextObject=contextObject;
}
Program: 65600
Project: 65600
Buggy source:
protected IExpressionProvider getProvider(){
  return provider;
}

Fixed version (ground truth):
public IExpressionProvider getProvider(){
  return provider;
}
Program: 65601
Project: 65601
Buggy source:
public void close() throws OdaException {
  logger.logp(java.util.logging.Level.FINEST,Connection.class.getName(),"String_Node_Str","String_Node_Str");
  if (jdbcConn == null) {
    return;
  }
  try {
    if (this.appContext != null && jdbcConn != null) {
      Object option=this.appContext.get(IConnectionFactory.CLOSE_PASS_IN_CONNECTION);
      boolean closePassInConnection=(option instanceof Boolean) ? ((Boolean)option).booleanValue() : true;
      if (!closePassInConnection)       return;
    }
    if (jdbcConn.isClosed() == false) {
      jdbcConn.close();
      logger.log(Level.FINE,"String_Node_Str" + jdbcConn + "String_Node_Str");
    }
 else {
      logger.log(Level.FINER,"String_Node_Str" + jdbcConn + "String_Node_Str");
    }
  }
 catch (  SQLException e) {
    try {
      if (DBConfig.getInstance().qualifyPolicy(jdbcConn.getMetaData().getDriverName(),DBConfig.IGNORE_UNIMPORTANT_EXCEPTION))       return;
      if (this.autoCommit == false && DBConfig.getInstance().qualifyPolicy(jdbcConn.getMetaData().getDriverName(),DBConfig.TRY_COMMIT_THEN_CLOSE)) {
        jdbcConn.commit();
        jdbcConn.close();
        return;
      }
    }
 catch (    SQLException e1) {
    }
    throw new JDBCException(ResourceConstants.CONN_CANNOT_CLOSE,e);
  }
  jdbcConn=null;
}

Fixed version (ground truth):
public void close() throws OdaException {
  logger.logp(java.util.logging.Level.FINEST,Connection.class.getName(),"String_Node_Str","String_Node_Str");
  if (jdbcConn == null) {
    return;
  }
  try {
    if (this.appContext != null && jdbcConn != null) {
      Object option=this.appContext.get(IConnectionFactory.CLOSE_PASS_IN_CONNECTION);
      boolean closePassInConnection=(option instanceof Boolean) ? ((Boolean)option).booleanValue() : true;
      if (!closePassInConnection)       return;
    }
    if (jdbcConn.isClosed() == false) {
      jdbcConn.close();
      logger.log(Level.FINE,"String_Node_Str" + jdbcConn + "String_Node_Str");
    }
 else {
      logger.log(Level.FINER,"String_Node_Str" + jdbcConn + "String_Node_Str");
    }
  }
 catch (  SQLException e) {
    try {
      if (DBConfig.getInstance().qualifyPolicy(jdbcConn.getMetaData().getDriverName(),DBConfig.IGNORE_UNIMPORTANT_EXCEPTION))       return;
      if (this.autoCommit == Boolean.FALSE && DBConfig.getInstance().qualifyPolicy(jdbcConn.getMetaData().getDriverName(),DBConfig.TRY_COMMIT_THEN_CLOSE)) {
        jdbcConn.commit();
        jdbcConn.close();
        return;
      }
    }
 catch (    SQLException e1) {
    }
    throw new JDBCException(ResourceConstants.CONN_CANNOT_CLOSE,e);
  }
  jdbcConn=null;
}
Program: 65602
Project: 65602
Buggy source:
/** 
 * Prepare the meta data which will be used in execution of a query text. It sets the value of two member variables: resultSetMetaData and absoluteFileName
 */
public void prepare(String queryText) throws OdaException {
  if (queryText == null) {
    throw new OdaException(Messages.getString("String_Node_Str"));
  }
  QueryTextUtil qtu=new QueryTextUtil(queryText);
  String query=formatQueryText(qtu.getQuery());
  validateNonEmptyQueryText(query);
  String[] queryFragments=parsePreparedQueryText(query);
  validateSingleTableQuery(queryFragments);
  this.currentTableName=getPreparedTableNames(queryFragments);
  this.preparedColumnNames=getPreparedColumnNames(queryFragments);
  this.columnLabels=getColumnLabels(queryFragments);
}

Fixed version (ground truth):
/** 
 * Prepare the meta data which will be used in execution of a query text. It sets the value of two member variables: resultSetMetaData and absoluteFileName
 */
public void prepare(String queryText) throws OdaException {
  if (queryText == null) {
    throw new OdaException(Messages.getString("String_Node_Str"));
  }
  QueryTextUtil qtu=new QueryTextUtil(queryText);
  String query=formatQueryText(qtu.getQuery());
  validateNonEmptyQueryText(query);
  String[] queryFragments=parsePreparedQueryText(query);
  validateSingleTableQuery(queryFragments);
  this.currentTableName=getPreparedTableNames(queryFragments);
  this.preparedColumnNames=getPreparedColumnNames(queryFragments);
  this.columnLabels=getColumnLabels(queryFragments);
  colInfo=qtu.getColumnsInfo();
}
Program: 65603
Project: 65603
Buggy source:
public IResultSetMetaData getMetaData() throws OdaException {
  if (resultSetMetaData == null)   prepareMetaData();
  return resultSetMetaData;
}

Fixed version (ground truth):
public IResultSetMetaData getMetaData() throws OdaException {
  if (resultSetMetaData == null)   prepareMetaData(colInfo);
  return resultSetMetaData;
}
Program: 65605
Project: 65605
Buggy source:
public Time getTime(String columnName) throws OdaException {
  try {
    return new Time(Long.parseLong(getString(columnName)));
  }
 catch (  Exception e) {
    return null;
  }
}

Fixed version (ground truth):
public Time getTime(String columnName) throws OdaException {
  try {
    return stringToTime(getString(columnName));
  }
 catch (  Exception e) {
    return null;
  }
}
Program: 65606
Project: 65606
Buggy source:
/** 
 * Transform a String value to a date value
 * @param stringValue String value
 * @return Corresponding date value
 * @throws OdaException
 */
private Date stringToDate(String stringValue) throws OdaException {
  if (stringValue != null && stringValue.length() > 0) {
    try {
      return new Date(Long.parseLong(stringValue));
    }
 catch (    Exception ex) {
      throw new OdaException(Messages.getFormattedString("String_Node_Str",new String[]{stringValue}));
    }
  }
  this.wasNull=true;
  return null;
}

Fixed version (ground truth):
/** 
 * Transform a String value to a date value
 * @param stringValue String value
 * @return Corresponding date value
 * @throws OdaException
 */
private Date stringToDate(String stringValue) throws OdaException {
  if (stringValue != null && stringValue.trim().length() > 0) {
    try {
      return DateUtil.toSqlDate(stringValue);
    }
 catch (    Exception ex) {
      throw new OdaException(Messages.getFormattedString("String_Node_Str",new String[]{stringValue}));
    }
  }
  this.wasNull=true;
  return null;
}
Program: 65607
Project: 65607
Buggy source:
public Timestamp getTimestamp(String columnName) throws OdaException {
  try {
    return new Timestamp(Long.parseLong(getString(columnName)));
  }
 catch (  Exception e) {
    return null;
  }
}

Fixed version (ground truth):
public Timestamp getTimestamp(String columnName) throws OdaException {
  try {
    return stringToTimestamp(getString(columnName));
  }
 catch (  Exception e) {
    return null;
  }
}
Program: 65608
Project: 65608
Buggy source:
protected void setProvider(IExpressionProvider provider){
  super.setProvider(provider);
}

Fixed version (ground truth):
public void setProvider(IExpressionProvider provider){
  super.setProvider(provider);
}
Program: 65609
Project: 65609
Buggy source:
protected void setProvider(IExpressionProvider provider){
  super.setProvider(provider);
}

Fixed version (ground truth):
public void setProvider(IExpressionProvider provider){
  super.setProvider(provider);
}
Program: 65610
Project: 65610
Buggy source:
private static Map populateValidBinding(IQueryDefinition queryDefn){
  Map bindings=new HashMap();
  IQueryDefinition temp=queryDefn;
  while (temp != null) {
    bindings.putAll(temp.getBindings());
    if (temp instanceof IQueryDefinition)     temp=(IQueryDefinition)temp.getSourceQuery();
 else     temp=null;
  }
  return bindings;
}

Fixed version (ground truth):
private static Map populateValidBinding(IQueryDefinition queryDefn){
  Map bindings=new HashMap();
  IQueryDefinition temp=queryDefn;
  while (temp != null) {
    bindings.putAll(temp.getBindings());
    if (temp.getSourceQuery() instanceof IQueryDefinition)     temp=(IQueryDefinition)temp.getSourceQuery();
 else     temp=null;
  }
  return bindings;
}
Program: 65611
Project: 65611
Buggy source:
public void menuAboutToShow(IMenuManager manager){
  Action action=new Action(REMOVE){
    public void run(){
      ((MultipleEditPart)ChildrenDragTracker.this.getSourceEditPart()).removeView(number);
    }
    public boolean isEnabled(){
      int position=number - 1;
      List list=((ReportItemHandle)(ChildrenDragTracker.this.getSourceEditPart().getModel())).getViews();
      if (position < 0 && position > list.size() - 1) {
        return false;
      }
      return ((DesignElementHandle)list.get(position)).canDrop();
    }
  }
;
  manager.add(action);
}

Fixed version (ground truth):
public void menuAboutToShow(IMenuManager manager){
  Action action=new Action(REMOVE){
    public void run(){
      ((MultipleEditPart)ChildrenDragTracker.this.getSourceEditPart()).removeView(number);
    }
    public boolean isEnabled(){
      int position=number - 1;
      List list=((ReportItemHandle)(ChildrenDragTracker.this.getSourceEditPart().getModel())).getViews();
      if (position < 0 && position > list.size() - 1) {
        return false;
      }
      return ((DesignElementHandle)list.get(position)).canDrop();
    }
  }
;
  ISharedImages sharedImages=PlatformUI.getWorkbench().getSharedImages();
  action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
  manager.add(action);
}
Program: 65612
Project: 65612
Buggy source:
/** 
 * @param expr
 * @return
 * @throws CoreException
 */
public static String getReferencedMeasure(String expr) throws CoreException {
  return OlapExpressionCompiler.getReferencedMeasure(expr);
}

Fixed version (ground truth):
/** 
 * @param expr
 * @deprecated replaced by getAllReferencedMeasures
 * @return get the first measure name in this expression
 * @throws CoreException
 */
public static String getReferencedMeasure(String expr) throws CoreException {
  Set<String> names=OlapExpressionCompiler.getReferencedMeasure(expr);
  return names.isEmpty() ? null : names.iterator().next();
}
Program: 65613
Project: 65613
Buggy source:
/** 
 * @param n
 * @param objectName
 * @return
 */
private static String getScriptObjectName(Node n,String objectName){
  if (n == null)   return null;
  String result=null;
  if (n.getType() == Token.NAME) {
    if (objectName.equals(n.getString())) {
      Node dimNameNode=n.getNext();
      if (dimNameNode == null || dimNameNode.getType() != Token.STRING)       return null;
      return dimNameNode.getString();
    }
  }
  result=getScriptObjectName(n.getFirstChild(),objectName);
  if (result == null)   result=getScriptObjectName(n.getLastChild(),objectName);
  return result;
}

Fixed version (ground truth):
/** 
 * @param n
 * @param objectName
 * @return
 */
private static void getScriptObjectName(Node n,String objectName,Set nameSet){
  if (n == null)   return;
  String result=null;
  if (n.getType() == Token.NAME) {
    if (objectName.equals(n.getString())) {
      Node dimNameNode=n.getNext();
      if (dimNameNode == null || dimNameNode.getType() != Token.STRING)       return;
      nameSet.add(dimNameNode.getString());
    }
  }
  getScriptObjectName(n.getFirstChild(),objectName,nameSet);
  getScriptObjectName(n.getNext(),objectName,nameSet);
  getScriptObjectName(n.getLastChild(),objectName,nameSet);
}
Program: 65614
Project: 65614
Buggy source:
/** 
 * @param expr
 * @param objectName
 * @return
 */
public static String getReferencedMeasure(String expr){
  if (expr == null)   return null;
  try {
    Context cx=Context.enter();
    CompilerEnvirons ce=new CompilerEnvirons();
    Parser p=new Parser(ce,cx.getErrorReporter());
    ScriptOrFnNode tree=p.parse(expr,null,0);
    return getScriptObjectName(tree,"String_Node_Str");
  }
  finally {
    Context.exit();
  }
}

Fixed version (ground truth):
/** 
 * @param expr
 * @param objectName
 * @return
 */
public static Set<String> getReferencedMeasure(String expr){
  if (expr == null)   return Collections.EMPTY_SET;
  try {
    Set<String> result=new LinkedHashSet<String>();
    Context cx=Context.enter();
    CompilerEnvirons ce=new CompilerEnvirons();
    Parser p=new Parser(ce,cx.getErrorReporter());
    ScriptOrFnNode tree=p.parse(expr,null,0);
    getScriptObjectName(tree,"String_Node_Str",result);
    return result;
  }
  finally {
    Context.exit();
  }
}