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 2009/11/16 11:52:19 UTC

DO NOT REPLY [Bug 48202] New: CellRangeUtil.mergeCellRanges() causes UnsupportedOperationException due to modifying a read-only list

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

           Summary: CellRangeUtil.mergeCellRanges() causes
                    UnsupportedOperationException due to modifying a
                    read-only list
           Product: POI
           Version: 3.5-FINAL
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: Karl.Eilebrecht@freenet.de


Steps to reproduce:
- create an array of CellRangeAddress objects, where at least two are direct 
  neighbours.
- call CellRangeUtil.mergeCellRanges(array)
- You should see an UnsupportedOperationException thrown by AbstractList

Analysis:
The public method CellRangeUtil.mergeCellRanges() wraps an array into an
ArrayList using Arrays.asList(...) to pass the result to the corresponding
private method mergeCellRanges().

Under certain conditions mergeCellRanges() will try to shrink the list to a
smaller size. The error occurs because structural modification of a wrapped
Array is impossible.

Problem: CellRangeUtil line 99, error occurs at line 124

Proposed solution: Copy the array into a list rather than creating a list view
of the array.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 48202] CellRangeUtil.mergeCellRanges() causes UnsupportedOperationException due to modifying a read-only list

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

Karl Eilebrecht <Ka...@freenet.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Karl.Eilebrecht@freenet.de

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 48202] CellRangeUtil.mergeCellRanges() causes UnsupportedOperationException due to modifying a read-only list

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

Yegor Kozlov <ye...@dinom.ru> changed:

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

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2009-12-19 03:33:15 UTC ---
Fixed in r892462, junit added. 

Your proposed solution is correct: the List in mergeCellRanges can be
structurally modified and this method should copy the input array into the
list, not use a list view of the input array.

Thanks,
Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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