nus-yam/ex-repair huggingface dataset:
Program: 68956
Project: 68956
Buggy source:
private void traverse(IArea area){
  if (area instanceof ContainerArea) {
    if (area instanceof TableArea) {
      tableIds.add(((TableArea)area).getContent().getInstanceID().toUniqueString());
    }
    ContainerArea container=(ContainerArea)area;
    if (container.content != null && !container.isDummy) {
      start(container);
    }
    if (!(container.content instanceof ForeignContent)) {
      for (Iterator<IArea> i=container.getChildren(); i.hasNext(); ) {
        IArea child=i.next();
        traverse(child);
      }
    }
  }
  String bookmark=area.getBookmark();
  if (bookmark != null) {
    context.addBookmarkMap(context.getPageNumber(),bookmark);
  }
}

Fixed version (ground truth):
private void traverse(IArea area){
  if (area instanceof ContainerArea) {
    if (area instanceof TableArea) {
      tableIds.add(((TableArea)area).getContent().getInstanceID().toUniqueString());
    }
    ContainerArea container=(ContainerArea)area;
    if (container.content != null && !container.isDummy && container.content.getInstanceID() != null) {
      start(container);
    }
    if (!(container.content instanceof ForeignContent)) {
      for (Iterator<IArea> i=container.getChildren(); i.hasNext(); ) {
        IArea child=i.next();
        traverse(child);
      }
    }
  }
  String bookmark=area.getBookmark();
  if (bookmark != null) {
    context.addBookmarkMap(context.getPageNumber(),bookmark);
  }
}
Program: 68957
Project: 68957
Buggy source:
protected void addRows(ContainerArea container,TableLayout layout) throws BirtException {
  if (container instanceof RowArea) {
    RowArea row=(RowArea)container;
    if (row.needResolveBorder) {
      int size=row.getChildrenCount();
      for (int i=0; i < size; i++) {
        CellArea cell=(CellArea)row.getChild(i);
        int ch=cell.getContentHeight();
        cell.boxStyle.clearBorder();
        layout.resolveBorderConflict(cell,true);
        cell.setContentHeight(ch);
      }
      row.needResolveBorder=false;
    }
    if (row.finished) {
      if (row.getChildrenCount() != row.cells.length) {
        for (int i=0; i < row.cells.length; i++) {
          if (row.cells[i] instanceof DummyCell) {
            row.cells[i]=null;
          }
        }
      }
      int rh=row.getHeight();
      layout.addRow(row,context.isFixedLayout());
      int delta=row.getHeight() - rh;
      if (delta > 0) {
        ContainerArea rowParent=row.getParent();
        if (rowParent != null) {
          rowParent.updateChildrenPosition();
        }
      }
    }
  }
 else {
    int size=container.getChildrenCount();
    for (int i=0; i < size; i++) {
      ContainerArea child=(ContainerArea)container.getChild(i);
      addRows(child,layout);
      child.updateChildrenPosition();
    }
  }
}

Fixed version (ground truth):
protected void addRows(ContainerArea container,TableLayout layout) throws BirtException {
  if (container instanceof RowArea) {
    RowArea row=(RowArea)container;
    if (row.needResolveBorder) {
      int size=row.getChildrenCount();
      for (int i=0; i < size; i++) {
        CellArea cell=(CellArea)row.getChild(i);
        int ch=cell.getContentHeight();
        cell.boxStyle.clearBorder();
        layout.resolveBorderConflict(cell,true);
        cell.setContentHeight(ch);
      }
      row.needResolveBorder=false;
    }
    if (row.finished) {
      if (row.getChildrenCount() != row.cells.length) {
        for (int i=0; i < row.cells.length; i++) {
          if (row.cells[i] instanceof DummyCell) {
            row.cells[i]=null;
          }
        }
      }
      layout.addRow(row,context.isFixedLayout());
    }
  }
 else {
    int size=container.getChildrenCount();
    for (int i=0; i < size; i++) {
      ContainerArea child=(ContainerArea)container.getChild(i);
      addRows(child,layout);
      child.updateChildrenPosition();
    }
    container.updateChildrenPosition();
  }
}
Program: 68958
Project: 68958
Buggy source:
/** 
 * Creates dummy cell and updates its delta value.
 * @param upperCell the upper cell.
 * @return the created dummy cell.
 */
private DummyCell createDummyCell(CellArea upperCell){
  DummyCell dummyCell=null;
  CellArea refCell=null;
  RowArea lastRow=(RowArea)rows.getCurrent();
  int lastRowHeight=lastRow.getHeight();
  int delta=0;
  if (upperCell instanceof DummyCell) {
    refCell=((DummyCell)upperCell).getCell();
    dummyCell=new DummyCell(refCell);
    delta=((DummyCell)upperCell).getDelta() + lastRowHeight;
    dummyCell.setDelta(delta);
  }
 else {
    refCell=upperCell;
    dummyCell=new DummyCell(upperCell);
    dummyCell.setDelta(lastRowHeight);
  }
  dummyCell.setRowSpan(upperCell.getRowSpan() - 1);
  dummyCell.setColSpan(upperCell.getColSpan());
  return dummyCell;
}

Fixed version (ground truth):
/** 
 * Creates dummy cell and updates its delta value.
 * @param upperCell the upper cell.
 * @return the created dummy cell.
 */
private DummyCell createDummyCell(CellArea upperCell){
  DummyCell dummyCell=null;
  CellArea refCell=null;
  RowArea lastRow=(RowArea)rows.getCurrent();
  int lastRowHeight=lastRow.getHeight();
  int delta=0;
  if (upperCell instanceof DummyCell) {
    refCell=((DummyCell)upperCell).getCell();
    dummyCell=new DummyCell(refCell);
    delta=((DummyCell)upperCell).getDelta() + lastRowHeight;
    dummyCell.setDelta(delta);
  }
 else {
    refCell=upperCell;
    dummyCell=new DummyCell(upperCell);
    dummyCell.setDelta(lastRowHeight);
  }
  dummyCell.setRowSpan(upperCell.getRowSpan() - 1);
  dummyCell.setColSpan(upperCell.getColSpan());
  dummyCell.isDummy=true;
  return dummyCell;
}
Program: 68959
Project: 68959
Buggy source:
public void add(AbstractArea area){
  super.add(area);
  if (repeatList != null) {
    IContent content=((ContainerArea)area).getContent();
    if (content != null) {
      IElement parent=content.getParent();
      if (parent != null && parent instanceof IBandContent) {
        int type=((IBandContent)parent).getBandType();
        if (type == IBandContent.BAND_HEADER || type == IBandContent.BAND_GROUP_HEADER) {
          if (content instanceof IRowContent) {
            RowDesign rowDesign=(RowDesign)content.getGenerateBy();
            if (rowDesign == null || rowDesign.getRepeatable()) {
              repeatList.add(area);
            }
          }
 else {
            repeatList.add(area);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void add(AbstractArea area){
  super.add(area);
  if (repeatList != null && isInRepeatHeader(area)) {
    repeatList.add(area);
  }
}
Program: 68960
Project: 68960
Buggy source:
public void start(IReportContent report){
  setupRenderOptions();
  String reportOrientation=report.getDesign().getReportDesign().getBidiOrientation();
  if ("String_Node_Str".equalsIgnoreCase(reportOrientation))   isRTLSheet=true;
  IStyle style=report.getRoot().getComputedStyle();
  SimpleMasterPageDesign master=(SimpleMasterPageDesign)report.getDesign().getPageSetup().getMasterPage(0);
  engine=createLayoutEngine(context,this);
  engine.initalize(new PageDef(master,style));
  String reportTitle=report.getDesign().getReportDesign().getStringProperty(IModuleModel.TITLE_PROP);
  if (reportTitle != null) {
    reportTitle=reportTitle.replace("String_Node_Str","String_Node_Str");
    reportTitle=reportTitle.replace("String_Node_Str","String_Node_Str");
    sheetName=reportTitle;
  }
 else {
    sheetName=DEFAULT_SHEET_NAME;
  }
  createWriter();
}

Fixed version (ground truth):
public void start(IReportContent report){
  setupRenderOptions();
  String reportOrientation=report.getDesign().getReportDesign().getBidiOrientation();
  if ("String_Node_Str".equalsIgnoreCase(reportOrientation))   isRTLSheet=true;
  IStyle style=report.getRoot().getComputedStyle();
  SimpleMasterPageDesign master=(SimpleMasterPageDesign)report.getDesign().getPageSetup().getMasterPage(0);
  engine=createLayoutEngine(context,this);
  engine.initalize(new PageDef(master,style));
  String reportTitle=report.getDesign().getReportDesign().getStringProperty(IModuleModel.TITLE_PROP);
  if (reportTitle != null) {
    sheetName=reportTitle;
  }
 else {
    sheetName=DEFAULT_SHEET_NAME;
  }
  sheetName=ExcelUtil.getValidSheetName(sheetName);
  createWriter();
}
Program: 68961
Project: 68961
Buggy source:
public static DataItemHandle performInsertDataSetColumn(ResultSetColumnHandle model,Object target,Object targetParent) throws SemanticException {
  return InsertInLayoutUtil.performInsertDataSetColumn(model,target,targetParent);
}

Fixed version (ground truth):
public static DesignElementHandle performInsertDataSetColumn(ResultSetColumnHandle model,Object target,Object targetParent) throws SemanticException {
  return InsertInLayoutUtil.performInsertDataSetColumn(model,target,targetParent);
}
Program: 68962
Project: 68962
Buggy source:
private void writeBackGroudColor(StyleEntry style){
  Color bgColor=(Color)style.getProperty(StyleConstant.BACKGROUND_COLOR_PROP);
  if (bgColor != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",bgColor);
    writer.attribute("String_Node_Str","String_Node_Str");
    writer.closeTag("String_Node_Str");
  }
}

Fixed version (ground truth):
private void writeBackGroudColor(StyleEntry style){
  Color bgColor=(Color)style.getProperty(StyleConstant.BACKGROUND_COLOR_PROP);
  if (bgColor != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",toString(bgColor));
    writer.attribute("String_Node_Str","String_Node_Str");
    writer.closeTag("String_Node_Str");
  }
}
Program: 68963
Project: 68963
Buggy source:
/** 
 * Close the container tag.
 */
public void closeContainerTag(){
  writer.closeTag(HTMLTags.TAG_DIV);
  int display=((Integer)containerDisplayStack.pop()).intValue();
  if (((display & HTMLEmitterUtil.DISPLAY_INLINE) > 0) || ((display & HTMLEmitterUtil.DISPLAY_INLINE_BLOCK) > 0)) {
    closeInlineBoxTag();
  }
}

Fixed version (ground truth):
/** 
 * Close the container tag.
 */
public void closeContainerTag(){
  writer.closeTag(HTMLTags.TAG_DIV);
  int display=((Integer)containerDisplayStack.pop()).intValue();
  if (!reportEmitter.browserSupportsInlineBlock) {
    if (((display & HTMLEmitterUtil.DISPLAY_INLINE) > 0) || ((display & HTMLEmitterUtil.DISPLAY_INLINE_BLOCK) > 0)) {
      closeInlineBoxTag();
    }
  }
}
Program: 68964
Project: 68964
Buggy source:
/** 
 * Open the tag when implement the inline box.
 */
protected void openInlineBoxTag(){
  writer.openTag(HTMLTags.TAG_DIV);
  if (browserVersion == HTMLEmitterUtil.BROWSER_IE7) {
    writer.attribute(HTMLTags.ATTR_STYLE,"String_Node_Str");
  }
 else {
    writer.attribute(HTMLTags.ATTR_STYLE,"String_Node_Str");
  }
  writer.openTag(HTMLTags.TAG_TABLE);
  writer.attribute(HTMLTags.ATTR_STYLE,"String_Node_Str");
  writer.openTag(HTMLTags.TAG_TR);
  writer.openTag(HTMLTags.TAG_TD);
}

Fixed version (ground truth):
/** 
 * Open the tag when implement the inline box. This solution only works for IE5.5, IE6, IE7, Firefox1.5 and Firefox2.
 */
protected void openInlineBoxTag(){
  writer.openTag(HTMLTags.TAG_DIV);
  writer.attribute(HTMLTags.ATTR_STYLE,"String_Node_Str");
  writer.openTag(HTMLTags.TAG_TABLE);
  writer.attribute(HTMLTags.ATTR_STYLE,"String_Node_Str");
  writer.openTag(HTMLTags.TAG_TR);
  writer.openTag(HTMLTags.TAG_TD);
}
Program: 68965
Project: 68965
Buggy source:
/** 
 * Open the container tag.
 */
public void openContainerTag(IContainerContent container){
  DimensionType x=container.getX();
  DimensionType y=container.getY();
  DimensionType width=container.getWidth();
  DimensionType height=container.getHeight();
  int display=getElementType(x,y,width,height,container.getStyle());
  containerDisplayStack.push(new Integer(display));
  if (((display & HTMLEmitterUtil.DISPLAY_INLINE) > 0) || ((display & HTMLEmitterUtil.DISPLAY_INLINE_BLOCK) > 0)) {
    openInlineBoxTag();
  }
  writer.openTag(HTMLTags.TAG_DIV);
}

Fixed version (ground truth):
/** 
 * Open the container tag.
 */
public void openContainerTag(IContainerContent container){
  DimensionType x=container.getX();
  DimensionType y=container.getY();
  DimensionType width=container.getWidth();
  DimensionType height=container.getHeight();
  int display=getElementType(x,y,width,height,container.getStyle());
  containerDisplayStack.push(new Integer(display));
  if (!reportEmitter.browserSupportsInlineBlock) {
    if (((display & HTMLEmitterUtil.DISPLAY_INLINE) > 0) || ((display & HTMLEmitterUtil.DISPLAY_INLINE_BLOCK) > 0)) {
      openInlineBoxTag();
    }
  }
  writer.openTag(HTMLTags.TAG_DIV);
}
Program: 68967
Project: 68967
Buggy source:
/** 
 * Build the style of contianer content.
 */
public void buildContainerStyle(IContainerContent container,StringBuffer styleBuffer){
  int display=((Integer)containerDisplayStack.peek()).intValue();
  handleShrink(display,container.getStyle(),container.getHeight(),container.getWidth(),styleBuffer);
  setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
  IStyle style=getElementStyle(container);
  if (style == null) {
    return;
  }
  AttributeBuilder.buildFont(styleBuffer,style);
  AttributeBuilder.buildBox(styleBuffer,style);
  AttributeBuilder.buildBackground(styleBuffer,style,reportEmitter);
  AttributeBuilder.buildText(styleBuffer,style);
  AttributeBuilder.buildVisual(styleBuffer,style);
  AttributeBuilder.buildTextDecoration(styleBuffer,style);
}

Fixed version (ground truth):
/** 
 * Build the style of contianer content.
 */
public void buildContainerStyle(IContainerContent container,StringBuffer styleBuffer){
  int display=((Integer)containerDisplayStack.peek()).intValue();
  handleShrink(display,container.getStyle(),container.getHeight(),container.getWidth(),styleBuffer);
  if ((display & HTMLEmitterUtil.DISPLAY_NONE) > 0) {
    styleBuffer.append("String_Node_Str");
  }
 else   if (((display & HTMLEmitterUtil.DISPLAY_INLINE) > 0) || ((display & HTMLEmitterUtil.DISPLAY_INLINE_BLOCK) > 0)) {
    styleBuffer.append("String_Node_Str");
  }
  IStyle style=getElementStyle(container);
  if (style == null) {
    return;
  }
  AttributeBuilder.buildFont(styleBuffer,style);
  AttributeBuilder.buildBox(styleBuffer,style);
  AttributeBuilder.buildBackground(styleBuffer,style,reportEmitter);
  AttributeBuilder.buildText(styleBuffer,style);
  AttributeBuilder.buildVisual(styleBuffer,style);
  AttributeBuilder.buildTextDecoration(styleBuffer,style);
}
Program: 68970
Project: 68970
Buggy source:
/** 
 * Build the style of contianer content.
 */
public void buildContainerStyle(IContainerContent container,StringBuffer styleBuffer){
  int display=((Integer)containerDisplayStack.peek()).intValue();
  handleShrink(display,container.getStyle(),container.getHeight(),container.getWidth(),styleBuffer);
  setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
  IStyle style=getElementStyle(container);
  if (style == null) {
    return;
  }
  AttributeBuilder.buildFont(styleBuffer,style);
  AttributeBuilder.buildBox(styleBuffer,style);
  AttributeBuilder.buildBackground(styleBuffer,style,reportEmitter);
  AttributeBuilder.buildText(styleBuffer,style);
  AttributeBuilder.buildVisual(styleBuffer,style);
}

Fixed version (ground truth):
/** 
 * Build the style of contianer content.
 */
public void buildContainerStyle(IContainerContent container,StringBuffer styleBuffer){
  int display=((Integer)containerDisplayStack.peek()).intValue();
  handleShrink(display,container.getStyle(),container.getHeight(),container.getWidth(),styleBuffer);
  if ((display & HTMLEmitterUtil.DISPLAY_NONE) > 0) {
    styleBuffer.append("String_Node_Str");
  }
 else   if (((display & HTMLEmitterUtil.DISPLAY_INLINE) > 0) || ((display & HTMLEmitterUtil.DISPLAY_INLINE_BLOCK) > 0)) {
    styleBuffer.append("String_Node_Str");
  }
  IStyle style=getElementStyle(container);
  if (style == null) {
    return;
  }
  AttributeBuilder.buildFont(styleBuffer,style);
  AttributeBuilder.buildBox(styleBuffer,style);
  AttributeBuilder.buildBackground(styleBuffer,style,reportEmitter);
  AttributeBuilder.buildText(styleBuffer,style);
  AttributeBuilder.buildVisual(styleBuffer,style);
}
Program: 68971
Project: 68971
Buggy source:
public static int getBrowserVersion(String userAgent){
  if (userAgent == null || userAgent.length() <= 0) {
    return BROWSER_UNKNOW;
  }
 else   if (userAgent.contains("String_Node_Str")) {
    return BROWSER_IE5;
  }
 else   if (userAgent.contains("String_Node_Str")) {
    return BROWSER_IE6;
  }
 else   if (userAgent.contains("String_Node_Str")) {
    return BROWSER_IE7;
  }
 else   return BROWSER_UNKNOW;
}

Fixed version (ground truth):
public static int getBrowserVersion(String userAgent){
  if (userAgent == null || userAgent.length() <= 0) {
    return BROWSER_UNKNOW;
  }
 else   if (userAgent.contains("String_Node_Str")) {
    return BROWSER_IE5;
  }
 else   if (userAgent.contains("String_Node_Str")) {
    return BROWSER_IE6;
  }
 else   if (userAgent.contains("String_Node_Str")) {
    return BROWSER_IE7;
  }
 else   if (userAgent.contains("String_Node_Str")) {
    return BROWSER_FIREFOX1;
  }
 else   if (userAgent.contains("String_Node_Str")) {
    return BROWSER_FIREFOX2;
  }
 else   return BROWSER_UNKNOW;
}
Program: 68972
Project: 68972
Buggy source:
public void doPreview(){
  ChartUIUtil.prepareLivePreview(chartModel,getDataServiceProvider(),((ChartWizardContext)context).getActionEvaluator());
  if (previewPainter != null) {
    if (chartModel instanceof ChartWithAxes) {
      ChartAdapter.beginIgnoreNotifications();
      checkDataTypeForChartWithAxes(chartModel);
      ChartAdapter.endIgnoreNotifications();
    }
    previewPainter.renderModel(chartModel);
  }
}

Fixed version (ground truth):
public void doPreview(){
  ChartUIUtil.prepareLivePreview(chartModel,getDataServiceProvider(),((ChartWizardContext)context).getActionEvaluator());
  if (previewPainter != null) {
    if (chartModel instanceof ChartWithAxes) {
      ChartAdapter.beginIgnoreNotifications();
      checkDataTypeForChartWithAxes(chartModel);
      ChartAdapter.endIgnoreNotifications();
    }
 else {
      ChartWizard.removeAllExceptions(ChartWizard.CheckSeriesBindingType_ID);
    }
    previewPainter.renderModel(chartModel);
  }
}
Program: 68973
Project: 68973
Buggy source:
private void processCellStyle(Element element,Map<Element,StyleProperties> cssStyles){
  String border=element.getAttribute(PROPERTY_BORDER);
  String padding=element.getAttribute(PROPERTY_CELLPADDING);
  boolean hasBorder=border != null && border.length() > 0;
  boolean hasPadding=padding != null && padding.length() > 0;
  if (hasBorder || hasPadding) {
    for (Node node=element.getFirstChild(); node != null; node=node.getNextSibling()) {
      Element r=(Element)node;
      if (TAG_TR.equals(r.getTagName())) {
        for (Node n=r.getFirstChild(); n != null; n=n.getNextSibling()) {
          Element c=(Element)n;
          if (TAG_TD.equals(c.getTagName()) || TAG_TH.equals(c.getTagName())) {
            StyleProperties sp=cssStyles.get(c);
            if (sp == null) {
              sp=new StyleProperties(new StyleDeclaration(content.getCSSEngine()));
              cssStyles.put(c,sp);
            }
            if (hasBorder) {
              PropertiesProcessor.process(PROPERTY_BORDER,border,sp);
            }
            if (hasPadding) {
              PropertiesProcessor.process(PROPERTY_CELLPADDING,border,sp);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void processCellStyle(Element element,Map<Element,StyleProperties> cssStyles){
  String border=element.getAttribute(PROPERTY_BORDER);
  String padding=element.getAttribute(PROPERTY_CELLPADDING);
  boolean hasBorder=border != null && border.length() > 0;
  boolean hasPadding=padding != null && padding.length() > 0;
  if (hasBorder || hasPadding) {
    for (Node node=element.getFirstChild(); node != null; node=node.getNextSibling()) {
      Element r=(Element)node;
      if (TAG_TR.equals(r.getTagName())) {
        processRow(r,cssStyles,border,padding);
      }
 else       if ("String_Node_Str".equals(r.getTagName()) || "String_Node_Str".equals(r.getTagName()) || "String_Node_Str".equals(r.getTagName())) {
        for (Node n=r.getFirstChild(); n != null; n=n.getNextSibling()) {
          Element c=(Element)n;
          if (TAG_TR.equals(c.getTagName())) {
            processRow(c,cssStyles,border,padding);
          }
        }
      }
    }
  }
}
Program: 68975
Project: 68975
Buggy source:
/** 
 * Parse the image map position from a string which is of format "x1, y1, x2, y2".
 * @param string the position string.
 * @return a array which contains the x, y coordinate of left up corner,width and height in sequence.
 */
private int[] getArea(String string){
  String[] rawDatas=string.split("String_Node_Str");
  int[] area=new int[4];
  area[0]=Integer.parseInt(rawDatas[0]);
  area[1]=Integer.parseInt(rawDatas[1]);
  area[2]=Integer.parseInt(rawDatas[4]) - area[0];
  area[3]=Integer.parseInt(rawDatas[5]) - area[1];
  return area;
}

Fixed version (ground truth):
/** 
 * Parse the image map position from a string which is of format "x1, y1, x2, y2".
 * @param string the position string.
 * @return a array which contains the x, y coordinate of left up corner,width and height in sequence.
 */
private int[] getArea(String string){
  String[] rawDatas=string.split("String_Node_Str");
  if (rawDatas.length == 8) {
    int[] area=new int[4];
    area[0]=Integer.parseInt(rawDatas[0]);
    area[1]=Integer.parseInt(rawDatas[1]);
    area[2]=Integer.parseInt(rawDatas[4]) - area[0];
    area[3]=Integer.parseInt(rawDatas[5]) - area[1];
    return area;
  }
  return null;
}
Program: 68976
Project: 68976
Buggy source:
public void startNode(Node node,HashMap<Element,StyleProperties> cssStyles){
  String nodeName=node.getNodeName();
  StyleProperties cssStyle=cssStyles.get(node);
  writer.openTag(nodeName);
  NamedNodeMap attributes=node.getAttributes();
  if (attributes != null) {
    for (int i=0; i < attributes.getLength(); i++) {
      Node attribute=attributes.item(i);
      String attrName=attribute.getNodeName();
      String attrValue=attribute.getNodeValue();
      if (attrValue != null) {
        if ("String_Node_Str".equalsIgnoreCase(nodeName) && "String_Node_Str".equalsIgnoreCase(attrName)) {
          String attrValueTrue=handleStyleImage(attrValue);
          if (attrValueTrue != null) {
            attrValue=attrValueTrue;
          }
        }
        writer.attribute(attrName,attrValue);
      }
    }
  }
  if (cssStyle != null) {
    StringBuffer buffer=new StringBuffer();
    cssStyle.toString(buffer);
    if (buffer.length() != 0) {
      writer.attribute("String_Node_Str",buffer.toString());
    }
  }
}

Fixed version (ground truth):
public void startNode(Node node,HashMap cssStyles){
  String nodeName=node.getNodeName();
  HashMap cssStyle=(HashMap)cssStyles.get(node);
  writer.openTag(nodeName);
  NamedNodeMap attributes=node.getAttributes();
  if (attributes != null) {
    for (int i=0; i < attributes.getLength(); i++) {
      Node attribute=attributes.item(i);
      String attrName=attribute.getNodeName();
      String attrValue=attribute.getNodeValue();
      if (attrValue != null) {
        if ("String_Node_Str".equalsIgnoreCase(nodeName) && "String_Node_Str".equalsIgnoreCase(attrName)) {
          String attrValueTrue=handleStyleImage(attrValue);
          if (attrValueTrue != null) {
            attrValue=attrValueTrue;
          }
        }
        writer.attribute(attrName,attrValue);
      }
    }
  }
  if (cssStyle != null) {
    StringBuffer buffer=new StringBuffer();
    Iterator ite=cssStyle.entrySet().iterator();
    while (ite.hasNext()) {
      Map.Entry entry=(Map.Entry)ite.next();
      Object keyObj=entry.getKey();
      Object valueObj=entry.getValue();
      if (keyObj == null || valueObj == null) {
        continue;
      }
      String key=keyObj.toString();
      String value=valueObj.toString();
      buffer.append(key);
      buffer.append("String_Node_Str");
      if ("String_Node_Str".equalsIgnoreCase(key)) {
        String valueTrue=handleStyleImage(value,true);
        if (valueTrue != null) {
          value=valueTrue;
        }
        buffer.append("String_Node_Str");
        buffer.append(value);
        buffer.append("String_Node_Str");
      }
 else {
        buffer.append(value);
      }
      buffer.append("String_Node_Str");
    }
    if (buffer.length() != 0) {
      writer.attribute("String_Node_Str",buffer.toString());
    }
  }
}
Program: 68977
Project: 68977
Buggy source:
/** 
 * Visits the children nodes of the specific node
 * @param visitor the ITextNodeVisitor instance
 * @param ele the specific node
 */
private void processNodes(Element ele,HashMap<Element,StyleProperties> cssStyles){
  for (Node node=ele.getFirstChild(); node != null; node=node.getNextSibling()) {
    short nodeType=node.getNodeType();
    if (nodeType == Node.TEXT_NODE) {
      if (isScriptText(node)) {
        writer.cdata(node.getNodeValue());
      }
 else {
        writer.text(node.getNodeValue(),false);
      }
    }
 else     if (nodeType == Node.COMMENT_NODE) {
      writer.comment(node.getNodeValue());
    }
 else     if (nodeType == Node.ELEMENT_NODE) {
      if ("String_Node_Str".equalsIgnoreCase(node.getNodeName())) {
        boolean bImplicitCloseTag=writer.isImplicitCloseTag();
        writer.setImplicitCloseTag(true);
        startNode(node,cssStyles);
        processNodes((Element)node,cssStyles);
        endNode(node);
        writer.setImplicitCloseTag(bImplicitCloseTag);
      }
 else {
        startNode(node,cssStyles);
        processNodes((Element)node,cssStyles);
        endNode(node);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Visits the children nodes of the specific node
 * @param visitor the ITextNodeVisitor instance
 * @param ele the specific node
 */
private void processNodes(Element ele,HashMap cssStyles){
  for (Node node=ele.getFirstChild(); node != null; node=node.getNextSibling()) {
    short nodeType=node.getNodeType();
    if (nodeType == Node.TEXT_NODE) {
      if (isScriptText(node)) {
        writer.cdata(node.getNodeValue());
      }
 else {
        writer.text(node.getNodeValue(),false);
      }
    }
 else     if (nodeType == Node.COMMENT_NODE) {
      writer.comment(node.getNodeValue());
    }
 else     if (nodeType == Node.ELEMENT_NODE) {
      if ("String_Node_Str".equalsIgnoreCase(node.getNodeName())) {
        boolean bImplicitCloseTag=writer.isImplicitCloseTag();
        writer.setImplicitCloseTag(true);
        startNode(node,cssStyles);
        processNodes((Element)node,cssStyles);
        endNode(node);
        writer.setImplicitCloseTag(bImplicitCloseTag);
      }
 else {
        startNode(node,cssStyles);
        processNodes((Element)node,cssStyles);
        endNode(node);
      }
    }
  }
}
Program: 68978
Project: 68978
Buggy source:
private void outputHtmlText(IForeignContent foreign){
  boolean bIndent=writer.isIndent();
  writer.setIndent(false);
  Object rawValue=foreign.getRawValue();
  String text=rawValue == null ? null : rawValue.toString();
  Document doc=new TextParser().parse(text,TextParser.TEXT_TYPE_HTML);
  ReportDesignHandle design=(ReportDesignHandle)runnable.getDesignHandle();
  HTMLStyleProcessor htmlProcessor=new HTMLStyleProcessor(design);
  HashMap<Element,StyleProperties> styleMap=new HashMap<Element,StyleProperties>();
  Element body=null;
  if (doc != null) {
    NodeList bodys=doc.getElementsByTagName("String_Node_Str");
    if (bodys.getLength() > 0) {
      body=(Element)bodys.item(0);
    }
  }
  if (body != null) {
    htmlProcessor.execute(body,styleMap,reportContext.getAppContext());
    processNodes(body,styleMap);
  }
  writer.setIndent(bIndent);
}

Fixed version (ground truth):
private void outputHtmlText(IForeignContent foreign){
  boolean bIndent=writer.isIndent();
  writer.setIndent(false);
  Object rawValue=foreign.getRawValue();
  String text=rawValue == null ? null : rawValue.toString();
  Document doc=new TextParser().parse(text,TextParser.TEXT_TYPE_HTML);
  ReportDesignHandle design=(ReportDesignHandle)runnable.getDesignHandle();
  HTMLProcessor htmlProcessor=new HTMLProcessor(design,reportContext.getAppContext());
  HashMap styleMap=new HashMap();
  Element body=null;
  if (doc != null) {
    NodeList bodys=doc.getElementsByTagName("String_Node_Str");
    if (bodys.getLength() > 0) {
      body=(Element)bodys.item(0);
    }
  }
  if (body != null) {
    htmlProcessor.execute(body,styleMap);
    processNodes(body,styleMap);
  }
  writer.setIndent(bIndent);
}
Program: 68980
Project: 68980
Buggy source:
private void populateSeriesTypes(Collection<IChartType> allChartType,Series series,Orientation orientation){
  Iterator<IChartType> iterTypes=allChartType.iterator();
  while (iterTypes.hasNext()) {
    IChartType type=iterTypes.next();
    Series newSeries=type.getSeries();
    if (htSeriesNames == null) {
      htSeriesNames=new Hashtable<String,Series>(20);
    }
    if (type.canCombine()) {
      if (!(newSeries instanceof StockSeries) || (orientation.getValue() == Orientation.VERTICAL)) {
        String sDisplayName=newSeries.getDisplayName();
        htSeriesNames.put(sDisplayName,newSeries);
        cbSeriesType.add(sDisplayName);
      }
      if (type.getName().equals(chartModel.getType())) {
        cbSeriesType.select(cbSeriesType.getItemCount() - 1);
      }
    }
  }
}

Fixed version (ground truth):
private void populateSeriesTypes(Collection<IChartType> allChartType,Series series,Orientation orientation){
  Iterator<IChartType> iterTypes=allChartType.iterator();
  while (iterTypes.hasNext()) {
    IChartType type=iterTypes.next();
    Series newSeries=type.getSeries();
    if (htSeriesNames == null) {
      htSeriesNames=new Hashtable<String,Series>(20);
    }
    if (type.canCombine()) {
      if (IChartType.TWO_DIMENSION_WITH_DEPTH_TYPE.equals(sDimension) && newSeries instanceof AreaSeries) {
        continue;
      }
      if (!(newSeries instanceof StockSeries) || (orientation.getValue() == Orientation.VERTICAL)) {
        String sDisplayName=newSeries.getDisplayName();
        htSeriesNames.put(sDisplayName,newSeries);
        cbSeriesType.add(sDisplayName);
      }
      if (type.getName().equals(chartModel.getType())) {
        cbSeriesType.select(cbSeriesType.getItemCount() - 1);
      }
    }
  }
}
Program: 68982
Project: 68982
Buggy source:
/** 
 * Updates the dimension combo according to chart type and axes number
 * @param sSelectedType Chart type
 * @return whether the dimension is changed after updating
 */
private boolean updateDimensionCombo(String sSelectedType){
  boolean isOldExist=false;
  IChartType chartType=ChartUIUtil.getChartType(sSelectedType);
  String[] dimensionArray=chartType.getSupportedDimensions();
  int axesNum=ChartUIUtil.getOrthogonalAxisNumber(chartModel);
  if (sDimension == null) {
    sDimension=chartType.getDefaultDimension();
    isOldExist=true;
  }
  cbDimension.removeAll();
  for (int i=0; i < dimensionArray.length; i++) {
    boolean isSupported=chartType.isDimensionSupported(dimensionArray[i],(ChartWizardContext)context,axesNum,0);
    if (isSupported) {
      cbDimension.add(dimensionArray[i]);
    }
    if (!isOldExist && sDimension.equals(dimensionArray[i])) {
      isOldExist=isSupported;
    }
  }
  String cache=ChartCacheManager.getInstance().getDimension(sSelectedType);
  if (cache != null) {
    sDimension=cache;
    isOldExist=true;
  }
  if (!isOldExist) {
    sDimension=chartType.getDefaultDimension();
  }
  cbDimension.setText(sDimension);
  return !isOldExist;
}

Fixed version (ground truth):
/** 
 * Updates the dimension combo according to chart type and axes number
 * @param sSelectedType Chart type
 * @return whether the dimension is changed after updating
 */
private boolean updateDimensionCombo(String sSelectedType){
  boolean isOldExist=false;
  IChartType chartType=ChartUIUtil.getChartType(sSelectedType);
  String[] dimensionArray=chartType.getSupportedDimensions();
  int axesNum=ChartUIUtil.getOrthogonalAxisNumber(chartModel);
  if (sDimension == null) {
    sDimension=chartType.getDefaultDimension();
    isOldExist=true;
  }
  cbDimension.removeAll();
  boolean bAreaSeriesMixed=isAreaSeriesMixed();
  for (int i=0; i < dimensionArray.length; i++) {
    boolean isSupported=chartType.isDimensionSupported(dimensionArray[i],(ChartWizardContext)context,axesNum,0);
    if (isSupported) {
      if (bAreaSeriesMixed && dimensionArray[i].equals(IChartType.TWO_DIMENSION_WITH_DEPTH_TYPE)) {
        continue;
      }
      cbDimension.add(dimensionArray[i]);
    }
    if (!isOldExist && sDimension.equals(dimensionArray[i])) {
      isOldExist=isSupported;
    }
  }
  String cache=ChartCacheManager.getInstance().getDimension(sSelectedType);
  if (cache != null) {
    sDimension=cache;
    isOldExist=true;
  }
  if (!isOldExist) {
    sDimension=chartType.getDefaultDimension();
  }
  cbDimension.setText(sDimension);
  return !isOldExist;
}
Program: 68983
Project: 68983
Buggy source:
private void populateSeriesTypes(Collection<IChartType> allChartType,Series series,Orientation orientation){
  Iterator<IChartType> iterTypes=allChartType.iterator();
  while (iterTypes.hasNext()) {
    IChartType type=iterTypes.next();
    Series newSeries=type.getSeries();
    if (htSeriesNames == null) {
      htSeriesNames=new Hashtable<String,Series>(20);
    }
    if (type.canCombine()) {
      if (!(newSeries instanceof StockSeries) || (orientation.getValue() == Orientation.VERTICAL)) {
        String sDisplayName=newSeries.getDisplayName();
        htSeriesNames.put(sDisplayName,newSeries);
        cmbTypes.add(sDisplayName);
      }
    }
  }
}

Fixed version (ground truth):
private void populateSeriesTypes(Collection<IChartType> allChartType,Series series,Orientation orientation){
  boolean is25D=getChart().getDimension() == ChartDimension.TWO_DIMENSIONAL_WITH_DEPTH_LITERAL;
  Iterator<IChartType> iterTypes=allChartType.iterator();
  while (iterTypes.hasNext()) {
    IChartType type=iterTypes.next();
    Series newSeries=type.getSeries();
    if (htSeriesNames == null) {
      htSeriesNames=new Hashtable<String,Series>(20);
    }
    if (type.canCombine()) {
      if (newSeries instanceof AreaSeries && is25D) {
        continue;
      }
      if (!(newSeries instanceof StockSeries) || (orientation.getValue() == Orientation.VERTICAL)) {
        String sDisplayName=newSeries.getDisplayName();
        htSeriesNames.put(sDisplayName,newSeries);
        cmbTypes.add(sDisplayName);
      }
    }
  }
}
Program: 68984
Project: 68984
Buggy source:
private void createExpressionCell(Composite parent,String label){
  ControlProvider.createLabel(parent,label);
  defaultValueComposite=ControlProvider.getDefaultComposite(parent);
  defaultValueString=Utility.getNonNullString(structureHandle.getDefaultValue());
  defaultValue=ControlProvider.createText(defaultValueComposite,defaultValueString);
  defaultValue.setLayoutData(ControlProvider.getGridDataWithHSpan(1));
  defaultValue.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      if (defaultValue.isEnabled()) {
        validateSyntax();
      }
    }
  }
);
  SelectionAdapter listener=new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      ExpressionBuilder expressionBuilder=new ExpressionBuilder(defaultValue.getText());
      expressionBuilder.setExpressionProvier(null);
      if (expressionBuilder.open() == OK) {
        defaultValue.setText(expressionBuilder.getResult().trim());
      }
    }
  }
;
  ExpressionProvider provider=new ExpressionProvider((DataSetHandle)getContainer().getModel());
  ExpressionButtonUtil.createExpressionButton(defaultValueComposite,defaultValue,provider,(DataSetHandle)getContainer().getModel(),true,SWT.PUSH);
  ExpressionButtonUtil.initExpressionButtonControl(defaultValue,structureHandle,DataSetParameter.DEFAULT_VALUE_MEMBER);
}

Fixed version (ground truth):
private void createExpressionCell(Composite parent,String label){
  ControlProvider.createLabel(parent,label);
  defaultValueComposite=ControlProvider.getDefaultComposite(parent);
  defaultValueString=Utility.getNonNullString(structureHandle.getDefaultValue());
  defaultValueText=ControlProvider.createText(defaultValueComposite,defaultValueString);
  defaultValueText.setLayoutData(ControlProvider.getGridDataWithHSpan(1));
  defaultValueText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      if (defaultValueText.isEnabled()) {
        validateSyntax();
      }
    }
  }
);
  SelectionAdapter listener=new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      ExpressionBuilder expressionBuilder=new ExpressionBuilder(defaultValueText.getText());
      expressionBuilder.setExpressionProvier(null);
      if (expressionBuilder.open() == OK) {
        defaultValueText.setText(expressionBuilder.getResult().trim());
      }
    }
  }
;
  ExpressionProvider provider=new ExpressionProvider((DataSetHandle)getContainer().getModel());
  ExpressionButtonUtil.createExpressionButton(defaultValueComposite,defaultValueText,provider,(DataSetHandle)getContainer().getModel(),true,SWT.PUSH);
  ExpressionButtonUtil.initExpressionButtonControl(defaultValueText,structureHandle,DataSetParameter.DEFAULT_VALUE_MEMBER);
}
Program: 68985
Project: 68985
Buggy source:
private void directionChanged(){
  if (isOutputParameter()) {
    enableComposite(defaultValueComposite,false);
    defaultValue.setText("String_Node_Str");
    defaultValueString="String_Node_Str";
    if (isOdaDataSetHandle) {
      enableComposite(reportParamComposite,false);
      linkToSalarParameter.select(0);
    }
  }
 else {
    if (isOdaDataSetHandle) {
      enableComposite(reportParamComposite,true);
      linkToSalarParameterChanged();
    }
 else {
      enableComposite(defaultValueComposite,true);
    }
  }
}

Fixed version (ground truth):
private void directionChanged(){
  if (isOutputParameter()) {
    enableComposite(defaultValueComposite,false);
    defaultValueText.setText("String_Node_Str");
    defaultValueString="String_Node_Str";
    if (isOdaDataSetHandle) {
      enableComposite(reportParamComposite,false);
      linkToSalarParameter.select(0);
    }
  }
 else {
    if (isOdaDataSetHandle) {
      enableComposite(reportParamComposite,true);
      linkToSalarParameterChanged();
    }
 else {
      enableComposite(defaultValueComposite,true);
    }
  }
}
Program: 68986
Project: 68986
Buggy source:
private Status updateStructureHandle(){
  try {
    structureHandle.setName(dataSetParamName.getText());
    structureHandle.setParameterDataType(ParameterPageUtil.getTypeName(dataType.getText()));
    setDirection(direction.getText());
    ExpressionButtonUtil.saveExpressionButtonControl(defaultValue,structureHandle,DataSetParameter.DEFAULT_VALUE_MEMBER);
    if (isOdaDataSetHandle)     ((OdaDataSetParameterHandle)structureHandle).setParamName(Utility.findIndex(linkToSalarParameter.getItems(),linkToSalarParameter.getText()) == 0 ? null : linkToSalarParameter.getText());
  }
 catch (  SemanticException e) {
    return getMiscStatus(IStatus.ERROR,Utility.getNonNullString(e.getMessage()));
  }
  return null;
}

Fixed version (ground truth):
private Status updateStructureHandle(){
  try {
    structureHandle.setName(dataSetParamName.getText());
    structureHandle.setParameterDataType(ParameterPageUtil.getTypeName(dataType.getText()));
    setDirection(direction.getText());
    if (defaultValueText.isEnabled())     ExpressionButtonUtil.saveExpressionButtonControl(defaultValueText,structureHandle,DataSetParameter.DEFAULT_VALUE_MEMBER);
    if (isOdaDataSetHandle)     ((OdaDataSetParameterHandle)structureHandle).setParamName(Utility.findIndex(linkToSalarParameter.getItems(),linkToSalarParameter.getText()) == 0 ? null : linkToSalarParameter.getText());
  }
 catch (  SemanticException e) {
    return getMiscStatus(IStatus.ERROR,Utility.getNonNullString(e.getMessage()));
  }
  return null;
}
Program: 68987
Project: 68987
Buggy source:
private void linkToSalarParameterChanged(){
  String paramName=Utility.findIndex(linkToSalarParameter.getItems(),linkToSalarParameter.getText()) == 0 ? null : linkToSalarParameter.getText();
  if (paramName == null) {
    enableComposite(defaultValueComposite,linkToSalarParameter.isEnabled());
    defaultValue.setText(NONE_DEFAULT_VALUE.equals(defaultValueString) ? "String_Node_Str" : defaultValueString);
  }
 else {
    if (defaultValue.isEnabled())     defaultValueString=defaultValue.getText();
    structureHandle.setDefaultValue("String_Node_Str");
    enableComposite(defaultValueComposite,false);
    defaultValue.setText(NONE_DEFAULT_VALUE);
  }
}

Fixed version (ground truth):
private void linkToSalarParameterChanged(){
  String paramName=Utility.findIndex(linkToSalarParameter.getItems(),linkToSalarParameter.getText()) == 0 ? null : linkToSalarParameter.getText();
  if (paramName == null) {
    enableComposite(defaultValueComposite,linkToSalarParameter.isEnabled());
    defaultValueText.setText(defaultValueString);
  }
 else {
    if (defaultValueText.isEnabled())     defaultValueString=defaultValueText.getText();
    enableComposite(defaultValueComposite,false);
    defaultValueText.setText(NONE_DEFAULT_VALUE);
  }
}
Program: 68988
Project: 68988
Buggy source:
public void startLabel(ILabelContent label){
  Object design=label.getGenerateBy();
  IContent container=label;
  while (design == null) {
    container=(IContent)container.getParent();
    design=((IContent)container).getGenerateBy();
  }
  HyperlinkDef url=parseHyperLink(label);
  BookmarkDef bookmark=getBookmark(label);
  if (!("String_Node_Str".equalsIgnoreCase(label.getText()) && container instanceof IForeignContent)) {
    engine.addData(label.getText(),label.getComputedStyle(),url,bookmark);
  }
}

Fixed version (ground truth):
public void startLabel(ILabelContent label){
  Object design=label.getGenerateBy();
  IContent container=label;
  while (design == null) {
    container=(IContent)container.getParent();
    design=((IContent)container).getGenerateBy();
  }
  HyperlinkDef url=parseHyperLink(label);
  BookmarkDef bookmark=getBookmark(label);
  if (!("String_Node_Str".equalsIgnoreCase(label.getText()) && container instanceof IForeignContent)) {
    double height=getContentHeight(label);
    engine.addData(label.getText(),label.getComputedStyle(),url,bookmark,height);
  }
}
Program: 68989
Project: 68989
Buggy source:
public void startAutoText(IAutoTextContent autoText){
  HyperlinkDef link=parseHyperLink(autoText);
  BookmarkDef bookmark=getBookmark(autoText);
  engine.addData(autoText.getText(),autoText.getComputedStyle(),link,bookmark);
}

Fixed version (ground truth):
public void startAutoText(IAutoTextContent autoText){
  HyperlinkDef link=parseHyperLink(autoText);
  BookmarkDef bookmark=getBookmark(autoText);
  double height=getContentHeight(autoText);
  engine.addData(autoText.getText(),autoText.getComputedStyle(),link,bookmark,height);
}
Program: 68990
Project: 68990
Buggy source:
public void startList(IListContent list){
  ContainerSizeInfo size=engine.getCurrentContainer().getSizeInfo();
  ColumnsInfo table=LayoutUtil.createTable(list,size.getWidth());
  engine.addTable(list,table,size);
  if (list.getChildren() == null) {
    HyperlinkDef link=parseHyperLink(list);
    BookmarkDef bookmark=getBookmark(list);
    engine.addData(ExcelLayoutEngine.EMPTY,list.getComputedStyle(),link,bookmark);
  }
}

Fixed version (ground truth):
public void startList(IListContent list){
  ContainerSizeInfo size=engine.getCurrentContainer().getSizeInfo();
  ColumnsInfo table=LayoutUtil.createTable(list,size.getWidth());
  engine.addTable(list,table,size);
  if (list.getChildren() == null) {
    HyperlinkDef link=parseHyperLink(list);
    BookmarkDef bookmark=getBookmark(list);
    double height=getContentHeight(list);
    engine.addData(ExcelLayoutEngine.EMPTY,list.getComputedStyle(),link,bookmark,height);
  }
}
Program: 68991
Project: 68991
Buggy source:
public void startText(ITextContent text){
  HyperlinkDef url=parseHyperLink(text);
  BookmarkDef bookmark=getBookmark(text);
  engine.addData(text.getText(),text.getComputedStyle(),url,bookmark);
}

Fixed version (ground truth):
public void startText(ITextContent text){
  HyperlinkDef url=parseHyperLink(text);
  BookmarkDef bookmark=getBookmark(text);
  double height=getContentHeight(text);
  engine.addData(text.getText(),text.getComputedStyle(),url,bookmark,height);
}
Program: 68992
Project: 68992
Buggy source:
protected Data addDataContent(IDataContent data){
  HyperlinkDef url=parseHyperLink(data);
  BookmarkDef bookmark=getBookmark(data);
  Data excelData=null;
  Object generateBy=data.getGenerateBy();
  IStyle style=data.getComputedStyle();
  DataFormatValue dataformat=style.getDataFormat();
  MapDesign map=null;
  if (generateBy instanceof DataItemDesign) {
    DataItemDesign design=(DataItemDesign)generateBy;
    map=design.getMap();
  }
  if (map != null && map.getRuleCount() > 0 && data.getLabelText() != null) {
    excelData=engine.addData(data.getLabelText().trim(),style,url,bookmark);
  }
 else {
    String locale=null;
    int type=ExcelUtil.getType(data.getValue());
    if (type == SheetData.STRING) {
      if (dataformat != null) {
        locale=dataformat.getStringLocale();
      }
      excelData=engine.addData(data.getText(),style,url,bookmark,locale);
    }
 else     if (type == Data.NUMBER) {
      if (dataformat != null) {
        locale=dataformat.getNumberLocale();
      }
      excelData=engine.addData(data.getValue(),style,url,bookmark,locale);
    }
 else {
      if (dataformat != null) {
        locale=dataformat.getDateTimeLocale();
      }
      excelData=engine.addDateTime(data,style,url,bookmark,locale);
    }
  }
  return excelData;
}

Fixed version (ground truth):
protected Data addDataContent(IDataContent data){
  double height=getContentHeight(data);
  HyperlinkDef url=parseHyperLink(data);
  BookmarkDef bookmark=getBookmark(data);
  Data excelData=null;
  Object generateBy=data.getGenerateBy();
  IStyle style=data.getComputedStyle();
  DataFormatValue dataformat=style.getDataFormat();
  MapDesign map=null;
  if (generateBy instanceof DataItemDesign) {
    DataItemDesign design=(DataItemDesign)generateBy;
    map=design.getMap();
  }
  if (map != null && map.getRuleCount() > 0 && data.getLabelText() != null) {
    excelData=engine.addData(data.getLabelText().trim(),style,url,bookmark,height);
  }
 else {
    String locale=null;
    int type=ExcelUtil.getType(data.getValue());
    if (type == SheetData.STRING) {
      if (dataformat != null) {
        locale=dataformat.getStringLocale();
      }
      excelData=engine.addData(data.getText(),style,url,bookmark,locale,height);
    }
 else     if (type == Data.NUMBER) {
      if (dataformat != null) {
        locale=dataformat.getNumberLocale();
      }
      excelData=engine.addData(data.getValue(),style,url,bookmark,locale,height);
    }
 else {
      if (dataformat != null) {
        locale=dataformat.getDateTimeLocale();
      }
      excelData=engine.addDateTime(data,style,url,bookmark,locale,height);
    }
  }
  return excelData;
}