nus-yam/ex-repair huggingface dataset:
Program: 71639
Project: 71639
Buggy source:
private Object getParameterObject(String key,String value){
  ParameterHandle temp=findParameter(key);
  if (temp instanceof ScalarParameterHandle) {
    ScalarParameterHandle handle=(ScalarParameterHandle)temp;
    String formate=handle.getPattern();
    String dataType=handle.getDataType();
    try {
      if (DesignChoiceConstants.PARAM_TYPE_DATE.equalsIgnoreCase(dataType)) {
        return doValidateSqlDateTimeByPattern(value);
      }
 else       if (DesignChoiceConstants.PARAM_TYPE_TIME.equalsIgnoreCase(dataType)) {
        return doValidateTimeDateTimeByPattern(value);
      }
 else       if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equalsIgnoreCase(dataType)) {
        return doValidateDateTimeByPattern(value);
      }
    }
 catch (    ValidationValueException e) {
      return value;
    }
    try {
      return convert(value,dataType);
    }
 catch (    BirtException e) {
      return value;
    }
  }
 else {
    return value;
  }
}

Fixed version (ground truth):
private Object getParameterObject(String key,String value){
  ParameterHandle temp=findParameter(key);
  if (temp instanceof ScalarParameterHandle) {
    ScalarParameterHandle handle=(ScalarParameterHandle)temp;
    String formate=handle.getPattern();
    String dataType=handle.getDataType();
    try {
      if (DesignChoiceConstants.PARAM_TYPE_DATE.equalsIgnoreCase(dataType)) {
        return doValidateSqlDateTimeByPattern(value,dataType);
      }
 else       if (DesignChoiceConstants.PARAM_TYPE_TIME.equalsIgnoreCase(dataType)) {
        return doValidateTimeDateTimeByPattern(value,dataType);
      }
 else       if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equalsIgnoreCase(dataType)) {
        return doValidateDateTimeByPattern(value,dataType);
      }
    }
 catch (    ValidationValueException e) {
      return value;
    }
    try {
      return convert(value,dataType);
    }
 catch (    BirtException e) {
      return value;
    }
  }
 else {
    return value;
  }
}
Program: 71640
Project: 71640
Buggy source:
static private java.sql.Time doValidateTimeDateTimeByPattern(String value) throws ValidationValueException {
  try {
    long time=Long.parseLong(value);
    return new java.sql.Time(time);
  }
 catch (  Exception e) {
    throw new ValidationValueException(value,PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE,DesignChoiceConstants.PARAM_TYPE_DATETIME);
  }
}

Fixed version (ground truth):
static private java.sql.Time doValidateTimeDateTimeByPattern(String value,String dataType) throws ValidationValueException {
  try {
    long time=Long.parseLong(value);
    return new java.sql.Time(time);
  }
 catch (  Exception e) {
    Object obj=null;
    try {
      obj=convert(value,dataType);
    }
 catch (    BirtException e1) {
    }
    if (obj instanceof java.sql.Time) {
      return (java.sql.Time)obj;
    }
    throw new ValidationValueException(value,PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE,DesignChoiceConstants.PARAM_TYPE_DATETIME);
  }
}
Program: 71641
Project: 71641
Buggy source:
private Date doValidateDateTimeByPattern(String value) throws ValidationValueException {
  try {
    long time=Long.parseLong(value);
    return new Date(time);
  }
 catch (  Exception e) {
    throw new ValidationValueException(value,PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE,DesignChoiceConstants.PARAM_TYPE_DATETIME);
  }
}

Fixed version (ground truth):
private Date doValidateDateTimeByPattern(String value,String dataType) throws ValidationValueException {
  try {
    long time=Long.parseLong(value);
    return new Date(time);
  }
 catch (  Exception e) {
    Object obj=null;
    try {
      obj=convert(value,dataType);
    }
 catch (    BirtException e1) {
    }
    if (obj instanceof Date) {
      return (Date)obj;
    }
    throw new ValidationValueException(value,PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE,DesignChoiceConstants.PARAM_TYPE_DATETIME);
  }
}
Program: 71642
Project: 71642
Buggy source:
public HashMap getExpressions(){
  if (text == null) {
    return null;
  }
  if (exprs != null) {
    return exprs;
  }
  if (HTML_TEXT.equals(textType) || (AUTO_TEXT.equals(textType) && text.startsWith("String_Node_Str"))) {
    exprs=new HashMap();
    TextTemplate template=new TemplateParser().parse(text);
    if (template != null && template.getNodes() != null) {
      Iterator itor=template.getNodes().iterator();
      Object obj;
      String expression=null;
      while (itor.hasNext()) {
        obj=itor.next();
        if (obj instanceof TextTemplate.ValueNode) {
          expression=((TextTemplate.ValueNode)obj).getValue();
        }
 else         if (obj instanceof TextTemplate.ImageNode) {
          expression=((TextTemplate.ImageNode)obj).getExpr();
        }
        if (expression != null && !expression.trim().equals("String_Node_Str")) {
          exprs.put(expression,expression);
          expression=null;
        }
      }
    }
  }
  return exprs;
}

Fixed version (ground truth):
public HashMap getExpressions(){
  if (text == null) {
    return null;
  }
  if (exprs != null) {
    return exprs;
  }
  if (HTML_TEXT.equals(textType) || (AUTO_TEXT.equals(textType) && (text.substring(0,6).equalsIgnoreCase("String_Node_Str")))) {
    exprs=new HashMap();
    TextTemplate template=new TemplateParser().parse(text);
    if (template != null && template.getNodes() != null) {
      Iterator itor=template.getNodes().iterator();
      Object obj;
      String expression=null;
      while (itor.hasNext()) {
        obj=itor.next();
        if (obj instanceof TextTemplate.ValueNode) {
          expression=((TextTemplate.ValueNode)obj).getValue();
        }
 else         if (obj instanceof TextTemplate.ImageNode) {
          expression=((TextTemplate.ImageNode)obj).getExpr();
        }
        if (expression != null && !expression.trim().equals("String_Node_Str")) {
          exprs.put(expression,expression);
          expression=null;
        }
      }
    }
  }
  return exprs;
}
Program: 71644
Project: 71644
Buggy source:
private String getTextToInsert(){
  TreeItem[] selection=availableDbObjectsTree.getSelection();
  StringBuffer data=new StringBuffer();
  if (selection != null && selection.length > 0) {
    for (int i=0; i < selection.length; i++) {
      IDBNode dbNode=(IDBNode)selection[i].getData();
      String sql=dbNode.getQualifiedNameInSQL(identifierQuoteStringCheckBox.getSelection());
      if (sql != null) {
        data.append(sql).append("String_Node_Str");
      }
    }
  }
  String result=data.toString();
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  return result;
}

Fixed version (ground truth):
private String getTextToInsert(){
  TreeItem[] selection=availableDbObjectsTree.getSelection();
  StringBuffer data=new StringBuffer();
  if (selection != null && selection.length > 0) {
    for (int i=0; i < selection.length; i++) {
      IDBNode dbNode=(IDBNode)selection[i].getData();
      String sql=dbNode.getQualifiedNameInSQL(identifierQuoteStringCheckBox.getSelection(),includeSchemaCheckBox.getSelection());
      if (sql != null) {
        data.append(sql).append("String_Node_Str");
      }
    }
  }
  String result=data.toString();
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  return result;
}
Program: 71645
Project: 71645
Buggy source:
/** 
 * @param useIdentifierQuoteString: whether use identifier quote string when populating qualified name
 * @return the full qualified name in a SQL text.<p>null if it can't be a part of SQL text.
 */
String getQualifiedNameInSQL(boolean useIdentifierQuoteString);

Fixed version (ground truth):
/** 
 * @param useIdentifierQuoteString: whether use identifier quote string when populating qualified name
 * @return the full qualified name in a SQL text.<p>null if it can't be a part of SQL text.
 */
String getQualifiedNameInSQL(boolean useIdentifierQuoteString,boolean includeSchema);
Program: 71646
Project: 71646
Buggy source:
/** 
 * can't be part of a SQL text
 */
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString){
  return null;
}

Fixed version (ground truth):
/** 
 * can't be part of a SQL text
 */
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString,boolean includeSchema){
  return null;
}
Program: 71647
Project: 71647
Buggy source:
/** 
 * Just a flag node, can't be part of a SQL text
 */
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString){
  return null;
}

Fixed version (ground truth):
/** 
 * Just a flag node, can't be part of a SQL text
 */
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString,boolean includeSchema){
  return null;
}
Program: 71648
Project: 71648
Buggy source:
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString){
  StringBuffer sb=new StringBuffer();
  String quoteFlag="String_Node_Str";
  if (useIdentifierQuoteString) {
    quoteFlag=JdbcMetaDataProvider.getInstance().getIdentifierQuoteString();
  }
  if (schemaName != null) {
    sb.append(Utility.quoteString(schemaName,quoteFlag)).append("String_Node_Str");
  }
  sb.append(Utility.quoteString(procedureName,quoteFlag));
  return sb.toString();
}

Fixed version (ground truth):
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString,boolean includeSchema){
  StringBuffer sb=new StringBuffer();
  String quoteFlag="String_Node_Str";
  if (useIdentifierQuoteString) {
    quoteFlag=JdbcMetaDataProvider.getInstance().getIdentifierQuoteString();
  }
  if (includeSchema && schemaName != null) {
    sb.append(Utility.quoteString(schemaName,quoteFlag)).append("String_Node_Str");
  }
  sb.append(Utility.quoteString(procedureName,quoteFlag));
  return sb.toString();
}
Program: 71649
Project: 71649
Buggy source:
/** 
 * Can't be a part of SQL text
 */
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString){
  return null;
}

Fixed version (ground truth):
/** 
 * Can't be a part of SQL text
 */
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString,boolean includeSchema){
  return null;
}
Program: 71650
Project: 71650
Buggy source:
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString){
  String quoteFlag="String_Node_Str";
  if (useIdentifierQuoteString) {
    quoteFlag=JdbcMetaDataProvider.getInstance().getIdentifierQuoteString();
  }
  return Utility.quoteString(schemaName,quoteFlag);
}

Fixed version (ground truth):
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString,boolean includeSchema){
  String quoteFlag="String_Node_Str";
  if (useIdentifierQuoteString) {
    quoteFlag=JdbcMetaDataProvider.getInstance().getIdentifierQuoteString();
  }
  return Utility.quoteString(schemaName,quoteFlag);
}
Program: 71651
Project: 71651
Buggy source:
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString){
  StringBuffer sb=new StringBuffer();
  String quoteFlag="String_Node_Str";
  if (useIdentifierQuoteString) {
    quoteFlag=JdbcMetaDataProvider.getInstance().getIdentifierQuoteString();
  }
  if (schemaName != null) {
    sb.append(Utility.quoteString(schemaName,quoteFlag)).append("String_Node_Str");
  }
  sb.append(Utility.quoteString(tableName,quoteFlag));
  return sb.toString();
}

Fixed version (ground truth):
public String getQualifiedNameInSQL(boolean useIdentifierQuoteString,boolean includeSchema){
  StringBuffer sb=new StringBuffer();
  String quoteFlag="String_Node_Str";
  if (useIdentifierQuoteString) {
    quoteFlag=JdbcMetaDataProvider.getInstance().getIdentifierQuoteString();
  }
  if (includeSchema && schemaName != null) {
    sb.append(Utility.quoteString(schemaName,quoteFlag)).append("String_Node_Str");
  }
  sb.append(Utility.quoteString(tableName,quoteFlag));
  return sb.toString();
}
Program: 71652
Project: 71652
Buggy source:
public void openPage(INode[] nodeList){
  currentBuffer.openPage(nodeList);
}

Fixed version (ground truth):
public void openPage(INode[] nodeList){
  currentBuffer.openPage(nodeList);
  nestCount++;
}
Program: 71654
Project: 71654
Buggy source:
public void closePage(INode[] nodeList){
  currentBuffer.closePage(nodeList);
}

Fixed version (ground truth):
public void closePage(INode[] nodeList){
  currentBuffer.closePage(nodeList);
  nestCount--;
}
Program: 71657
Project: 71657
Buggy source:
/** 
 * Set the separator of the concatenated string
 * @param source
 * @throws BirtException
 */
private void setSeparator(Object source) throws BirtException {
  String value=DataTypeUtil.toString(source);
  if (value == null || value.trim().length() > 1) {
    throw new DataException(Messages.getString("String_Node_Str") + getName());
  }
  separator=value.trim();
}

Fixed version (ground truth):
/** 
 * Set the separator of the concatenated string
 * @param source
 * @throws BirtException
 */
private void setSeparator(Object source) throws BirtException {
  String value=DataTypeUtil.toString(source);
  if (value == null || value.length() == 0) {
    throw new DataException(Messages.getString("String_Node_Str") + getName());
  }
  separator=value;
}
Program: 71659
Project: 71659
Buggy source:
protected void adjustGridLayout(){
  super.adjustGridLayout();
  ((GridData)verticalAlign.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)textAlign.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)textTrans.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)whiteSpace.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)display.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  if (direction != null)   ((GridData)direction.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
}

Fixed version (ground truth):
protected void adjustGridLayout(){
  super.adjustGridLayout();
  ((GridData)verticalAlign.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)textAlign.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)textTrans.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)whiteSpace.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)display.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
  ((GridData)direction.getComboBoxControl(getFieldEditorParent()).getLayoutData()).widthHint=167;
}
Program: 71660
Project: 71660
Buggy source:
/** 
 * Calculates the spacing by given container width, text width and horizontal alignment style.
 * @param compWidth Container width.
 * @param textWidth Text width.
 * @return
 * @author bidi_hcg
 */
protected int calculateSpacing(int compWidth,int textWidth){
  int rlt=0;
  String align=BidiAlignmentResolver.resolveAlignment(textAlign,isMirrored());
  if (align == null) {
    if (getDirection() != null) {
      if (getDirection().equals(DesignChoiceConstants.BIDI_DIRECTION_LTR) && isMirrored()) {
        align=DesignChoiceConstants.TEXT_ALIGN_RIGHT;
      }
 else       if (getDirection().equals(DesignChoiceConstants.BIDI_DIRECTION_RTL) && !isMirrored()) {
        align=DesignChoiceConstants.TEXT_ALIGN_RIGHT;
      }
    }
 else {
      if (isMirrored()) {
        align=DesignChoiceConstants.TEXT_ALIGN_RIGHT;
      }
 else {
        align=DesignChoiceConstants.TEXT_ALIGN_LEFT;
      }
    }
  }
  if (DesignChoiceConstants.TEXT_ALIGN_LEFT.equals(align) || DesignChoiceConstants.TEXT_ALIGN_JUSTIFY.equals(align)) {
    rlt=0;
  }
 else   if (DesignChoiceConstants.TEXT_ALIGN_CENTER.equals(align)) {
    rlt=(compWidth - textWidth) / 2;
  }
 else   if (DesignChoiceConstants.TEXT_ALIGN_RIGHT.equals(align)) {
    rlt=(compWidth - textWidth);
  }
  return rlt;
}

Fixed version (ground truth):
/** 
 * Calculates the spacing by given container width, text width and horizontal alignment style.
 * @param compWidth Container width.
 * @param textWidth Text width.
 * @return
 * @author bidi_hcg
 */
protected int calculateSpacing(int compWidth,int textWidth){
  int rlt=0;
  String align=BidiAlignmentResolver.resolveAlignmentForDesigner(textAlign,getDirection(),isMirrored());
  if (DesignChoiceConstants.TEXT_ALIGN_LEFT.equals(align)) {
    rlt=0;
  }
 else   if (DesignChoiceConstants.TEXT_ALIGN_CENTER.equals(align)) {
    rlt=(compWidth - textWidth) / 2;
  }
 else   if (DesignChoiceConstants.TEXT_ALIGN_RIGHT.equals(align)) {
    rlt=(compWidth - textWidth);
  }
  return rlt;
}
Program: 71661
Project: 71661
Buggy source:
/** 
 * @param style
 * @return A new CellEditor style
 * @author bidi_hcg
 */
private int applyBidiStyle(int style){
  boolean rtl=DesignChoiceConstants.BIDI_DIRECTION_RTL.equals(((LabelFigure)getEditPart().getFigure()).getDirection());
  style|=(rtl ? SWT.RIGHT_TO_LEFT : SWT.LEFT_TO_RIGHT);
  String align=((LabelFigure)getEditPart().getFigure()).getTextAlign();
  if (align == null) {
    String direction=((LabelFigure)getEditPart().getFigure()).getDirection();
    boolean isMirrored=getEditPart().getFigure().isMirrored();
    if (direction != null) {
      if (direction.equals(DesignChoiceConstants.BIDI_DIRECTION_LTR) && isMirrored) {
        align=DesignChoiceConstants.TEXT_ALIGN_LEFT;
      }
 else       if (direction.equals(DesignChoiceConstants.BIDI_DIRECTION_RTL) && !isMirrored) {
        align=DesignChoiceConstants.TEXT_ALIGN_RIGHT;
      }
    }
 else {
      if (isMirrored) {
        align=DesignChoiceConstants.TEXT_ALIGN_RIGHT;
      }
 else {
        align=DesignChoiceConstants.TEXT_ALIGN_LEFT;
      }
    }
  }
  if (IStyle.CSS_CENTER_VALUE.equals(align))   style|=SWT.CENTER;
 else   if (IStyle.CSS_RIGHT_VALUE.equals(align))   style|=(rtl ? SWT.LEFT : SWT.RIGHT);
 else   if (IStyle.CSS_LEFT_VALUE.equals(align))   style|=(rtl ? SWT.RIGHT : SWT.LEFT);
 else {
    boolean mirrored=getEditPart().getFigure().isMirrored();
    style|=(mirrored ^ rtl ? SWT.RIGHT : SWT.LEFT);
  }
  return style;
}

Fixed version (ground truth):
/** 
 * @param style
 * @return A new CellEditor style
 * @author bidi_hcg
 */
private int applyBidiStyle(int style){
  LabelFigure figure=(LabelFigure)getEditPart().getFigure();
  boolean rtl=DesignChoiceConstants.BIDI_DIRECTION_RTL.equals(figure.getDirection());
  style|=(rtl ? SWT.RIGHT_TO_LEFT : SWT.LEFT_TO_RIGHT);
  String align=figure.getTextAlign();
  if (IStyle.CSS_CENTER_VALUE.equals(align))   style|=SWT.CENTER;
 else   if (IStyle.CSS_RIGHT_VALUE.equals(align))   style|=(rtl ? SWT.LEFT : SWT.RIGHT);
 else   if (IStyle.CSS_LEFT_VALUE.equals(align))   style|=(rtl ? SWT.RIGHT : SWT.LEFT);
 else   style|=SWT.LEFT;
  return style;
}
Program: 71662
Project: 71662
Buggy source:
public Image loadImage(URL url,boolean refresh) throws IOException {
  String key=url.toString();
  Image image=null;
  if (refresh) {
    image=getImageRegistry().get(key);
    if (image != null) {
      return image;
    }
  }
  InputStream in=null;
  try {
    if (url.toString().toLowerCase().endsWith("String_Node_Str")) {
      JPEGTranscoder transcoder=new JPEGTranscoder();
      transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new Float(.8));
      String svgURI=url.toString();
      TranscoderInput input=new TranscoderInput(svgURI);
      ByteArrayOutputStream ostream=new ByteArrayOutputStream();
      TranscoderOutput output=new TranscoderOutput(ostream);
      try {
        transcoder.transcode(input,output);
      }
 catch (      TranscoderException e) {
      }
      ostream.flush();
      in=new ByteArrayInputStream(ostream.toByteArray());
    }
 else {
      in=url.openStream();
    }
    image=new Image(null,in);
  }
 catch (  IOException e) {
    throw e;
  }
 finally {
    if (in != null) {
      in.close();
    }
  }
  if (image != null) {
    getImageRegistry().remove(key);
    getImageRegistry().put(key,image);
  }
  return image;
}

Fixed version (ground truth):
public Image loadImage(URL url,boolean refresh) throws IOException {
  String key=url.toString();
  Image image=null;
  if (!refresh) {
    image=getImageRegistry().get(key);
    if (image != null) {
      return image;
    }
  }
  InputStream in=null;
  try {
    if (url.toString().toLowerCase().endsWith("String_Node_Str")) {
      JPEGTranscoder transcoder=new JPEGTranscoder();
      transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new Float(.8));
      String svgURI=url.toString();
      TranscoderInput input=new TranscoderInput(svgURI);
      ByteArrayOutputStream ostream=new ByteArrayOutputStream();
      TranscoderOutput output=new TranscoderOutput(ostream);
      try {
        transcoder.transcode(input,output);
      }
 catch (      TranscoderException e) {
      }
      ostream.flush();
      in=new ByteArrayInputStream(ostream.toByteArray());
    }
 else {
      in=url.openStream();
    }
    image=new Image(null,in);
  }
 catch (  IOException e) {
    throw e;
  }
 finally {
    if (in != null) {
      in.close();
    }
  }
  if (image != null) {
    getImageRegistry().remove(key);
    getImageRegistry().put(key,image);
  }
  return image;
}
Program: 71663
Project: 71663
Buggy source:
protected void closeLayout(ContainerContext currentContext,int index,boolean finished){
  if (currentContext.root != null) {
    boolean added=false;
    if (unresolvedRow != null) {
      TableContext tc=(TableContext)(tbl.contextList.get(index));
      tc.layout.setUnresolvedRow(unresolvedRow);
    }
    tbl.updateRow((RowArea)currentContext.root,specifiedHeight,index);
    if (finished || !isRowEmpty(currentContext)) {
      tbl.addRow((RowArea)currentContext.root,index);
      parent.addToRoot(currentContext.root,index);
      added=true;
    }
    if (!finished && unresolvedRow == null) {
      TableContext tc=(TableContext)(tbl.contextList.get(index));
      if (added) {
        unresolvedRow=tc.layout.getUnresolvedRow();
      }
 else {
        unresolvedRow=tc.layout.getUnresolvedRow((RowArea)currentContext.root);
      }
    }
  }
}

Fixed version (ground truth):
protected void closeLayout(ContainerContext currentContext,int index,boolean finished){
  if (currentContext.root != null) {
    if (unresolvedRow != null) {
      TableContext tc=(TableContext)(tbl.contextList.get(index));
      tc.layout.setUnresolvedRow(unresolvedRow);
    }
    tbl.updateRow((RowArea)currentContext.root,specifiedHeight,index);
    if (finished || !isRowEmpty(currentContext)) {
      tbl.addRow((RowArea)currentContext.root,index);
      parent.addToRoot(currentContext.root,index);
    }
    if (!finished && unresolvedRow == null) {
      TableContext tc=(TableContext)(tbl.contextList.get(index));
      unresolvedRow=tc.layout.getUnresolvedRow();
    }
  }
}
Program: 71664
Project: 71664
Buggy source:
/** 
 * Judge needing implement the align table or not. The align table should be align according to the page box.
 * @param table
 * @return
 */
protected boolean needImplementAlignTable(ITableContent table){
  if (report.getRoot() == table.getParent()) {
    DimensionType width=table.getWidth();
    if (null != width && !"String_Node_Str".equals(width.toString())) {
      IStyle style=table.getStyle();
      CSSValue display=style.getProperty(IStyle.STYLE_DISPLAY);
      if (null == display || IStyle.BLOCK_VALUE == display) {
        CSSValue align=style.getProperty(IStyle.STYLE_TEXT_ALIGN);
        if (IStyle.CENTER_VALUE.equals(align)) {
          return true;
        }
        CSSValue direction=style.getProperty(IStyle.STYLE_DIRECTION);
        if (IStyle.RTL_VALUE.equals(direction)) {
          if (IStyle.LEFT_VALUE.equals(align)) {
            return true;
          }
        }
 else         if (IStyle.RIGHT_VALUE == align) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Judge needing implement the align table or not. The align table should be align according to the page box.
 * @param table
 * @return
 */
protected boolean needImplementAlignTable(ITableContent table){
  if (report.getRoot() == table.getParent()) {
    DimensionType width=table.getWidth();
    if (null != width && !"String_Node_Str".equals(width.toString())) {
      IStyle style=table.getStyle();
      CSSValue display=style.getProperty(IStyle.STYLE_DISPLAY);
      if (null == display || IStyle.BLOCK_VALUE == display) {
        CSSValue align=style.getProperty(IStyle.STYLE_TEXT_ALIGN);
        if (IStyle.CENTER_VALUE.equals(align)) {
          return true;
        }
        CSSValue direction=style.getProperty(IStyle.STYLE_DIRECTION);
        if (IStyle.RTL_VALUE.equals(direction)) {
          if (!IStyle.RIGHT_VALUE.equals(align)) {
            return true;
          }
        }
 else         if (IStyle.RIGHT_VALUE == align) {
          return true;
        }
      }
    }
  }
  return false;
}
Program: 71667
Project: 71667
Buggy source:
public static String convertHAlign(String align){
  String ha="String_Node_Str";
  align=ExcelUtil.getValue(align);
  if ("String_Node_Str".equalsIgnoreCase(align)) {
    ha="String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(align)) {
    ha="String_Node_Str";
  }
  return ha;
}

Fixed version (ground truth):
public static String convertHAlign(String align,String direction){
  String ha=null;
  align=ExcelUtil.getValue(align);
  if ("String_Node_Str".equalsIgnoreCase(align)) {
    ha="String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(align)) {
    ha="String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(align)) {
    ha="String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(direction))   ha="String_Node_Str";
 else   ha="String_Node_Str";
  return ha;
}
Program: 71668
Project: 71668
Buggy source:
protected void align(boolean lastLine){
  if (root == null) {
    return;
  }
  assert(parent instanceof PDFBlockStackingLM);
  String align=((PDFBlockStackingLM)parent).getTextAlign();
  if ((CSSConstants.CSS_RIGHT_VALUE.equalsIgnoreCase(align) || CSSConstants.CSS_CENTER_VALUE.equalsIgnoreCase(align))) {
    int spacing=root.getContentWidth() - getCurrentIP();
    Iterator iter=root.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      if (spacing > 0) {
        if (CSSConstants.CSS_RIGHT_VALUE.equalsIgnoreCase(align)) {
          area.setAllocatedPosition(spacing + area.getAllocatedX(),area.getAllocatedY());
        }
 else         if (CSSConstants.CSS_CENTER_VALUE.equalsIgnoreCase(align)) {
          area.setAllocatedPosition(spacing / 2 + area.getAllocatedX(),area.getAllocatedY());
        }
      }
    }
  }
 else   if (CSSConstants.CSS_JUSTIFY_VALUE.equalsIgnoreCase(align) && !lastLine) {
    justify();
  }
  verticalAlign();
}

Fixed version (ground truth):
protected void align(boolean lastLine){
  if (root == null) {
    return;
  }
  assert(parent instanceof PDFBlockStackingLM);
  String align=((PDFBlockStackingLM)parent).getTextAlign();
  boolean isRightAligned=BidiAlignmentResolver.isRightAligned(root.getContent(),align,lastLine);
  if (isRightAligned || CSSConstants.CSS_CENTER_VALUE.equalsIgnoreCase(align)) {
    int spacing=root.getContentWidth() - getCurrentIP();
    Iterator iter=root.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      if (spacing > 0) {
        if (isRightAligned) {
          area.setAllocatedPosition(spacing + area.getAllocatedX(),area.getAllocatedY());
        }
 else         if (CSSConstants.CSS_CENTER_VALUE.equalsIgnoreCase(align)) {
          area.setAllocatedPosition(spacing / 2 + area.getAllocatedX(),area.getAllocatedY());
        }
      }
    }
  }
 else   if (CSSConstants.CSS_JUSTIFY_VALUE.equalsIgnoreCase(align) && !lastLine) {
    justify();
  }
  verticalAlign();
}
Program: 71670
Project: 71670
Buggy source:
protected void align(ContainerContext currentContext,boolean lastLine){
  assert(parent instanceof BlockStackingLayout);
  String align=((BlockStackingLayout)parent).getTextAlign();
  if ((CSSConstants.CSS_RIGHT_VALUE.equalsIgnoreCase(align) || CSSConstants.CSS_CENTER_VALUE.equalsIgnoreCase(align))) {
    int spacing=currentContext.root.getWidth() - currentContext.currentIP;
    Iterator iter=currentContext.root.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      if (spacing > 0) {
        if (CSSConstants.CSS_RIGHT_VALUE.equalsIgnoreCase(align)) {
          area.setAllocatedPosition(spacing + area.getAllocatedX(),area.getAllocatedY());
        }
 else         if (CSSConstants.CSS_CENTER_VALUE.equalsIgnoreCase(align)) {
          area.setAllocatedPosition(spacing / 2 + area.getAllocatedX(),area.getAllocatedY());
        }
      }
    }
  }
 else   if (CSSConstants.CSS_JUSTIFY_VALUE.equalsIgnoreCase(align) && !lastLine) {
    justify(currentContext);
  }
  if (context.getBidiProcessing())   reorderVisually();
  verticalAlign();
}

Fixed version (ground truth):
protected void align(ContainerContext currentContext,boolean lastLine){
  assert(parent instanceof BlockStackingLayout);
  String align=((BlockStackingLayout)parent).getTextAlign();
  boolean isRightAligned=BidiAlignmentResolver.isRightAligned(((BlockStackingLayout)parent).content,align,lastLine);
  if ((isRightAligned || CSSConstants.CSS_CENTER_VALUE.equalsIgnoreCase(align))) {
    int spacing=currentContext.root.getWidth() - currentContext.currentIP;
    Iterator iter=currentContext.root.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      if (spacing > 0) {
        if (isRightAligned) {
          area.setAllocatedPosition(spacing + area.getAllocatedX(),area.getAllocatedY());
        }
 else         if (CSSConstants.CSS_CENTER_VALUE.equalsIgnoreCase(align)) {
          area.setAllocatedPosition(spacing / 2 + area.getAllocatedX(),area.getAllocatedY());
        }
      }
    }
  }
 else   if (CSSConstants.CSS_JUSTIFY_VALUE.equalsIgnoreCase(align) && !lastLine) {
    justify(currentContext);
  }
  if (context.getBidiProcessing())   reorderVisually();
  verticalAlign();
}
Program: 71673
Project: 71673
Buggy source:
private String getFontName(BaseFont baseFont){
  String[][] familyFontNames=baseFont.getFamilyFontName();
  String[] family=familyFontNames[0];
  String fontName=family[family.length - 1];
  return fontName;
}

Fixed version (ground truth):
private String getFontName(BaseFont baseFont){
  String[][] familyFontNames=baseFont.getFamilyFontName();
  String[] family=familyFontNames[familyFontNames.length - 1];
  return family[family.length - 1];
}
Program: 71676
Project: 71676
Buggy source:
/** 
 * @throws BirtException
 */
public void testUseAppContextCacheRowLimit3() throws BirtException, Exception {
  this.dataSet.setCacheRowCount(100);
  DataEngineContext dec=DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null);
  dec.setTmpdir(this.getTempDir());
  myDataEngine=(DataEngineImpl)DataEngine.newDataEngine(dec);
  myDataEngine.defineDataSource(this.dataSource);
  myDataEngine.defineDataSet(this.dataSet);
  this.appContextMap.put(DataEngine.DATA_SET_CACHE_ROW_LIMIT,new Integer(4));
  this.testUseCache1();
}

Fixed version (ground truth):
/** 
 * @throws BirtException
 */
public void testUseAppContextCacheRowLimit3() throws BirtException, Exception {
  this.dataSet.setCacheRowCount(100);
  this.dataSet.setBeforeOpenScript("String_Node_Str");
  this.dataSet.setOnFetchScript("String_Node_Str");
  DataEngineContext dec=DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null);
  dec.setTmpdir(this.getTempDir());
  myDataEngine=(DataEngineImpl)DataEngine.newDataEngine(dec);
  myDataEngine.defineDataSource(this.dataSource);
  myDataEngine.defineDataSet(this.dataSet);
  this.appContextMap.put(DataEngine.DATA_SET_CACHE_ROW_LIMIT,new Integer(4));
  this.testUseCache1();
}
Program: 71677
Project: 71677
Buggy source:
/** 
 * Executes the onFetch script associated with the data source 
 */
public void onFetch() throws DataException {
  if (getEventHandler() != null) {
    Mode temp=this.getMode();
    this.setMode(Mode.DataSet);
    try {
      getEventHandler().handleOnFetch(this,getDataRow());
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
 finally {
      this.setMode(temp);
    }
  }
}

Fixed version (ground truth):
/** 
 * Executes the onFetch script associated with the data source 
 */
public void onFetch() throws DataException {
  if (fromCache)   return;
  if (getEventHandler() != null) {
    Mode temp=this.getMode();
    this.setMode(Mode.DataSet);
    try {
      getEventHandler().handleOnFetch(this,getDataRow());
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
 finally {
      this.setMode(temp);
    }
  }
}
Program: 71678
Project: 71678
Buggy source:
/** 
 * Executes the beforeOpen script associated with the data source 
 */
public void beforeOpen() throws DataException {
  if (getEventHandler() != null) {
    try {
      getEventHandler().handleBeforeOpen(this);
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Executes the beforeOpen script associated with the data source 
 */
public void beforeOpen() throws DataException {
  if (fromCache)   return;
  if (getEventHandler() != null) {
    try {
      getEventHandler().handleBeforeOpen(this);
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}
Program: 71679
Project: 71679
Buggy source:
/** 
 * Executes the beforeClose script associated with the data source 
 */
public void beforeClose() throws DataException {
  if (getEventHandler() != null) {
    try {
      getEventHandler().handleBeforeClose(this);
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Executes the beforeClose script associated with the data source 
 */
public void beforeClose() throws DataException {
  if (fromCache)   return;
  if (getEventHandler() != null) {
    try {
      getEventHandler().handleBeforeClose(this);
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}
Program: 71680
Project: 71680
Buggy source:
/** 
 * Executes the afterClose script associated with the data source 
 */
public void afterClose() throws DataException {
  if (getEventHandler() != null) {
    try {
      getEventHandler().handleAfterClose(this);
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Executes the afterClose script associated with the data source 
 */
public void afterClose() throws DataException {
  if (fromCache)   return;
  if (getEventHandler() != null) {
    try {
      getEventHandler().handleAfterClose(this);
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}
Program: 71681
Project: 71681
Buggy source:
/** 
 * Executes the afterOpen script associated with the data source 
 */
public void afterOpen() throws DataException {
  if (getEventHandler() != null) {
    try {
      getEventHandler().handleAfterOpen(this);
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Executes the afterOpen script associated with the data source 
 */
public void afterOpen() throws DataException {
  if (fromCache)   return;
  if (getEventHandler() != null) {
    try {
      getEventHandler().handleAfterOpen(this);
    }
 catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}
Program: 71682
Project: 71682
Buggy source:
/** 
 * Test case: 1. When including a library which includes another library, getAllImages method can return all the images in these libraries. 2. Above condition, the imagesIterator method returns null while there is no embedded images in report design.
 * @throws Exception
 */
public void testGetImage() throws Exception {
  openDesign("String_Node_Str");
  assertEquals(1,designHandle.getLibraries().size());
  assertTrue(!designHandle.imagesIterator().hasNext());
  assertNotNull(designHandle.findImage("String_Node_Str"));
  assertNotNull(designHandle.findImage("String_Node_Str"));
  assertNotNull(designHandle.findImage("String_Node_Str"));
  assertNotNull(designHandle.findImage("String_Node_Str"));
  LibraryHandle lib1=designHandle.getLibrary("String_Node_Str");
  assertNotNull(lib1);
  Iterator imageIter=lib1.imagesIterator();
  assertTrue(imageIter.hasNext());
  EmbeddedImageHandle image=(EmbeddedImageHandle)imageIter.next();
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getQualifiedName());
  assertTrue(image.getModule() instanceof Library);
  image=(EmbeddedImageHandle)imageIter.next();
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getQualifiedName());
  assertTrue(image.getModule() instanceof Library);
  LibraryHandle lib2=designHandle.getLibrary("String_Node_Str");
  assertNull(lib2);
  assertEquals(2,designHandle.getAllImages().size());
  assertEquals(4,lib1.getAllImages().size());
}

Fixed version (ground truth):
/** 
 * Test case: 1. When including a library which includes another library, getAllImages method can return all the images in these libraries. 2. Above condition, the imagesIterator method returns null while there is no embedded images in report design.
 * @throws Exception
 */
public void testGetImage() throws Exception {
  openDesign("String_Node_Str");
  assertEquals(1,designHandle.getLibraries().size());
  assertTrue(!designHandle.imagesIterator().hasNext());
  assertNotNull(designHandle.findImage("String_Node_Str"));
  assertNotNull(designHandle.findImage("String_Node_Str"));
  assertNotNull(designHandle.findImage("String_Node_Str"));
  assertNotNull(designHandle.findImage("String_Node_Str"));
  LibraryHandle lib1=designHandle.getLibrary("String_Node_Str");
  assertNotNull(lib1);
  Iterator imageIter=lib1.imagesIterator();
  assertTrue(imageIter.hasNext());
  EmbeddedImageHandle image=(EmbeddedImageHandle)imageIter.next();
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getQualifiedName());
  assertTrue(image.getModule() instanceof Library);
  image=(EmbeddedImageHandle)imageIter.next();
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getQualifiedName());
  assertTrue(image.getModule() instanceof Library);
  LibraryHandle lib2=designHandle.getLibrary("String_Node_Str");
  assertNull(lib2);
  assertEquals(4,designHandle.getAllImages().size());
  assertEquals(4,lib1.getAllImages().size());
}
Program: 71683
Project: 71683
Buggy source:
public void startRow(IRowContent row){
  if (cellEmitter != null) {
    cellEmitter.startRow(row);
  }
 else {
    boolean isHidden=LayoutUtil.isHidden(row,emitter.getOutputFormat(),context.getOutputDisplayNone());
    int rowId=row.getRowID();
    if (lastRowId >= 0 && rowId > lastRowId + 1) {
      for (int i=lastRowId + 1; i < rowId; i++) {
        IRowContent newRow=(IRowContent)row.cloneContent(false);
        newRow.setParent(row.getParent());
        newRow.setRowID(i);
        startRow(newRow);
        endRow(newRow);
      }
    }
    if (!isNestTable()) {
      layout.createRow(row,isHidden);
      if (!isHidden) {
        if (hasDropCell()) {
          layoutEvents.push(new LayoutEvent(LayoutEvent.ON_ROW,new StartInfo(layout.getRowCount() - 1,0)));
          return;
        }
 else         if (layout.hasUnResolvedRow() && !LayoutUtil.isRepeatableRow(row)) {
          layoutEvents.push(new LayoutEvent(LayoutEvent.ON_ROW,new StartInfo(layout.getRowCount() - 1,0)));
          hasDropCell=true;
          return;
        }
      }
    }
    if (!isHidden) {
      emitter.startRow(row);
    }
  }
}

Fixed version (ground truth):
public void startRow(IRowContent row){
  if (cellEmitter != null) {
    cellEmitter.startRow(row);
  }
 else {
    boolean isHidden=LayoutUtil.isHidden(row,emitter.getOutputFormat(),context.getOutputDisplayNone());
    if (!isNestTable()) {
      int rowId=row.getRowID();
      if (lastRowId >= 0 && rowId > lastRowId + 1) {
        for (int i=lastRowId + 1; i < rowId; i++) {
          IRowContent newRow=(IRowContent)row.cloneContent(false);
          newRow.setParent(row.getParent());
          newRow.setRowID(i);
          startRow(newRow);
          endRow(newRow);
        }
      }
      layout.createRow(row,isHidden);
      if (!isHidden) {
        if (hasDropCell()) {
          layoutEvents.push(new LayoutEvent(LayoutEvent.ON_ROW,new StartInfo(layout.getRowCount() - 1,0)));
          return;
        }
 else         if (layout.hasUnResolvedRow() && !LayoutUtil.isRepeatableRow(row)) {
          layoutEvents.push(new LayoutEvent(LayoutEvent.ON_ROW,new StartInfo(layout.getRowCount() - 1,0)));
          hasDropCell=true;
          return;
        }
      }
    }
    if (!isHidden) {
      emitter.startRow(row);
    }
  }
}
Program: 71684
Project: 71684
Buggy source:
public void startRow(IRowContent row){
  if (cellEmitter != null) {
    cellEmitter.startRow(row);
  }
 else {
    boolean isHidden=LayoutUtil.isHidden(row,emitter.getOutputFormat(),context.getOutputDisplayNone());
    if (!LayoutUtil.isRepeatableRow(row)) {
      int rowId=row.getRowID();
      if (lastRowId >= 0 && rowId > lastRowId - 1) {
        for (int i=lastRowId + 1; i < rowId; i++) {
          IRowContent newRow=(IRowContent)row.cloneContent(false);
          newRow.setParent(row.getParent());
          newRow.setRowID(i);
          startRow(newRow);
          endRow(newRow);
        }
      }
    }
    if (!isNestTable()) {
      layout.createRow(row,isHidden);
      if (!isHidden) {
        if (hasDropCell()) {
          layoutEvents.push(new LayoutEvent(LayoutEvent.ON_ROW,new StartInfo(layout.getRowCount() - 1,0)));
          return;
        }
 else         if (layout.hasUnResolvedRow() && !LayoutUtil.isRepeatableRow(row)) {
          layoutEvents.push(new LayoutEvent(LayoutEvent.ON_ROW,new StartInfo(layout.getRowCount() - 1,0)));
          hasDropCell=true;
          return;
        }
      }
    }
    if (!isHidden) {
      emitter.startRow(row);
    }
  }
}

Fixed version (ground truth):
public void startRow(IRowContent row){
  if (cellEmitter != null) {
    cellEmitter.startRow(row);
  }
 else {
    boolean isHidden=LayoutUtil.isHidden(row,emitter.getOutputFormat(),context.getOutputDisplayNone());
    int rowId=row.getRowID();
    if (lastRowId >= 0 && rowId > lastRowId + 1) {
      for (int i=lastRowId + 1; i < rowId; i++) {
        IRowContent newRow=(IRowContent)row.cloneContent(false);
        newRow.setParent(row.getParent());
        newRow.setRowID(i);
        startRow(newRow);
        endRow(newRow);
      }
    }
    if (!isNestTable()) {
      layout.createRow(row,isHidden);
      if (!isHidden) {
        if (hasDropCell()) {
          layoutEvents.push(new LayoutEvent(LayoutEvent.ON_ROW,new StartInfo(layout.getRowCount() - 1,0)));
          return;
        }
 else         if (layout.hasUnResolvedRow() && !LayoutUtil.isRepeatableRow(row)) {
          layoutEvents.push(new LayoutEvent(LayoutEvent.ON_ROW,new StartInfo(layout.getRowCount() - 1,0)));
          hasDropCell=true;
          return;
        }
      }
    }
    if (!isHidden) {
      emitter.startRow(row);
    }
  }
}
Program: 71685
Project: 71685
Buggy source:
public void endTableBand(ITableBandContent band){
  if (cellEmitter != null) {
    cellEmitter.endTableBand(band);
  }
 else {
    if (!isNestTable()) {
      if (band.getBandType() == IBandContent.BAND_GROUP_FOOTER) {
        int groupLevel=getGroupLevel();
        resolveCellsOfDrop(groupLevel,true,isContentFinished(band));
      }
      if (hasDropCell()) {
        layoutEvents.push(new LayoutEvent(LayoutEvent.END_BAND,band));
        return;
      }
      flush();
    }
    emitter.endTableBand(band);
  }
}

Fixed version (ground truth):
public void endTableBand(ITableBandContent band){
  if (cellEmitter != null) {
    cellEmitter.endTableBand(band);
  }
 else {
    if (!isNestTable()) {
      if (LayoutUtil.isRepeatableBand(band)) {
        lastRowId=-1;
      }
      if (band.getBandType() == IBandContent.BAND_GROUP_FOOTER) {
        int groupLevel=getGroupLevel();
        resolveCellsOfDrop(groupLevel,true,isContentFinished(band));
      }
      if (hasDropCell()) {
        layoutEvents.push(new LayoutEvent(LayoutEvent.END_BAND,band));
        return;
      }
      flush();
    }
    emitter.endTableBand(band);
  }
}
Program: 71686
Project: 71686
Buggy source:
public void endRow(IRowContent row){
  if (cellEmitter != null) {
    cellEmitter.endRow(row);
  }
 else {
    if (!isNestTable()) {
      layout.endRow(row);
      if (!LayoutUtil.isRepeatableRow(row)) {
        lastRowId=row.getRowID();
      }
      hasDropCell=layout.hasDropCell();
      if (hasDropCell()) {
        return;
      }
      if (layoutEvents.size() > 0) {
        flush();
        return;
      }
    }
    boolean isHidden=LayoutUtil.isHidden(row,emitter.getOutputFormat(),context.getOutputDisplayNone());
    if (!isHidden) {
      emitter.endRow(row);
    }
  }
}

Fixed version (ground truth):
public void endRow(IRowContent row){
  if (cellEmitter != null) {
    cellEmitter.endRow(row);
  }
 else {
    if (!isNestTable()) {
      layout.endRow(row);
      lastRowId=row.getRowID();
      hasDropCell=layout.hasDropCell();
      if (hasDropCell()) {
        return;
      }
      if (layoutEvents.size() > 0) {
        flush();
        return;
      }
    }
    boolean isHidden=LayoutUtil.isHidden(row,emitter.getOutputFormat(),context.getOutputDisplayNone());
    if (!isHidden) {
      emitter.endRow(row);
    }
  }
}
Program: 71687
Project: 71687
Buggy source:
/** 
 * Constructs the data request session with the provided session context information.
 * @param context
 * @throws BirtException
 */
public DataRequestSessionImpl(DataSessionContext context) throws BirtException {
  if (context == null)   throw new AdapterException(ResourceConstants.CONEXT_NULL_ERROR);
  dataEngine=(DataEngineImpl)DataEngine.newDataEngine(context.getDataEngineContext());
  modelAdaptor=new ModelAdapter(context);
  sessionContext=context;
  cubeHandleMap=new HashMap();
  stopSign=new StopSign();
}

Fixed version (ground truth):
/** 
 * Constructs the data request session with the provided session context information.
 * @param context
 * @throws BirtException
 */
public DataRequestSessionImpl(DataSessionContext context) throws BirtException {
  if (context == null)   throw new AdapterException(ResourceConstants.CONEXT_NULL_ERROR);
  dataEngine=(DataEngineImpl)DataEngine.newDataEngine(context.getDataEngineContext());
  modelAdaptor=new ModelAdapter(context);
  sessionContext=context;
  cubeHandleMap=new HashMap();
  stopSign=new StopSign();
  if (sessionContext != null) {
    this.setModuleHandleToAppContext();
  }
}
Program: 71688
Project: 71688
Buggy source:
public IResultMetaData refreshMetaData(DataSetHandle dataSetHandle,boolean holdEvent) throws BirtException {
  setModuleHandleToAppContext();
  return new DataSetMetaDataHelper(this.dataEngine,this.modelAdaptor,this.sessionContext).refreshMetaData(dataSetHandle,holdEvent);
}

Fixed version (ground truth):
public IResultMetaData refreshMetaData(DataSetHandle dataSetHandle,boolean holdEvent) throws BirtException {
  return new DataSetMetaDataHelper(this.dataEngine,this.modelAdaptor,this.sessionContext).refreshMetaData(dataSetHandle,holdEvent);
}
Program: 71689
Project: 71689
Buggy source:
public IBaseQueryResults execute(IBasePreparedQuery query,IBaseQueryResults outerResults,Scriptable scope) throws AdapterException {
  try {
    setModuleHandleToAppContext();
    if (query instanceof IPreparedQuery) {
      return ((IPreparedQuery)query).execute(outerResults,scope);
    }
 else     if (query instanceof IPreparedCubeQuery) {
      return ((IPreparedCubeQuery)query).execute(outerResults,scope);
    }
    return null;
  }
 catch (  BirtException e) {
    throw new AdapterException(ResourceConstants.EXCEPTION_ERROR,e);
  }
}

Fixed version (ground truth):
public IBaseQueryResults execute(IBasePreparedQuery query,IBaseQueryResults outerResults,Scriptable scope) throws AdapterException {
  try {
    if (query instanceof IPreparedQuery) {
      return ((IPreparedQuery)query).execute(outerResults,scope);
    }
 else     if (query instanceof IPreparedCubeQuery) {
      return ((IPreparedCubeQuery)query).execute(outerResults,scope);
    }
    return null;
  }
 catch (  BirtException e) {
    throw new AdapterException(ResourceConstants.EXCEPTION_ERROR,e);
  }
}