From 1f056652b7c23687b4d023b76d327822d34a7893 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 17 Sep 2007 16:54:40 +0000 Subject: [PATCH] Fix for rows between 32767 and 65536, don't incorrectly cast to a short (fixes #43401) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@576519 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/record/aggregates/RowRecordsAggregate.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java b/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java index 44d37de36..bed1f0748 100644 --- a/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java +++ b/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java @@ -76,11 +76,13 @@ public class RowRecordsAggregate public RowRecord getRow(int rownum) { + // Row must be between 0 and 65535 + if(rownum < 0 || rownum > 65535) { + throw new IllegalArgumentException("The row number must be between 0 and 65535"); + } - // Integer integer = new Integer(rownum); RowRecord row = new RowRecord(); - - row.setRowNumber(( short ) rownum); + row.setRowNumber(rownum); return ( RowRecord ) records.get(row); }