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 2013/08/07 20:29:59 UTC

[Bug 55380] New: Adding conditional formatting gets stuck in endless loop

https://issues.apache.org/bugzilla/show_bug.cgi?id=55380

            Bug ID: 55380
           Summary: Adding conditional formatting gets stuck in endless
                    loop
           Product: POI
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: y.shahun@gmail.com

Adding conditional formatting with certain set of ranges gets stuck in endless
loop.

Test code to reproduce:

Workbook workbook = new HSSFWorkbook();
Sheet sheet = workbook.createSheet();
CellRangeAddress[] ranges = new CellRangeAddress[] {
    CellRangeAddress.valueOf("C9:D30"), CellRangeAddress.valueOf("C7:C31")
};
ConditionalFormattingRule rule =
sheet.getSheetConditionalFormatting().createConditionalFormattingRule("$A$1>0");
sheet.getSheetConditionalFormatting().addConditionalFormatting(ranges, rule);

Debugging shows that code gets stuck in
org.apache.poi.hssf.record.cf.CellRangeUtil.mergeCellRanges(List) method on
repeated merging/unmerging regions.

-- 
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 55380] Adding conditional formatting gets stuck in endless loop

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

--- Comment #5 from Dominik Stadler <do...@gmx.at> ---
It happens with Overlapping Regions (i.e. not enclosing/inside and not
no_intersection), the handling of this case is quite complex and seems to be
buggy, I would propose to simply remove this for now as it only would be able
to merge some rare cases and obviously does not do that well anyway right now. 

Any objections to the removal of this code-pieces, i.e. resolveRangeOverlap()
and related methods?

-- 
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 55380] Adding conditional formatting gets stuck in endless loop

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

--- Comment #2 from Yauheni Shahun <y....@gmail.com> ---
I verified that this happens for XSSF too because the same CellRangeUtil class
is used.

-- 
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 55380] Adding conditional formatting gets stuck in endless loop

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

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Does this happen for XSSF too? (That'll help us narrow down if it's common code
that's broken, or HSSF specific code that's the problem)

-- 
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 55380] Adding conditional formatting gets stuck in endless loop

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

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
A simplified reproducer is as follows:

    public void testMergeCellRanges55380() {
        CellRangeAddress cr1 = CellRangeAddress.valueOf("C9:D30");
        CellRangeAddress cr2 = CellRangeAddress.valueOf("C7:C31");
        CellRangeAddress[] cr3 = CellRangeUtil.mergeCellRanges(new
CellRangeAddress[]{cr1, cr2});   // endless loop...
        assertEquals(2, cr3.length);
        assertEquals("C9:D30", cr3[0].formatAsString());
        assertEquals("C7:C31", cr3[1].formatAsString());
    }

-- 
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 55380] Adding conditional formatting gets stuck in endless loop

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

--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
Stacktrace when it hangs: 

    CellRangeUtil.mergeCellRanges(List) line: 118    
    CellRangeUtil.mergeCellRanges(CellRangeAddress[]) line: 101    
    CFHeaderRecord.<init>(CellRangeAddress[], int) line: 45    
    CFRecordsAggregate.<init>(CellRangeAddress[], CFRuleRecord[]) line: 72    
    HSSFSheetConditionalFormatting.addConditionalFormatting(CellRangeAddress[],
HSSFConditionalFormattingRule[]) line: 155    
    HSSFSheetConditionalFormatting.addConditionalFormatting(CellRangeAddress[],
HSSFConditionalFormattingRule) line: 172    
    HSSFSheetConditionalFormatting.addConditionalFormatting(CellRangeAddress[],
ConditionalFormattingRule) line: 182    
    TestHSSFConditionalFormatting(BaseTestConditionalFormatting).testBug55380()
line: 698

-- 
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 55380] Adding conditional formatting gets stuck in endless loop

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

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

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

--- Comment #6 from Dominik Stadler <do...@gmx.at> ---
For now I have removed merging of overlapping regions to avoid the endless
loops in the implementation of the mergeCellRanges(). None of the unit tests
stepped into the method, so the code was untested and probably never fully
worked at all or was broken sometimes back by other changes.

-- 
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 55380] Adding conditional formatting gets stuck in endless loop

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

Yauheni Shahun <y....@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |y.shahun@gmail.com

-- 
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