You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/02/24 21:12:01 UTC

[Bug 62130] New: XSSFRow can loose sync between CTRow and XSSFCell references to CTCell instances

https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

            Bug ID: 62130
           Summary: XSSFRow can loose sync between CTRow and XSSFCell
                    references to CTCell instances
           Product: POI
           Version: 3.17-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: gwoolsey@apache.org
  Target Milestone: ---

The fix for bug #56170 fixed some use cases of this, but is overly aggressive
in looking for cases to do nothing.  Turns out there are too many ways the
CTRow object's collection of CTCell objects can become stale compared to the
XSSFCell collection held by XSSFRow.  Since the XSSF* values are the canonical
ones, we should, on document write, always update the CTRow object to match the
XSSFCell values.

This test case shows the problem, failing with 3.17 and 4.0 current trunk,
because the saved value came from a stale CTRow:

@Test
public void testMultipleEditWriteCycles() {
        final XSSFWorkbook wb1 = new XSSFWorkbook();
        final XSSFSheet sheet1 = wb1.createSheet("Sheet1");
        final XSSFRow srcRow = sheet1.createRow(0);
        srcRow.createCell(0).setCellValue("hello");
        srcRow.createCell(3).setCellValue("world");

        // discard result
        XSSFTestDataSamples.writeOutAndReadBack(wb1);
        srcRow.createCell(1).setCellValue("cruel");
        // discard result
        XSSFTestDataSamples.writeOutAndReadBack(wb1);

        srcRow.getCell(1).setCellValue((RichTextString) null);

        XSSFWorkbook wb3 = XSSFTestDataSamples.writeOutAndReadBack(wb1);
        assertEquals("Cell not blank"
                    , CellType.BLANK
                    ,
wb3.getSheet("Sheet1").getRow(0).getCell(1).getCellType());
}

The solution is to remove the extra logic from XSSFRow.onDocumentWrite() and
always perform the update to CTRow at that point.  Otherwise, multiple
edit/write cycles to the workbook will result in saved copies that don't match
the logical structure of the original.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62130] XSSFRow can lose sync between CTRow and XSSFCell references to CTCell instances

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |63657


Referenced Bugs:

https://bz.apache.org/bugzilla/show_bug.cgi?id=63657
[Bug 63657] Memory usage increase during writing Documents introduced in 4.0.0
-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62130] XSSFRow can lose sync between CTRow and XSSFCell references to CTCell instances

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

--- Comment #3 from frank@tygron.com ---
I can confirm that this fixed my issue as well (bug #62130). 
Thanks for providing the fix on such short notice!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62130] XSSFRow can loose sync between CTRow and XSSFCell references to CTCell instances

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

Greg Woolsey <gw...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #1 from Greg Woolsey <gw...@apache.org> ---
Fixed in r1825277.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62130] XSSFRow can lose sync between CTRow and XSSFCell references to CTCell instances

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

Greg Woolsey <gr...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |frank@tygron.com

--- Comment #2 from Greg Woolsey <gr...@gmail.com> ---
*** Bug 62484 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62130] XSSFRow can lose sync between CTRow and XSSFCell references to CTCell instances

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|XSSFRow can loose sync      |XSSFRow can lose sync
                   |between CTRow and XSSFCell  |between CTRow and XSSFCell
                   |references to CTCell        |references to CTCell
                   |instances                   |instances

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org