Bug 62828

Summary: CellReference(Cell) ctor does not initialize sheetName
Product: POI Reporter: David Gauntt <dmgauntt>
Component: SS CommonAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 4.0.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.1   
Bug Depends on:    
Bug Blocks: 63509    

Description David Gauntt 2018-10-15 16:42:11 UTC
Calling the constructor new CellReference(cell) does not initialize the sheet name.  When the unit test code below is run, the following is written to System.out:

goodCellRef='Ctor test'!$A$1

Unit test code follows:

  private static void cellReferenceCtorTest(XSSFWorkbook workbook) {
    final XSSFSheet sheet = workbook.createSheet("Ctor test");
    final String sheetName = sheet.getSheetName();
    final XSSFRow row = sheet.createRow(0);
    final XSSFCell cell = row.createCell(0);
    final CellReference goodCellRef = new CellReference(sheetName, cell.getRowIndex(), cell.getColumnIndex(), true,
    final CellReference badCellRef = new CellReference(cell);

    System.out.println(String.format("goodCellRef=%s", goodCellRef.formatAsString()));
    System.out.println(String.format("badCellRef=%s", badCellRef.formatAsString()));
Comment 1 gallon.fizik@gmail.com 2019-01-02 22:11:09 UTC
Fixed via r1850210. Thanks to David Gauntt for the report.