Bug 65085 - LineRect shall throw more specific exceptions
Summary: LineRect shall throw more specific exceptions
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-16 07:40 UTC by zhonghao
Modified: 2021-05-02 22:04 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zhonghao 2021-01-16 07:40:59 UTC
LineRect#getRowHeight and LineRect#setRowHeight throw IllegalArgumentException:

 public double getRowHeight(int row) {
        if (row < 0 || row >= cells.length) {
            throw new IllegalArgumentException("Row index '"+row+"' is not within range [0-"+(cells.length-1)+"]");
        }
        
        return cells[row][0].getAnchor().getHeight();
    }
    
    @Override
    public void setRowHeight(int row, final double height) {
        if (row < 0 || row >= cells.length) {
            throw new IllegalArgumentException("Row index '"+row+"' is not within range [0-"+(cells.length-1)+"]");
        }
        ...
}

In both cases, it is more reasonable to throw IndexOutOfBoundsException.
Comment 1 Andreas Beeker 2021-05-02 22:04:26 UTC
Thank you for the info - fixed via r1889428