nus-yam/ex-repair huggingface dataset:
Program: 73626
Project: 73626
Buggy source:
/** 
 * @param dimensionAxis
 * @return
 */
private int findFowardOffsetRange(int dimensionAxis){
  int range=-1;
  if (dimensionAxis < 0 || dimensionAxis > this.dimAxis.length) {
    return range;
  }
  if (dimensionAxis == 0) {
    if (this.dimensionCursorPosition[0] < this.relationMap.relation[0].size())     return this.relationMap.relation[0].size() - this.dimensionCursorPosition[dimensionAxis] - 1;
 else     return range;
  }
  if (dimensionAxis >= this.relationMap.mirrorStartPosition && this.relationMap.mirrorStartPosition > 0) {
    return this.relationMap.mirrorLength[dimensionAxis] - this.dimensionCursorPosition[dimensionAxis] - 1;
  }
  EdgeInfo currentInfo=this.findCurrentEdgeInfo(dimensionAxis);
  if (currentInfo == null)   return range;
 else {
    range=0;
    while (true) {
      int index=this.relationMap.relation[dimensionAxis].indexOf(currentInfo);
      EdgeInfo nextEdgeInfo=null;
      if (this.relationMap.relation[dimensionAxis].size() > index + 1)       nextEdgeInfo=(EdgeInfo)this.relationMap.relation[dimensionAxis].get(index + 1);
 else       break;
      if (nextEdgeInfo != null && currentInfo.parent == nextEdgeInfo.parent) {
        range++;
        currentInfo=nextEdgeInfo;
      }
 else {
        break;
      }
    }
  }
  return range;
}

Fixed version (ground truth):
/** 
 * @param dimensionAxis
 * @return
 */
private int findFowardOffsetRange(int dimensionAxis){
  int range=-1;
  if (dimensionAxis < 0 || dimensionAxis > this.dimAxis.length) {
    return range;
  }
  if (dimensionAxis == 0) {
    if (this.dimensionCursorPosition[0] < this.relationMap.currentRelation[0].size())     return this.relationMap.currentRelation[0].size() - this.dimensionCursorPosition[dimensionAxis] - 1;
 else     return range;
  }
  if (dimensionAxis >= this.relationMap.mirrorStartPosition && this.relationMap.mirrorStartPosition > 0) {
    return this.relationMap.mirrorLength[dimensionAxis] - this.dimensionCursorPosition[dimensionAxis] - 1;
  }
  EdgeInfo currentInfo=this.findCurrentEdgeInfo(dimensionAxis);
  if (currentInfo == null)   return range;
 else {
    range=0;
    while (true) {
      int index=this.relationMap.currentRelation[dimensionAxis].indexOf(currentInfo);
      EdgeInfo nextEdgeInfo=null;
      if (this.relationMap.currentRelation[dimensionAxis].size() > index + 1)       nextEdgeInfo=(EdgeInfo)this.relationMap.currentRelation[dimensionAxis].get(index + 1);
 else       break;
      if (nextEdgeInfo != null && currentInfo.parent == nextEdgeInfo.parent) {
        range++;
        currentInfo=nextEdgeInfo;
      }
 else {
        break;
      }
    }
  }
  return range;
}
Program: 73627
Project: 73627
Buggy source:
/** 
 * Check whether the cursor on dimAxisIndex has next row.
 * @param dimAxisIndex
 * @return
 */
private boolean hasNext(int dimAxisIndex){
  if (!this.dimAxis[dimAxisIndex].isMirrored()) {
    EdgeInfo currentEdgeInfo=findCurrentEdgeInfo(dimAxisIndex);
    if (currentEdgeInfo == null) {
      if (this.dimensionCursorPosition[dimAxisIndex] < 0 && this.relationMap.traverseLength > 0)       return true;
 else       return false;
    }
    int index=this.relationMap.relation[dimAxisIndex].indexOf(currentEdgeInfo);
    EdgeInfo nextEdgeInfo=null;
    if (this.relationMap.relation[dimAxisIndex].size() > index + 1)     nextEdgeInfo=(EdgeInfo)this.relationMap.relation[dimAxisIndex].get(index + 1);
    if (nextEdgeInfo == null)     return false;
    if (currentEdgeInfo.parent == nextEdgeInfo.parent)     return true;
    return false;
  }
 else {
    if (this.dimensionCursorPosition[dimAxisIndex] < relationMap.mirrorLength[dimAxisIndex] - 1)     return true;
 else     return false;
  }
}

Fixed version (ground truth):
/** 
 * Check whether the cursor on dimAxisIndex has next row.
 * @param dimAxisIndex
 * @return
 */
private boolean hasNext(int dimAxisIndex){
  if (!this.dimAxis[dimAxisIndex].isMirrored()) {
    EdgeInfo currentEdgeInfo=findCurrentEdgeInfo(dimAxisIndex);
    if (currentEdgeInfo == null) {
      if (this.dimensionCursorPosition[dimAxisIndex] < 0 && this.relationMap.traverseLength > 0)       return true;
 else       return false;
    }
    int index=this.relationMap.currentRelation[dimAxisIndex].indexOf(currentEdgeInfo);
    EdgeInfo nextEdgeInfo=null;
    if (this.relationMap.currentRelation[dimAxisIndex].size() > index + 1)     nextEdgeInfo=(EdgeInfo)this.relationMap.currentRelation[dimAxisIndex].get(index + 1);
    if (nextEdgeInfo == null)     return false;
    if (currentEdgeInfo.parent == nextEdgeInfo.parent)     return true;
    return false;
  }
 else {
    if (this.dimensionCursorPosition[dimAxisIndex] < relationMap.mirrorLength[dimAxisIndex] - 1)     return true;
 else     return false;
  }
}
Program: 73628
Project: 73628
Buggy source:
/** 
 * @param dimAxisIndex
 * @param edgeInfo
 * @return
 */
private int findOuterMostChildEdgeInfoIndex(int dimAxisIndex,EdgeInfo edgeInfo){
  if (dimAxisIndex < 0 || dimAxisIndex >= this.dimAxis.length || edgeInfo == null)   return -1;
  int endPosition=edgeInfo.firstChild;
  EdgeInfo info=edgeInfo;
  int index;
  for (index=dimAxisIndex + 1; index < this.dimAxis.length; index++) {
    if (this.dimAxis[index].isMirrored())     break;
    info=(EdgeInfo)((List)this.relationMap.relation[index]).get(endPosition);
    endPosition=info.firstChild;
  }
  if (index == this.relationMap.mirrorStartPosition)   return this.relationMap.relation[index - 1].indexOf(info);
 else   return this.relationMap.relation[index].indexOf(info);
}

Fixed version (ground truth):
/** 
 * @param dimAxisIndex
 * @param edgeInfo
 * @return
 */
private int findOuterMostChildEdgeInfoIndex(int dimAxisIndex,EdgeInfo edgeInfo){
  if (dimAxisIndex < 0 || dimAxisIndex >= this.dimAxis.length || edgeInfo == null)   return -1;
  int endPosition=edgeInfo.firstChild;
  EdgeInfo info=edgeInfo;
  int index;
  for (index=dimAxisIndex + 1; index < this.dimAxis.length; index++) {
    if (this.dimAxis[index].isMirrored())     break;
    info=(EdgeInfo)((List)this.relationMap.currentRelation[index]).get(endPosition);
    endPosition=info.firstChild;
  }
  if (index == this.relationMap.mirrorStartPosition)   return this.relationMap.currentRelation[index - 1].indexOf(info);
 else   return this.relationMap.currentRelation[index].indexOf(info);
}
Program: 73629
Project: 73629
Buggy source:
/** 
 * @param dimAxisIndex
 * @param edgeInfo
 * @return
 */
private EdgeInfo findOuterMostChildEdgeInfo(int dimAxisIndex,EdgeInfo edgeInfo){
  if (dimAxisIndex < 0 || dimAxisIndex >= this.dimAxis.length || edgeInfo == null)   return null;
  int endPosition=edgeInfo.firstChild;
  EdgeInfo info=edgeInfo;
  for (int i=dimAxisIndex + 1; i < this.dimAxis.length; i++) {
    if (this.dimAxis[i].isMirrored())     break;
    info=(EdgeInfo)((List)this.relationMap.relation[i]).get(endPosition);
    endPosition=info.firstChild;
  }
  return info;
}

Fixed version (ground truth):
/** 
 * @param dimAxisIndex
 * @param edgeInfo
 * @return
 */
private EdgeInfo findOuterMostChildEdgeInfo(int dimAxisIndex,EdgeInfo edgeInfo){
  if (dimAxisIndex < 0 || dimAxisIndex >= this.dimAxis.length || edgeInfo == null)   return null;
  int endPosition=edgeInfo.firstChild;
  EdgeInfo info=edgeInfo;
  for (int i=dimAxisIndex + 1; i < this.dimAxis.length; i++) {
    if (this.dimAxis[i].isMirrored())     break;
    info=(EdgeInfo)((List)this.relationMap.currentRelation[i]).get(endPosition);
    endPosition=info.firstChild;
  }
  return info;
}
Program: 73631
Project: 73631
Buggy source:
EdgeCursorImpl(BirtEdgeView view,boolean isPage,EdgeAxis axis,CubeCursor cursor) throws OLAPException {
  super(new EdgeNavigator(axis),null);
  if (isPage)   pageOwner=cursor;
 else   ordinateOwner=cursor;
  view.setEdgeCursor(this);
  for (int i=0; i < axis.getAllDimensionAxis().length; i++) {
    dimensionCursorList.add(new DimensionCursorImpl(this,axis.getDimensionAxis(i),new DimensionNavigator(axis.getDimensionAxis(i))));
  }
}

Fixed version (ground truth):
EdgeCursorImpl(BirtEdgeView view,boolean isPage,EdgeAxis axis,CubeCursor cursor) throws OLAPException {
  super(new EdgeNavigator(axis),null);
  if (isPage)   pageOwner=cursor;
 else   ordinateOwner=cursor;
  view.setEdgeCursor(this);
  for (int i=view.getPageEndingIndex() + 1; i < axis.getAllDimensionAxis().length; i++) {
    dimensionCursorList.add(new DimensionCursorImpl(this,axis.getDimensionAxis(i),new DimensionNavigator(axis.getDimensionAxis(i))));
  }
}
Program: 73632
Project: 73632
Buggy source:
public String getText(Object element){
  if (element instanceof IMethodInfo) {
    IMethodInfo eleDef=(IMethodInfo)element;
    return "String_Node_Str" + eleDef.getName();
  }
 else   if (element instanceof String) {
    return (String)element;
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getText(Object element){
  if (element instanceof IMethodInfo) {
    IMethodInfo eleDef=(IMethodInfo)element;
    return JSEditor.METHOD_DISPLAY_INDENT + eleDef.getName();
  }
 else   if (element instanceof String) {
    return (String)element;
  }
  return "String_Node_Str";
}
Program: 73634
Project: 73634
Buggy source:
/** 
 * getEditorText() - gets the editor content.
 */
private String getEditorText(){
  return scriptEditor.getScript();
}

Fixed version (ground truth):
/** 
 * getEditorText() - gets the editor content.
 */
String getEditorText(){
  return scriptEditor.getScript();
}
Program: 73636
Project: 73636
Buggy source:
private boolean validType(String str){
  for (int count=0; count < str.length(); count++) {
    char ch=str.charAt(count);
    if (ch != '$' && ch != '0' && ch != '#' && ch != '?' && ch != '@' && ch != '%' && ch != '.' && ch != ';' && ch != ' ') {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean validType(String str){
  for (int count=0; count < str.length(); count++) {
    char ch=str.charAt(count);
    if (ch != '$' && ch != '0' && ch != '#' && ch != '?' && ch != '@' && ch != '%' && ch != '.' && ch != ';' && ch != ' ' && ch != ',' && ch != '+' && ch != '/' && ch != '_' && ch != '*' && ch != '(' && ch != ')' && ch != '[' && ch != ']' && ch != '"') {
      return false;
    }
  }
  return true;
}
Program: 73637
Project: 73637
Buggy source:
public Collection getColumnValueSet(DataSetHandle dataSet,Iterator inputParamBindings,Iterator columnBindings,String boundColumnName,IRequestInfo requestInfo) throws BirtException {
  ArrayList temp=new ArrayList();
  while (columnBindings.hasNext()) {
    temp.add(columnBindings.next());
  }
  if (referToAggregation(temp,boundColumnName))   return new ArrayList();
  IQueryResults queryResults=getGroupingQueryResults(dataSet,inputParamBindings,temp.iterator(),boundColumnName);
  IResultIterator resultIt=queryResults.getResultIterator();
  int maxRowCount=-1;
  ArrayList values=new ArrayList();
  if (requestInfo != null) {
    if (requestInfo.getStartRow() >= 0) {
      resultIt.moveTo(requestInfo.getStartRow());
      Object value=resultIt.getValue(boundColumnName);
      values.add(value);
    }
    maxRowCount=requestInfo.getMaxRow();
  }
  while (resultIt.next() && maxRowCount != 0) {
    Object value=resultIt.getValue(boundColumnName);
    values.add(value);
    resultIt.skipToEnd(1);
    maxRowCount--;
  }
  resultIt.close();
  queryResults.close();
  return values;
}

Fixed version (ground truth):
public Collection getColumnValueSet(DataSetHandle dataSet,Iterator inputParamBindings,Iterator columnBindings,String boundColumnName,IRequestInfo requestInfo) throws BirtException {
  IColumnValueIterator columnValueIterator=getColumnValueIterator(dataSet,inputParamBindings,columnBindings,boundColumnName);
  int maxRowCount=-1;
  ArrayList values=new ArrayList();
  if (requestInfo != null) {
    if (requestInfo.getStartRow() >= 0) {
      ((ColumnValueIterator)columnValueIterator).moveTo(requestInfo.getStartRow());
      Object value=columnValueIterator.getValue();
      values.add(value);
    }
    maxRowCount=requestInfo.getMaxRow();
  }
  while (columnValueIterator.next() && maxRowCount != 0) {
    Object value=columnValueIterator.getValue();
    values.add(value);
    maxRowCount--;
  }
  columnValueIterator.close();
  return values;
}
Program: 73641
Project: 73641
Buggy source:
public void restoreView(AggregationCellHandle cell){
  try {
    Chart cm=ChartReportItemUtil.getChartFromHandle(getChartHandle(cell));
    ChartXTabUtil.removeAxisChartInXTab(cm,cell.getCrosstab());
  }
 catch (  BirtException e) {
    ExceptionHandler.handle(e);
  }
}

Fixed version (ground truth):
public void restoreView(AggregationCellHandle cell){
  try {
    Chart cm=ChartReportItemUtil.getChartFromHandle(getChartHandle(cell));
    ChartXTabUtil.removeAxisChartInXTab(cell,cm);
  }
 catch (  BirtException e) {
    ExceptionHandler.handle(e);
  }
}
Program: 73642
Project: 73642
Buggy source:
/** 
 * Finds chart report item from handle
 * @param eih extended item handle with chart
 * @since 2.3
 */
public static ChartReportItemImpl getChartReportItemFromHandle(ExtendedItemHandle eih){
  ChartReportItemImpl item=null;
  if (!"String_Node_Str".endsWith(eih.getExtensionName())) {
    return null;
  }
  try {
    item=(ChartReportItemImpl)eih.getReportItem();
  }
 catch (  ExtendedElementException e) {
    logger.log(e);
  }
  if (item == null) {
    try {
      eih.loadExtendedElement();
      item=(ChartReportItemImpl)eih.getReportItem();
    }
 catch (    ExtendedElementException eeex) {
      logger.log(eeex);
    }
    if (item == null) {
      logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    }
  }
  return item;
}

Fixed version (ground truth):
/** 
 * Finds chart report item from handle
 * @param eih extended item handle with chart
 * @since 2.3
 */
public static ChartReportItemImpl getChartReportItemFromHandle(ExtendedItemHandle eih){
  ChartReportItemImpl item=null;
  if (!isChartHandle(eih)) {
    return null;
  }
  try {
    item=(ChartReportItemImpl)eih.getReportItem();
  }
 catch (  ExtendedElementException e) {
    logger.log(e);
  }
  if (item == null) {
    try {
      eih.loadExtendedElement();
      item=(ChartReportItemImpl)eih.getReportItem();
    }
 catch (    ExtendedElementException eeex) {
      logger.log(eeex);
    }
    if (item == null) {
      logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    }
  }
  return item;
}
Program: 73643
Project: 73643
Buggy source:
/** 
 * @throws BirtException
 * @throws DataException
 * @throws IOException
 */
private void incomprehensiveColumnBinding() throws BirtException, DataException, IOException {
  this.GEN_add_group=true;
  this.GEN_add_subquery=true;
  this.GEN_print=true;
  this.USE_DATE_IN_COLUMNBINDING=false;
  this.genBasicIV();
  this.closeArchiveWriter();
  DataEngineContext deContext2=newContext(DataEngineContext.MODE_UPDATE,fileName,fileName);
  if (myPreDataEngine != null) {
    myPreDataEngine.shutdown();
    myGenDataEngine.clearCache(dataSource,dataSet);
  }
  myPreDataEngine=DataEngine.newDataEngine(deContext2);
  this.UPDATE_add_same_group=true;
  this.UPDATE_add_subquery=1;
  this.updatePreBasicIV();
  this.closeArchiveReader();
  this.closeArchiveWriter();
  myPreDataEngine.shutdown();
  DataEngineContext deContext3=newContext(DataEngineContext.MODE_PRESENTATION,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext3);
  this.PRE_execute_query=false;
  this.preBasicIV();
  this.checkOutputFile();
  myPreDataEngine.shutdown();
}

Fixed version (ground truth):
/** 
 * @throws BirtException
 * @throws DataException
 * @throws IOException
 */
private void incomprehensiveColumnBinding() throws BirtException, DataException, IOException {
  File file=new File(fileName);
  if (file.exists()) {
    file.delete();
  }
  this.GEN_add_group=true;
  this.GEN_add_subquery=true;
  this.GEN_print=true;
  this.USE_DATE_IN_COLUMNBINDING=false;
  this.genBasicIV();
  this.closeArchiveReader();
  this.closeArchiveWriter();
  DataEngineContext deContext2=newContext(DataEngineContext.MODE_UPDATE,fileName,fileName);
  if (myPreDataEngine != null) {
    myPreDataEngine.shutdown();
    myPreDataEngine.clearCache(dataSource,dataSet);
  }
  myPreDataEngine=DataEngine.newDataEngine(deContext2);
  this.UPDATE_add_same_group=true;
  this.UPDATE_add_subquery=1;
  this.updatePreBasicIV();
  this.closeArchiveReader();
  this.closeArchiveWriter();
  myPreDataEngine.shutdown();
  DataEngineContext deContext3=newContext(DataEngineContext.MODE_PRESENTATION,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext3);
  this.PRE_execute_query=false;
  this.preBasicIV();
  this.checkOutputFile();
  myPreDataEngine.shutdown();
}
Program: 73644
Project: 73644
Buggy source:
public void changeTask(Notification notification){
  if (previewPainter != null) {
    if (notification == null) {
      if (getChartModel() instanceof ChartWithAxes) {
        checkDataTypeForChartWithAxes();
      }
      return;
    }
    if ((notification.getNotifier() instanceof Query && ((Query)notification.getNotifier()).eContainer() instanceof Series)) {
      checkDataType((Query)notification.getNotifier(),(Series)((Query)notification.getNotifier()).eContainer());
    }
    if (notification.getNotifier() instanceof SeriesDefinition && getChartModel() instanceof ChartWithAxes) {
      checkDataTypeForChartWithAxes();
    }
    if (notification.getNewValue() instanceof SeriesGrouping) {
      getCustomizeUI().refreshLeftBindingArea();
    }
    if (notification.getNotifier() instanceof Query || notification.getNotifier() instanceof Axis || notification.getNotifier() instanceof SeriesDefinition|| notification.getNotifier() instanceof SeriesGrouping) {
      doLivePreview();
    }
 else     if (ChartPreviewPainter.isLivePreviewActive()) {
      ChartAdapter.beginIgnoreNotifications();
      ChartUIUtil.syncRuntimeSeries(getChartModel());
      ChartAdapter.endIgnoreNotifications();
      doLivePreview();
    }
 else {
      previewPainter.renderModel(getChartModel());
    }
  }
}

Fixed version (ground truth):
public void changeTask(Notification notification){
  if (previewPainter != null) {
    if (notification == null) {
      if (getChartModel() instanceof ChartWithAxes) {
        checkDataTypeForChartWithAxes();
      }
      return;
    }
    if ((notification.getNotifier() instanceof Query && ((Query)notification.getNotifier()).eContainer() instanceof Series)) {
      checkDataType((Query)notification.getNotifier(),(Series)((Query)notification.getNotifier()).eContainer());
    }
    if (notification.getNotifier() instanceof SeriesDefinition && getChartModel() instanceof ChartWithAxes) {
      checkDataTypeForChartWithAxes();
    }
    if (notification.getNotifier() instanceof Query || notification.getNotifier() instanceof Axis || notification.getNotifier() instanceof SeriesDefinition|| notification.getNotifier() instanceof SeriesGrouping) {
      doLivePreview();
    }
 else     if (ChartPreviewPainter.isLivePreviewActive()) {
      ChartAdapter.beginIgnoreNotifications();
      ChartUIUtil.syncRuntimeSeries(getChartModel());
      ChartAdapter.endIgnoreNotifications();
      doLivePreview();
    }
 else {
      previewPainter.renderModel(getChartModel());
    }
  }
}
Program: 73645
Project: 73645
Buggy source:
/** 
 * get intrinsic dimension of image in pixels. Now only support png, bmp, jpg, gif.
 * @param in
 * @return
 * @throws IOException
 * @throws MalformedURLException
 * @throws BadElementException
 */
protected Dimension getIntrinsicDimension(IImageContent content) throws BadElementException, MalformedURLException, IOException {
  Image image=null;
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
    ReportDesignHandle design=content.getReportContent().getDesign().getReportDesign();
  URL url=design.findResource(content.getURI(),IResourceLocator.IMAGE);
InputStream in=url.openStream();
try {
byte[] buffer=new byte[in.available()];
in.read(buffer);
image=Image.getInstance(buffer);
}
 catch (Exception ex) {
logger.log(Level.WARNING,ex.getMessage(),ex);
}
 finally {
in.close();
}
break;
case IImageContent.IMAGE_NAME:
case IImageContent.IMAGE_EXPRESSION:
image=Image.getInstance(content.getData());
break;
case IImageContent.IMAGE_URL:
image=Image.getInstance(new URL(content.getURI()));
break;
default :
assert(false);
}
if (image != null) {
Object design=content.getGenerateBy();
int resolution=96;
if (design instanceof ExtendedItemDesign) {
resolution=192;
}
return new Dimension((int)(image.plainWidth() * 1000 / resolution * 72),(int)(image.plainHeight() * 1000 / resolution * 72));
}
return null;
}

Fixed version (ground truth):
/** 
 * get intrinsic dimension of image in pixels. Now only support png, bmp, jpg, gif.
 * @param in
 * @return
 * @throws IOException
 * @throws MalformedURLException
 * @throws BadElementException
 */
protected Dimension getIntrinsicDimension(IImageContent content) throws BadElementException, MalformedURLException, IOException {
  Image image=null;
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
    ReportDesignHandle design=content.getReportContent().getDesign().getReportDesign();
  URL url=design.findResource(content.getURI(),IResourceLocator.IMAGE);
InputStream in=url.openStream();
try {
byte[] buffer=new byte[in.available()];
in.read(buffer);
image=Image.getInstance(buffer);
}
 catch (Exception ex) {
logger.log(Level.WARNING,ex.getMessage(),ex);
}
 finally {
in.close();
}
break;
case IImageContent.IMAGE_NAME:
case IImageContent.IMAGE_EXPRESSION:
image=Image.getInstance(content.getData());
break;
case IImageContent.IMAGE_URL:
image=Image.getInstance(new URL(content.getURI()));
break;
default :
assert(false);
}
if (image != null) {
int resolution=96;
int contentResolution=content.getResolution();
if (contentResolution != 0) {
resolution=contentResolution;
}
return new Dimension((int)(image.plainWidth() * 1000 / resolution * 72),(int)(image.plainHeight() * 1000 / resolution * 72));
}
return null;
}
Program: 73647
Project: 73647
Buggy source:
/** 
 * @throws BirtException
 * @throws DataException
 * @throws IOException
 */
private void incomprehensiveColumnBinding() throws BirtException, DataException, IOException {
  this.GEN_add_group=true;
  this.GEN_add_subquery=true;
  this.GEN_print=true;
  this.USE_DATE_IN_COLUMNBINDING=false;
  this.genBasicIV();
  this.closeArchiveWriter();
  DataEngineContext deContext2=newContext(DataEngineContext.MODE_UPDATE,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext2);
  this.UPDATE_add_same_group=true;
  this.UPDATE_add_subquery=1;
  this.updatePreBasicIV();
  this.closeArchiveReader();
  this.closeArchiveWriter();
  myPreDataEngine.shutdown();
  DataEngineContext deContext3=newContext(DataEngineContext.MODE_PRESENTATION,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext3);
  this.PRE_execute_query=false;
  this.preBasicIV();
  this.checkOutputFile();
  myPreDataEngine.shutdown();
}

Fixed version (ground truth):
/** 
 * @throws BirtException
 * @throws DataException
 * @throws IOException
 */
private void incomprehensiveColumnBinding() throws BirtException, DataException, IOException {
  this.GEN_add_group=true;
  this.GEN_add_subquery=true;
  this.GEN_print=true;
  this.USE_DATE_IN_COLUMNBINDING=false;
  this.genBasicIV();
  this.closeArchiveWriter();
  DataEngineContext deContext2=newContext(DataEngineContext.MODE_UPDATE,fileName,fileName);
  if (myPreDataEngine != null) {
    myPreDataEngine.shutdown();
    myGenDataEngine.clearCache(dataSource,dataSet);
  }
  myPreDataEngine=DataEngine.newDataEngine(deContext2);
  this.UPDATE_add_same_group=true;
  this.UPDATE_add_subquery=1;
  this.updatePreBasicIV();
  this.closeArchiveReader();
  this.closeArchiveWriter();
  myPreDataEngine.shutdown();
  DataEngineContext deContext3=newContext(DataEngineContext.MODE_PRESENTATION,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext3);
  this.PRE_execute_query=false;
  this.preBasicIV();
  this.checkOutputFile();
  myPreDataEngine.shutdown();
}
Program: 73649
Project: 73649
Buggy source:
protected String getEscapedStr(String s){
  StringBuffer result=null;
  int spacePos=1;
  char[] s2char=s.toCharArray();
  for (int i=0, max=s2char.length, delta=0; i < max; i++) {
    char c=s2char[i];
    String replacement=null;
    if (c == ' ') {
      if (spacePos % 2 == 1 || i == max - 1) {
        replacement="String_Node_Str";
      }
      spacePos++;
    }
 else {
      spacePos=0;
    }
    if (!(c == 0x9 || c == 0xA || c == 0xD || (c >= 0x20 && c <= 0xD7FF) || (c >= 0xE000 && c <= 0xFFFD))) {
      replacement="String_Node_Str";
    }
 else     if (c == '&') {
      replacement="String_Node_Str";
    }
 else     if (c == '<') {
      replacement="String_Node_Str";
    }
 else     if (c == '>') {
      replacement="String_Node_Str";
    }
 else     if (c == '\t') {
      replacement="String_Node_Str";
    }
 else     if (c >= 0x80) {
      replacement="String_Node_Str" + Integer.toHexString(c) + ';';
    }
    if (replacement != null) {
      if (result == null) {
        result=new StringBuffer(s);
      }
      result.replace(i + delta,i + delta + 1,replacement);
      delta+=(replacement.length() - 1);
    }
  }
  if (result == null) {
    return s;
  }
  return result.toString();
}

Fixed version (ground truth):
protected String getEscapedStr(String s){
  StringBuffer result=null;
  int spacePos=1;
  char[] s2char=s.toCharArray();
  for (int i=0, max=s2char.length, delta=0; i < max; i++) {
    char c=s2char[i];
    String replacement=null;
    if (c == ' ') {
      if (spacePos % 2 == 1 || i == max - 1) {
        replacement="String_Node_Str";
      }
      spacePos++;
    }
 else {
      spacePos=0;
    }
    if (!(c == 0x9 || c == 0xA || c == 0xD || (c >= 0x20 && c <= 0xD7FF) || (c >= 0xE000 && c <= 0xFFFD))) {
      replacement="String_Node_Str";
    }
 else     if (c == '&') {
      replacement="String_Node_Str";
    }
 else     if (c == '<') {
      replacement="String_Node_Str";
    }
 else     if (c == '>') {
      replacement="String_Node_Str";
    }
 else     if (c == '\t') {
      replacement="String_Node_Str";
    }
 else     if (c == '=') {
      replacement="String_Node_Str";
    }
 else     if (c >= 0x80) {
      replacement="String_Node_Str" + Integer.toHexString(c) + ';';
    }
    if (replacement != null) {
      if (result == null) {
        result=new StringBuffer(s);
      }
      result.replace(i + delta,i + delta + 1,replacement);
      delta+=(replacement.length() - 1);
    }
  }
  if (result == null) {
    return s;
  }
  return result.toString();
}
Program: 73650
Project: 73650
Buggy source:
/** 
 * Gets teh value from the String throw the VM.
 * @param frame
 * @param expression
 * @return
 */
public ScriptValue evaluate(ScriptStackFrame frame,String expression){
  VMValue value;
  try {
    value=reportVM.evaluate(expression);
  }
 catch (  VMException e) {
    return null;
  }
  if (value == null) {
    return null;
  }
  ScriptValue debugValue=new ScriptValue(frame,value);
  return debugValue;
}

Fixed version (ground truth):
/** 
 * Gets teh value from the String throw the VM.
 * @param frame
 * @param expression
 * @return
 */
public ScriptValue evaluate(ScriptStackFrame frame,String expression){
  VMValue value;
  try {
    value=reportVM.evaluate(expression);
  }
 catch (  VMException e) {
    return null;
  }
  if (value == null) {
    return null;
  }
  if (VMConstants.UNDEFINED_TYPE.equals(value.getTypeName()) || VMConstants.EXCEPTION_TYPE.equals(value.getTypeName())) {
    return null;
  }
  ScriptValue debugValue=new ScriptValue(frame,value);
  return debugValue;
}
Program: 73651
Project: 73651
Buggy source:
/** 
 * Clear the temp files when session is expired
 * @param sessionId
 */
public static void clearSessionFiles(String sessionId){
  if (sessionId == null)   return;
  String tempFolder=documentFolder + File.separator + (PREFIX_SUB_DOC_FOLDER + sessionId);
  File file=new File(tempFolder);
  deleteDir(file);
  tempFolder=imageFolder + File.separator + sessionId;
  file=new File(tempFolder);
  deleteDir(file);
}

Fixed version (ground truth):
/** 
 * Clear the temp files when session is expired
 * @param sessionId
 */
public static void clearSessionFiles(String sessionId){
  if (sessionId == null)   return;
  String tempFolder=documentFolder + File.separator + (PREFIX_SUB_DOC_FOLDER + sessionId);
  File file=new File(tempFolder);
  deleteDir(file);
  tempFolder=imageFolder + File.separator + (PREFIX_SUB_IMAGE_FOLDER + sessionId);
  file=new File(tempFolder);
  deleteDir(file);
}
Program: 73652
Project: 73652
Buggy source:
/** 
 * Clears the report document/image files which had been created last time the server starts up.
 */
protected static void clearTempFiles(){
  File file=new File(documentFolder);
  if (file != null && file.isDirectory()) {
    String[] children=file.list();
    for (int i=0; i < children.length; i++) {
      if (children[i].startsWith(PREFIX_SUB_DOC_FOLDER))       deleteDir(new File(file,children[i]));
    }
  }
  file=new File(imageFolder);
  deleteDir(file);
  makeDir(imageFolder);
}

Fixed version (ground truth):
/** 
 * Clears the report document/image files which had been created last time the server starts up.
 */
protected static void clearTempFiles(){
  File file=new File(documentFolder);
  if (file != null && file.isDirectory()) {
    String[] children=file.list();
    for (int i=0; i < children.length; i++) {
      if (children[i].startsWith(PREFIX_SUB_DOC_FOLDER))       deleteDir(new File(file,children[i]));
    }
  }
  file=new File(imageFolder);
  if (file != null && file.isDirectory()) {
    String[] children=file.list();
    for (int i=0; i < children.length; i++) {
      if (children[i].startsWith(PREFIX_SUB_IMAGE_FOLDER))       deleteDir(new File(file,children[i]));
    }
  }
}
Program: 73654
Project: 73654
Buggy source:
/** 
 * Returns the temp image folder with session id
 * @param request
 * @return
 */
public static String getImageTempFolder(HttpServletRequest request){
  String tempFolder=imageFolder;
  String sessionId=request.getSession().getId();
  if (sessionId != null)   tempFolder=tempFolder + File.separator + sessionId;
  return tempFolder;
}

Fixed version (ground truth):
/** 
 * Returns the temp image folder with session id
 * @param request
 * @return
 */
public static String getImageTempFolder(HttpServletRequest request){
  String tempFolder=imageFolder;
  String sessionId=request.getSession().getId();
  if (sessionId != null)   tempFolder=tempFolder + File.separator + (PREFIX_SUB_IMAGE_FOLDER + sessionId);
  return tempFolder;
}
Program: 73656
Project: 73656
Buggy source:
/** 
 * @param crii
 */
DesignerRepresentation(ChartReportItemImpl crii){
  bRtL=ChartReportItemUtil.isRtl();
  this.crii=crii;
  if (crii != null) {
    cm=(Chart)crii.getProperty(ChartReportItemUtil.PROPERTY_CHART);
    if (ChartReportItemUtil.isChartInXTab(crii.getHandle())) {
      if (!crii.hasHostChart()) {
        cm=ChartReportItemUtil.updateModelToRenderPlot((Chart)EcoreUtil.copy(cm));
      }
 else {
        cm=ChartReportItemUtil.updateModelToRenderAxis((Chart)EcoreUtil.copy(cm));
      }
    }
    if (cm != null) {
      final IDisplayServer idsSWT=ChartUIUtil.getDisplayServer();
      final Bounds bo=cm.getBlock().getBounds().scaledInstance(72d / idsSWT.getDpiResolution());
      setSize((int)bo.getWidth(),(int)bo.getHeight());
    }
 else {
      setSize((int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_WIDTH,(int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_HEIGHT);
    }
  }
 else {
    setSize((int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_WIDTH,(int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_HEIGHT);
  }
  try {
    idr=PluginSettings.instance().getDevice("String_Node_Str");
  }
 catch (  ChartException pex) {
    logger.log(pex);
  }
}

Fixed version (ground truth):
/** 
 * @param crii
 */
DesignerRepresentation(ChartReportItemImpl crii){
  bRtL=ChartReportItemUtil.isRtl();
  this.crii=crii;
  updateChartModelAndSize();
  try {
    idr=PluginSettings.instance().getDevice("String_Node_Str");
  }
 catch (  ChartException pex) {
    logger.log(pex);
  }
}
Program: 73657
Project: 73657
Buggy source:
/** 
 * @param bDirty
 */
final void setDirty(boolean bDirty){
  this.bDirty=bDirty;
}

Fixed version (ground truth):
/** 
 * @param bDirty
 */
final void setDirty(boolean bDirty){
  this.bDirty=bDirty;
  updateChartModelAndSize();
}
Program: 73658
Project: 73658
Buggy source:
private void initHostChart(){
  DesignElementHandle hostChart=handle.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
  if (hostChart instanceof ExtendedItemHandle) {
    cm=ChartReportItemUtil.getChartFromHandle((ExtendedItemHandle)hostChart);
    handle=hostChart;
    hasHostChart=true;
  }
}

Fixed version (ground truth):
private void initHostChart(){
  DesignElementHandle hostChart=handle.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
  if (hostChart instanceof ExtendedItemHandle) {
    cm=ChartReportItemUtil.getChartFromHandle((ExtendedItemHandle)hostChart);
    hostChartHandle=hostChart;
  }
}
Program: 73659
Project: 73659
Buggy source:
/** 
 * Checks if the handle has host chart reference. In xtab cell, there are two types of chart handle. The one is axis chart with host chart, and the other is plot chart without host chart. For the other cases, not in xtab, it's always chart without host chart.
 * @return true for axis chart, false for plot chart or ordinary chart.
 * @since 2.3
 */
public boolean hasHostChart(){
  return this.hasHostChart;
}

Fixed version (ground truth):
/** 
 * Checks if the handle has host chart reference. In xtab cell, there are two types of chart handle. The one is axis chart with host chart, and the other is plot chart without host chart. For the other cases, not in xtab, it's always chart without host chart.
 * @return true for axis chart, false for plot chart or ordinary chart.
 * @since 2.3
 */
public boolean hasHostChart(){
  return hostChartHandle != null;
}
Program: 73660
Project: 73660
Buggy source:
public ByteArrayOutputStream serialize(String propName){
  if (propName != null && propName.equalsIgnoreCase(ChartReportItemUtil.PROPERTY_XMLPRESENTATION)) {
    if (!hasHostChart) {
      try {
        return SerializerImpl.instance().asXml(cm,true);
      }
 catch (      Exception e) {
        logger.log(e);
        return new ByteArrayOutputStream();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public ByteArrayOutputStream serialize(String propName){
  if (propName != null && propName.equalsIgnoreCase(ChartReportItemUtil.PROPERTY_XMLPRESENTATION)) {
    if (!hasHostChart()) {
      try {
        return SerializerImpl.instance().asXml(cm,true);
      }
 catch (      Exception e) {
        logger.log(e);
        return new ByteArrayOutputStream();
      }
    }
  }
  return null;
}
Program: 73661
Project: 73661
Buggy source:
public void setProperty(String propName,Object value){
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{propName,value}));
  executeSetSimplePropertyCommand(handle,propName,getProperty(propName),value);
}

Fixed version (ground truth):
public void setProperty(String propName,Object value){
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{propName,value}));
  executeSetSimplePropertyCommand(handle,propName,getProperty(propName),value);
  if (hasHostChart()) {
    executeSetSimplePropertyCommand(hostChartHandle,propName,getProperty(propName),value);
  }
}
Program: 73662
Project: 73662
Buggy source:
public static String convertBorderWeight(String linestyle){
  String w=StyleConstant.NULL;
  if (linestyle != null && !"String_Node_Str".equalsIgnoreCase(linestyle)) {
    linestyle=ExcelUtil.getValue(linestyle);
    int weight=(int)Double.parseDouble(linestyle);
    if (weight >= 749 && weight < 2249) {
      w="String_Node_Str";
    }
 else     if (weight >= 2249 && weight < 3750) {
      w="String_Node_Str";
    }
 else     if (weight >= 3750) {
      w="String_Node_Str";
    }
 else {
      w="String_Node_Str";
    }
  }
  return w;
}

Fixed version (ground truth):
public static String convertBorderWeight(String linestyle){
  String w=StyleConstant.NULL;
  if (linestyle != null && !"String_Node_Str".equalsIgnoreCase(linestyle)) {
    linestyle=ExcelUtil.getValue(linestyle);
    int weight=(int)Double.parseDouble(linestyle);
    if (weight >= 749 && weight < 1499) {
      w="String_Node_Str";
    }
 else     if (weight >= 1499 && weight < 2249) {
      w="String_Node_Str";
    }
 else     if (weight >= 2249) {
      w="String_Node_Str";
    }
 else {
      w="String_Node_Str";
    }
  }
  return w;
}
Program: 73663
Project: 73663
Buggy source:
public Object getAdapter(Class adapter){
  if (adapter == IDebugElement.class) {
    return this;
  }
 else   if (adapter == IDebugTarget.class) {
    return getDebugTarget();
  }
  return super.getAdapter(adapter);
}

Fixed version (ground truth):
public Object getAdapter(Class adapter){
  if (adapter == IDebugElement.class || adapter == ScriptDebugElement.class) {
    return this;
  }
 else   if (adapter == IDebugTarget.class) {
    return getDebugTarget();
  }
  return super.getAdapter(adapter);
}
Program: 73664
Project: 73664
Buggy source:
public void debugContextChanged(DebugContextEvent event){
  ISelection selection=event.getContext();
  if (selection instanceof IStructuredSelection) {
    IStructuredSelection ss=(IStructuredSelection)selection;
    if (ss.size() == 1) {
      Object element=ss.getFirstElement();
      if (element instanceof IAdaptable) {
        ScriptDebugElement frame=(ScriptDebugElement)((IAdaptable)element).getAdapter(IDebugElement.class);
        if (frame != null) {
          System.setProperty(KEY,"String_Node_Str");
          return;
        }
      }
    }
  }
  System.setProperty(KEY,"String_Node_Str");
}

Fixed version (ground truth):
public void debugContextChanged(DebugContextEvent event){
  ISelection selection=event.getContext();
  if (selection instanceof IStructuredSelection) {
    IStructuredSelection ss=(IStructuredSelection)selection;
    if (ss.size() == 1) {
      Object element=ss.getFirstElement();
      if (element instanceof IAdaptable) {
        ScriptDebugElement frame=(ScriptDebugElement)((IAdaptable)element).getAdapter(ScriptDebugElement.class);
        if (frame != null) {
          System.setProperty(KEY,"String_Node_Str");
          return;
        }
      }
    }
  }
  System.setProperty(KEY,"String_Node_Str");
}
Program: 73665
Project: 73665
Buggy source:
public Object[] findSourceElements(String name) throws CoreException {
  int index=name.lastIndexOf(File.separator);
  String id=name.substring(index + 1);
  String tName=name.substring(0,index);
  ArrayList sources=new ArrayList();
  File directory=getDirectory();
  File file=new File(directory,tName);
  if (file.exists() && file.isFile()) {
    sources.add(new ScriptLocalFileStorage(file,id));
  }
  if (sources.isEmpty())   return EMPTY;
  return sources.toArray();
}

Fixed version (ground truth):
public Object[] findSourceElements(String name) throws CoreException {
  int index=name.lastIndexOf(File.separator);
  if (index < 0) {
    return EMPTY;
  }
  String id=name.substring(index + 1);
  String tName=name.substring(0,index);
  ArrayList sources=new ArrayList();
  File directory=getDirectory();
  File file=new File(directory,tName);
  if (file.exists() && file.isFile()) {
    sources.add(new ScriptLocalFileStorage(file,id));
  }
  if (sources.isEmpty())   return EMPTY;
  return sources.toArray();
}
Program: 73666
Project: 73666
Buggy source:
public void startCell(int cellindex,int colspan,int rowspan,int styleid,HyperlinkDef hyperLink){
  writer.openTag("String_Node_Str");
  writer.attribute("String_Node_Str",cellindex);
  writer.attribute("String_Node_Str",styleid);
  if (hyperLink != null) {
    if (hyperLink.getType() == IHyperlinkAction.ACTION_BOOKMARK) {
      writer.attribute("String_Node_Str","String_Node_Str" + hyperLink.getUrl());
    }
 else {
      writer.attribute("String_Node_Str",hyperLink.getUrl());
    }
  }
  writer.attribute("String_Node_Str",colspan);
  writer.attribute("String_Node_Str",rowspan);
}

Fixed version (ground truth):
public void startCell(int cellindex,int colspan,int rowspan,int styleid,HyperlinkDef hyperLink){
  writer.openTag("String_Node_Str");
  writer.attribute("String_Node_Str",cellindex);
  writer.attribute("String_Node_Str",styleid);
  if (hyperLink != null) {
    String urlAddress=hyperLink.getUrl();
    if (hyperLink.getType() == IHyperlinkAction.ACTION_BOOKMARK) {
      urlAddress="String_Node_Str" + urlAddress;
    }
    if (urlAddress.length() >= 255) {
      urlAddress=urlAddress.substring(0,254);
    }
    writer.attribute("String_Node_Str",urlAddress);
  }
  writer.attribute("String_Node_Str",colspan);
  writer.attribute("String_Node_Str",rowspan);
}
Program: 73667
Project: 73667
Buggy source:
public void writeDataFormat(StyleEntry style){
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.DATE && style.getProperty(StyleConstant.DATE_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",style.getProperty(StyleConstant.DATE_FORMAT_PROP));
    writer.closeTag("String_Node_Str");
  }
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.NUMBER && style.getProperty(StyleConstant.NUMBER_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",style.getProperty(StyleConstant.NUMBER_FORMAT_PROP));
    writer.closeTag("String_Node_Str");
  }
}

Fixed version (ground truth):
public void writeDataFormat(StyleEntry style){
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.DATE && style.getProperty(StyleConstant.DATE_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",style.getProperty(StyleConstant.DATE_FORMAT_PROP));
    writer.closeTag("String_Node_Str");
  }
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.NUMBER && style.getProperty(StyleConstant.NUMBER_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    String numberStyle=style.getProperty(StyleConstant.NUMBER_FORMAT_PROP);
    numberStyle=format(numberStyle);
    writer.attribute("String_Node_Str",numberStyle);
    writer.closeTag("String_Node_Str");
  }
}
Program: 73668
Project: 73668
Buggy source:
private static int getDebugType(){
  String str=System.getProperty(ATTR_DEBUG_TYPE);
  if (str == null) {
    return DEBUG_TYPE_ALL;
  }
  return Integer.parseInt(str);
}

Fixed version (ground truth):
private static int getDebugType(){
  String str=System.getProperty(ATTR_DEBUG_TYPE);
  if (str == null) {
    return DEFAULT_DEBUG_TYPE;
  }
  return Integer.parseInt(str);
}
Program: 73669
Project: 73669
Buggy source:
private static int getTaskType(){
  String str=System.getProperty(ATTR_TASK_TYPE);
  if (str == null) {
    return TASK_TYPE_RUN_PLUS_RENDER;
  }
  return Integer.parseInt(str);
}

Fixed version (ground truth):
private static int getTaskType(){
  String str=System.getProperty(ATTR_TASK_TYPE);
  if (str == null) {
    return DEFAULT_TASK_TYPE;
  }
  return Integer.parseInt(str);
}
Program: 73670
Project: 73670
Buggy source:
public VMVariable[] getVariables(){
  return (VMVariable[])Context.call(new ContextAction(){
    public Object run(    Context arg0){
      try {
        return getVariablesImpl(arg0);
      }
 catch (      Exception e) {
        StringWriter sw=new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        return new VMVariable[]{new JsVariable(sw.toString(),ERROR_LITERAL)};
      }
    }
  }
);
}

Fixed version (ground truth):
public VMVariable[] getVariables(){
  return (VMVariable[])Context.call(new ContextAction(){
    public Object run(    Context arg0){
      try {
        return getVariablesImpl(arg0);
      }
 catch (      Exception e) {
        StringWriter sw=new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        return new VMVariable[]{new JsVariable(sw.toString(),ERROR_LITERAL,EXCEPTION_TYPE)};
      }
    }
  }
);
}
Program: 73671
Project: 73671
Buggy source:
public Object run(Context arg0){
  try {
    return getVariablesImpl(arg0);
  }
 catch (  Exception e) {
    StringWriter sw=new StringWriter();
    e.printStackTrace(new PrintWriter(sw));
    return new VMVariable[]{new JsVariable(sw.toString(),ERROR_LITERAL)};
  }
}

Fixed version (ground truth):
public Object run(Context arg0){
  try {
    return getVariablesImpl(arg0);
  }
 catch (  Exception e) {
    StringWriter sw=new StringWriter();
    e.printStackTrace(new PrintWriter(sw));
    return new VMVariable[]{new JsVariable(sw.toString(),ERROR_LITERAL,EXCEPTION_TYPE)};
  }
}
Program: 73672
Project: 73672
Buggy source:
public synchronized VMValue evaluate(String expression){
  int currentState=debugger.currentState();
  if (currentState == VM_TERMINATED) {
    return null;
  }
  JsValue result=null;
  Debugger oldDebugger=cx.getDebugger();
  Object oldContextData=cx.getDebuggerContextData();
  int oldLevel=cx.getOptimizationLevel();
  cx.setDebugger(null,null);
  cx.setOptimizationLevel(-1);
  cx.setGeneratingDebug(false);
  try {
    Callable script=(Callable)cx.compileString(expression,EVALUATOR_LITERAL,0,null);
    Object val=script.call(cx,scope,thisObj,ScriptRuntime.emptyArgs);
    if (val == Undefined.instance) {
      result=new JsValue(UNDEFINED_LITERAL);
    }
 else {
      result=new JsValue(val);
    }
  }
 catch (  Exception ex) {
    result=new JsValue(ex.getMessage());
  }
 finally {
    cx.setGeneratingDebug(true);
    cx.setOptimizationLevel(oldLevel);
    cx.setDebugger(oldDebugger,oldContextData);
  }
  return result;
}

Fixed version (ground truth):
public synchronized VMValue evaluate(String expression){
  int currentState=debugger.currentState();
  if (currentState == VM_TERMINATED) {
    return null;
  }
  JsValue result=null;
  Debugger oldDebugger=cx.getDebugger();
  Object oldContextData=cx.getDebuggerContextData();
  int oldLevel=cx.getOptimizationLevel();
  cx.setDebugger(null,null);
  cx.setOptimizationLevel(-1);
  cx.setGeneratingDebug(false);
  try {
    Callable script=(Callable)cx.compileString(expression,EVALUATOR_LITERAL,0,null);
    Object val=script.call(cx,scope,thisObj,ScriptRuntime.emptyArgs);
    if (val == Undefined.instance) {
      result=new JsValue(UNDEFINED_LITERAL,UNDEFINED_TYPE);
    }
 else {
      result=new JsValue(val);
    }
  }
 catch (  Exception ex) {
    result=new JsValue(ex.getMessage(),EXCEPTION_TYPE);
  }
 finally {
    cx.setGeneratingDebug(true);
    cx.setOptimizationLevel(oldLevel);
    cx.setDebugger(oldDebugger,oldContextData);
  }
  return result;
}
Program: 73673
Project: 73673
Buggy source:
public Object run(Context arg0){
  try {
    return getMembersImpl(arg0);
  }
 catch (  Exception e) {
    StringWriter sw=new StringWriter();
    e.printStackTrace(new PrintWriter(sw));
    return new VMVariable[]{new JsVariable(sw.toString(),ERROR_LITERAL)};
  }
}

Fixed version (ground truth):
public Object run(Context arg0){
  try {
    return getMembersImpl(arg0);
  }
 catch (  Exception e) {
    StringWriter sw=new StringWriter();
    e.printStackTrace(new PrintWriter(sw));
    return new VMVariable[]{new JsVariable(sw.toString(),ERROR_LITERAL,EXCEPTION_TYPE)};
  }
}
Program: 73674
Project: 73674
Buggy source:
public int hashCode(){
  if (value == null) {
    return Boolean.valueOf(isPrimitive).hashCode();
  }
  return value.hashCode() ^ Boolean.valueOf(isPrimitive).hashCode();
}

Fixed version (ground truth):
public int hashCode(){
  int hash=Boolean.valueOf(isPrimitive).hashCode();
  if (value != null) {
    hash^=value.hashCode();
  }
  if (reservedValueType != null) {
    hash^=reservedValueType.hashCode();
  }
  return hash;
}
Program: 73675
Project: 73675
Buggy source:
public boolean equals(Object obj){
  if (!(obj instanceof JsValue)) {
    return false;
  }
  JsValue that=(JsValue)obj;
  if (this.isPrimitive != that.isPrimitive) {
    return false;
  }
  if (this.value == null) {
    return that.value == null;
  }
 else {
    return this.value.equals(that.value);
  }
}

Fixed version (ground truth):
public boolean equals(Object obj){
  if (!(obj instanceof JsValue)) {
    return false;
  }
  JsValue that=(JsValue)obj;
  if (this.isPrimitive != that.isPrimitive) {
    return false;
  }
  if (this.value == null) {
    if (that.value != null) {
      return false;
    }
  }
 else {
    if (!this.value.equals(that.value)) {
      return false;
    }
  }
  if (this.reservedValueType == null) {
    return that.reservedValueType == null;
  }
 else {
    return this.reservedValueType.equals(that.reservedValueType);
  }
}