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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
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: [hidden email]
          Reporter: [hidden email]
  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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

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

Greg Woolsey <[hidden email]> changed:

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

--- Comment #1 from Greg Woolsey <[hidden email]> ---
Fixed in r1825277.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

Javen O'Neal <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

Greg Woolsey <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #2 from Greg Woolsey <[hidden email]> ---
*** 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

--- Comment #3 from [hidden email] ---
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62130

Dominik Stadler <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]