Program: 56610
Project: 56610
Buggy source:
/** 
 * Cell attributes <ul> <li>r: row number</li> <li>c: column number</li> <li>w: width index</li> <li>h: height index</li> <li>t: cell html text</li> <li>et: cell edit text</li> <li>ft: format text</li> <li>meft: merge cell html text, edit text and format text</li> <li>ct: cell type</li> <li>s: cell style</li> <li>is: cell inner style</li> <li>rb: cell right border</li> <li>l: locked</> <li>wp: wrap</li> <li>ha: horizontal alignment</> <li>va: vertical alignment</> <li>mi: merge id index</li> <li>mc: merge CSS index</li> <li>rf: Cell Reference</li> <li>fs: font size</li> <li>ovf: overflow</li> </ul> Ignore put attribute if it's default Default attributes <ul> <li>Cell type: blank</> <li>Locked: true</> <li>Wrap: false</li> <li>Horizontal alignment: left</> <li>Vertical alignment: top</> <li>Overflow: false</li> <li>Font size: 11pt</> </ul>
 */
public JSONObject getCellAttr(Worksheet sheet,CellAttribute type,int row,int col,StringAggregation styleAggregation,StringAggregation textAggregation,MergeAggregation mergeAggregation){
  boolean updateAll=type == CellAttribute.ALL, updateText=(updateAll || type == CellAttribute.TEXT), updateStyle=(updateAll || type == CellAttribute.STYLE), updateSize=(updateAll || type == CellAttribute.SIZE), updateMerge=(updateAll || type == CellAttribute.MERGE);
  Cell cell=Utils.getCell(sheet,row,col);
  JSONObject attrs=new JSONObject();
  CellReference cr=new CellReference(row,col,false,false);
  attrs.put("String_Node_Str",cr.formatAsString());
  MergeIndex mergeIndex=mergeAggregation.add(row,col);
  if (updateMerge && mergeIndex != null) {
    attrs.put("String_Node_Str",mergeIndex.getMergeId());
    attrs.put("String_Node_Str",mergeIndex.getMergeCSSId());
  }
  if (updateSize) {
    HeaderPositionHelper colHelper=Spreadsheet.this.getColumnPositionHelper(sheet);
    HeaderPositionInfo info=colHelper.getInfo(col);
    if (info != null && info.id >= 0) {
      attrs.put("String_Node_Str",info.id);
    }
    if (cell != null) {
      CellStyle cellStyle=cell.getCellStyle();
      if (cell.getCellType() == Cell.CELL_TYPE_STRING && mergeIndex == null && !cellStyle.getWrapText() && BookHelper.getRealAlignment(cell) == CellStyle.ALIGN_LEFT) {
        attrs.put("String_Node_Str",1);
        int c=getMaxOverflowableCellIndex(cell,sheet.getRow(row));
        if (c != col) {
          attrs.put("String_Node_Str",c);
        }
      }
    }
  }
  if (updateStyle) {
    CellFormatHelper cfh=new CellFormatHelper(sheet,row,col,getMergeMatrixHelper(sheet));
    String style=cfh.getHtmlStyle();
    if (!Strings.isEmpty(style)) {
      int idx=styleAggregation.add(style);
      attrs.put("String_Node_Str",idx);
    }
    String innerStyle=cfh.getInnerHtmlStyle();
    if (!Strings.isEmpty(innerStyle)) {
      int idx=styleAggregation.add(innerStyle);
      attrs.put("String_Node_Str",idx);
    }
    if (cfh.hasRightBorder()) {
      attrs.put("String_Node_Str",1);
    }
  }
  if (cell != null) {
    int cellType=cell.getCellType();
    if (cellType != Cell.CELL_TYPE_BLANK)     attrs.put("String_Node_Str",cellType);
    if (updateText) {
      if (cellType != Cell.CELL_TYPE_BLANK) {
        final String cellText=getCelltext(Spreadsheet.this,row,col);
        final String editText=getEdittext(Spreadsheet.this,row,col);
        final String formatText=getCellFormatText(Spreadsheet.this,row,col);
        if (Objects.equals(cellText,editText) && Objects.equals(editText,formatText)) {
          attrs.put("String_Node_Str",textAggregation.add(cellText));
        }
 else {
          attrs.put("String_Node_Str",textAggregation.add(cellText));
          attrs.put("String_Node_Str",textAggregation.add(editText));
          attrs.put("String_Node_Str",textAggregation.add(formatText));
        }
      }
    }
    if (updateStyle) {
      CellStyle cellStyle=cell.getCellStyle();
      boolean locked=cellStyle.getLocked();
      if (!locked)       attrs.put("String_Node_Str","String_Node_Str");
      boolean wrap=cellStyle.getWrapText();
      if (wrap)       attrs.put("String_Node_Str",1);
      int horizontalAlignment=BookHelper.getRealAlignment(cell);
switch (horizontalAlignment) {
case CellStyle.ALIGN_CENTER:
case CellStyle.ALIGN_CENTER_SELECTION:
        attrs.put("String_Node_Str","String_Node_Str");
      break;
case CellStyle.ALIGN_RIGHT:
    attrs.put("String_Node_Str","String_Node_Str");
  break;
}
int verticalAlignment=cellStyle.getVerticalAlignment();
switch (verticalAlignment) {
case CellStyle.VERTICAL_TOP:
attrs.put("String_Node_Str","String_Node_Str");
break;
case CellStyle.VERTICAL_CENTER:
attrs.put("String_Node_Str","String_Node_Str");
break;
}
Font font=_book.getFontAt(cellStyle.getFontIndex());
short fontHeight=font.getFontHeightInPoints();
if (fontHeight != XSSFFont.DEFAULT_FONT_SIZE) {
attrs.put("String_Node_Str",fontHeight);
}
}
}
return attrs;
}

Fixed version (ground truth):
/** 
 * Cell attributes <ul> <li>r: row number</li> <li>c: column number</li> <li>w: width index</li> <li>h: height index</li> <li>t: cell html text</li> <li>et: cell edit text</li> <li>ft: format text</li> <li>meft: merge cell html text, edit text and format text</li> <li>ct: cell type</li> <li>s: cell style</li> <li>is: cell inner style</li> <li>rb: cell right border</li> <li>l: locked</> <li>wp: wrap</li> <li>ha: horizontal alignment</> <li>va: vertical alignment</> <li>mi: merge id index</li> <li>mc: merge CSS index</li> <li>rf: Cell Reference</li> <li>fs: font size</li> <li>ovf: overflow</li> </ul> Ignore put attribute if it's default Default attributes <ul> <li>Cell type: blank</> <li>Locked: true</> <li>Wrap: false</li> <li>Horizontal alignment: left</> <li>Vertical alignment: top</> <li>Overflow: false</li> <li>Font size: 11pt</> </ul>
 */
public JSONObject getCellAttr(Worksheet sheet,CellAttribute type,int row,int col,StringAggregation styleAggregation,StringAggregation textAggregation,MergeAggregation mergeAggregation){
  boolean updateAll=type == CellAttribute.ALL, updateText=(updateAll || type == CellAttribute.TEXT), updateStyle=(updateAll || type == CellAttribute.STYLE), updateSize=(updateAll || type == CellAttribute.SIZE), updateMerge=(updateAll || type == CellAttribute.MERGE);
  Cell cell=Utils.getCell(sheet,row,col);
  JSONObject attrs=new JSONObject();
  CellReference cr=new CellReference(row,col,false,false);
  attrs.put("String_Node_Str",cr.formatAsString());
  MergeIndex mergeIndex=mergeAggregation.add(row,col);
  if (updateMerge && mergeIndex != null) {
    attrs.put("String_Node_Str",mergeIndex.getMergeId());
    attrs.put("String_Node_Str",mergeIndex.getMergeCSSId());
  }
  if (updateSize) {
    HeaderPositionHelper colHelper=Spreadsheet.this.getColumnPositionHelper(sheet);
    HeaderPositionInfo info=colHelper.getInfo(col);
    if (info != null && info.id >= 0) {
      attrs.put("String_Node_Str",info.id);
    }
    if (cell != null) {
      CellStyle cellStyle=cell.getCellStyle();
      if (cell.getCellType() == Cell.CELL_TYPE_STRING && mergeIndex == null && !cellStyle.getWrapText() && BookHelper.getRealAlignment(cell) == CellStyle.ALIGN_LEFT) {
        attrs.put("String_Node_Str",1);
        int c=getMaxOverflowableCellIndex(cell,sheet.getRow(row));
        if (c != col) {
          attrs.put("String_Node_Str",c);
        }
      }
    }
  }
  if (updateStyle) {
    CellFormatHelper cfh=new CellFormatHelper(sheet,row,col,getMergeMatrixHelper(sheet));
    String style=cfh.getHtmlStyle();
    if (!Strings.isEmpty(style)) {
      int idx=styleAggregation.add(style);
      attrs.put("String_Node_Str",idx);
    }
    String innerStyle=cfh.getInnerHtmlStyle();
    if (!Strings.isEmpty(innerStyle)) {
      int idx=styleAggregation.add(innerStyle);
      attrs.put("String_Node_Str",idx);
    }
    if (cfh.hasRightBorder()) {
      attrs.put("String_Node_Str",1);
    }
  }
  if (cell != null) {
    int cellType=cell.getCellType();
    if (cellType != Cell.CELL_TYPE_BLANK)     attrs.put("String_Node_Str",cellType);
    if (updateText) {
      if (cellType != Cell.CELL_TYPE_BLANK) {
        final String cellText=getCelltext(sheet,row,col);
        final String editText=getEdittext(sheet,row,col);
        final String formatText=getCellFormatText(sheet,row,col);
        if (Objects.equals(cellText,editText) && Objects.equals(editText,formatText)) {
          attrs.put("String_Node_Str",textAggregation.add(cellText));
        }
 else {
          attrs.put("String_Node_Str",textAggregation.add(cellText));
          attrs.put("String_Node_Str",textAggregation.add(editText));
          attrs.put("String_Node_Str",textAggregation.add(formatText));
        }
      }
    }
    if (updateStyle) {
      CellStyle cellStyle=cell.getCellStyle();
      boolean locked=cellStyle.getLocked();
      if (!locked)       attrs.put("String_Node_Str","String_Node_Str");
      boolean wrap=cellStyle.getWrapText();
      if (wrap)       attrs.put("String_Node_Str",1);
      int horizontalAlignment=BookHelper.getRealAlignment(cell);
switch (horizontalAlignment) {
case CellStyle.ALIGN_CENTER:
case CellStyle.ALIGN_CENTER_SELECTION:
        attrs.put("String_Node_Str","String_Node_Str");
      break;
case CellStyle.ALIGN_RIGHT:
    attrs.put("String_Node_Str","String_Node_Str");
  break;
}
int verticalAlignment=cellStyle.getVerticalAlignment();
switch (verticalAlignment) {
case CellStyle.VERTICAL_TOP:
attrs.put("String_Node_Str","String_Node_Str");
break;
case CellStyle.VERTICAL_CENTER:
attrs.put("String_Node_Str","String_Node_Str");
break;
}
Font font=_book.getFontAt(cellStyle.getFontIndex());
short fontHeight=font.getFontHeightInPoints();
if (fontHeight != XSSFFont.DEFAULT_FONT_SIZE) {
attrs.put("String_Node_Str",fontHeight);
}
}
}
return attrs;
}