diff options
author | Josh Micich <josh@apache.org> | 2009-01-16 17:31:29 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2009-01-16 17:31:29 +0000 |
commit | eb9e672cb272cf066b9fdd631b593f0f28ac66e6 (patch) | |
tree | b19baf53cc3ca430a899124aa9251c5e465d5083 /src/java/org/apache | |
parent | 22bf9b70e4e6b3f1b0dbdfc28e5730d1c933a948 (diff) | |
download | poi-eb9e672cb272cf066b9fdd631b593f0f28ac66e6.tar.gz poi-eb9e672cb272cf066b9fdd631b593f0f28ac66e6.zip |
Fixing bug 46551 - spelling mistakes in xSSFCell.checkBounds(). Also fixed 0/1-based index error for cell range checks in XSSF.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@735061 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFCell.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java index 1d2cac6792..03c514b47b 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java @@ -88,6 +88,13 @@ public class HSSFCell implements Cell { /** Error Cell type (5) @see #setCellType(int) @see #getCellType() */ public final static int CELL_TYPE_ERROR = 5; + private static final String FILE_FORMAT_NAME = "BIFF8"; + /** + * The maximum number of columns in BIFF8 + */ + private static final int LAST_COLUMN_NUMBER = 255; // 2^8 - 1 + private static final String LAST_COLUMN_NAME = "IV"; + public final static short ENCODING_UNCHANGED = -1; public final static short ENCODING_COMPRESSED_UNICODE = 0; public final static short ENCODING_UTF_16 = 1; @@ -915,14 +922,12 @@ public class HSSFCell implements Cell { /** * @throws RuntimeException if the bounds are exceeded. */ - private void checkBounds(int cellNum) { - if (cellNum > 255) { - throw new IllegalArgumentException("You cannot have more than 255 columns "+ - "in a given row (IV). Because Excel can't handle it"); - } - else if (cellNum < 0) { - throw new IllegalArgumentException("You cannot reference columns with an index of less then 0."); - } + private static void checkBounds(int cellIndex) { + if (cellIndex < 0 || cellIndex > LAST_COLUMN_NUMBER) { + throw new IllegalArgumentException("Invalid column index (" + cellIndex + + "). Allowable column range for " + FILE_FORMAT_NAME + " is (0.." + + LAST_COLUMN_NUMBER + ") or ('A'..'" + LAST_COLUMN_NAME + "')"); + } } /** |