Bug 65085 - LineRect shall throw more specific exceptions
Summary: LineRect shall throw more specific exceptions
Status: NEW
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-01-23 13:07 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.