Bug 57828 - Shifting rows with cell comments only shifts comments from first such cell. Other cell comments not shifted
Summary: Shifting rows with cell comments only shifts comments from first such cell. O...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.12-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on: 56017
Blocks:
  Show dependency tree
 
Reported: 2015-04-17 19:37 UTC by Balaji Venkatamohan
Modified: 2015-04-20 20:25 UTC (History)
0 users



Attachments
Source folder of java project (10.61 KB, application/zip)
2015-04-17 19:41 UTC, Balaji Venkatamohan
Details
Source folder containing corrected test class ShowShiftRowsWithCommentsBugTest (10.10 KB, application/zip)
2015-04-20 19:54 UTC, Balaji Venkatamohan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Balaji Venkatamohan 2015-04-17 19:37:24 UTC
I am using POI for simple CRUD operations on excel files. Once such operation is deleting and shifting of rows in a sheet. Unfortunately, both these operations don't work as expected when a row that I need to delete/shift has one or more cell comments.

I noticed the following line in this page https://poi.apache.org/changes.html :
56017 - Fix shifting comments with shifted rows

Since POI 3.12 beta 2 is not out yet, I used the latest stable SVN revision 1674025 to download the source code and followed the build instructions to build the 3.12 beta2 binaries.

I used a simple stand alone program to shift rows with comments in an excel sheet using POI apis.
When a row has only one cell comment, that row is being properly shifted. However, when a row has more than one cell with comments, only the first comment gets properly shifted along with its cell. The other remaining comments stay in that exact same cell number/row number position with only the corresponding cell's data being shifted.

Attaching a simple java project with a Junit test class ShowShiftRowsWithCommentsBugTest.java . Please note all the jars needed are under libs folder of this project. The excel sheet is also in the classpath /src/resources/deletewithcomments.xlsx
Comment 1 Balaji Venkatamohan 2015-04-17 19:41:04 UTC
Created attachment 32658 [details]
Source folder of java project

The POI libs I used were built from SVN revision 1674025 of POI source code.
Comment 2 Dominik Stadler 2015-04-20 19:38:44 UTC
Please provide unit tests in a way that fail as long as the bug is present. Because the unit test that you provided runs green when the bug is there, I thought it is actually fixed, loosing quite some time until I found out that your unit test is actually broken! :(
Comment 3 Balaji Venkatamohan 2015-04-20 19:54:53 UTC
Created attachment 32667 [details]
Source folder containing corrected test class ShowShiftRowsWithCommentsBugTest

Sorry, I misunderstood your email. 
I have added the relevant comments in the class ShowShiftRowsWithCommentsBugTest.java.
Now the test method bugOnlyOneCommentShiftedInRow() will fail as long as the bug exists in POI.

Attaching the source folder zip again.
Thanks
Comment 4 Dominik Stadler 2015-04-20 20:16:57 UTC
Thanks for the update, I have fixed this bug now, it's available at r1674975 and will be part of 3.12-beta2 or 3.12, whichever comes first.
Comment 5 Balaji Venkatamohan 2015-04-20 20:25:29 UTC
Thank you Dominik. Much appreciated. I will check out revision r1674975.