diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-07-20 21:06:13 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-07-20 21:06:13 +0000 |
commit | b0b6747ce32a008ed858825156da363b3a4f7f71 (patch) | |
tree | ecf8b1784b3000945d5766a00d4b6551ac883819 | |
parent | fa045845f556538ccc824d1707dd9f23dbb5f25d (diff) | |
download | poi-b0b6747ce32a008ed858825156da363b3a4f7f71.tar.gz poi-b0b6747ce32a008ed858825156da363b3a4f7f71.zip |
test issue
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902894 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java | 8 | ||||
-rw-r--r-- | poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index 1ce3b03d53..deed5b68d2 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -1278,7 +1278,11 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx @Deprecated @Removal(version = "7.0.0") public void setMargin(short margin, double size) { - setMargin(PageMargin.getByShortValue(margin), size); + final PageMargin pageMargin = PageMargin.getByShortValue(margin); + if (pageMargin == null) { + throw new IllegalArgumentException( "Unknown margin constant: " + margin ); + } + setMargin(pageMargin, size); } /** @@ -1311,7 +1315,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx case FOOTER: pageMargins.setFooter(size); break; - default : + default: throw new IllegalArgumentException( "Unknown margin constant: " + margin ); } } diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index c94c35e6e8..4a48d6fc21 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -1355,7 +1355,11 @@ public final class HSSFSheet implements Sheet { @Deprecated @Removal(version = "7.0.0") public void setMargin(short margin, double size) { - setMargin(PageMargin.getByShortValue(margin), size); + final PageMargin pageMargin = PageMargin.getByShortValue(margin); + if (pageMargin == null) { + throw new IllegalArgumentException( "Unknown margin constant: " + margin ); + } + setMargin(pageMargin, size); } /** |