Bug 59789

Summary: Improve performance of row shifting on sheets that contain comments
Product: POI Reporter: Javen O'Neal <onealj>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.15-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Javen O'Neal 2016-07-04 02:28:17 UTC
Found by Findbugs on POI-JDK8

HSSFSheet.java:1565, RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT, Priority: Normal

Return value of org.apache.poi.hssf.model.InternalSheet.getNoteRecords() ignored, but method has no side effect

if (moveComments) {
    _sheet.getNoteRecords()
}
Comment 1 Javen O'Neal 2016-07-04 03:06:31 UTC
HSSFComment shifting was already done inside the main for-loop, but had pretty terrible performance because it searched the drawing patriarch for all comments for ever row in the shift range.

Assuming all NoteRecords are HSSFComments, we can move the comment shifting that's done inside the main for-loop outside so that only one search for HSSFComments in the drawing patriarch is necessary.

Applied in r1751198.