From: Yegor Kozlov Date: Mon, 20 Apr 2009 16:58:29 +0000 (+0000) Subject: moved 'throw' into else clause avoiding exception on every call of cloneStyleFrom... X-Git-Tag: REL_3_5_BETA6~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aebb0375319cd2a7170c2e130e839a2e8063ee44;p=poi.git moved 'throw' into else clause avoiding exception on every call of cloneStyleFrom, see bugzilla 47054 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@766755 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java index a56143ff42..00de9410cd 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java @@ -814,8 +814,9 @@ public class HSSFCellStyle implements CellStyle public void cloneStyleFrom(CellStyle source) { if(source instanceof HSSFCellStyle) { this.cloneStyleFrom((HSSFCellStyle)source); + } else { + throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); } - throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); } public void cloneStyleFrom(HSSFCellStyle source) { // First we need to clone the extended format diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java index fcc87f8cb7..bfcdd6065b 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java @@ -112,8 +112,9 @@ public class XSSFCellStyle implements CellStyle { public void cloneStyleFrom(CellStyle source) { if(source instanceof XSSFCellStyle) { this.cloneStyleFrom(source); + } else { + throw new IllegalArgumentException("Can only clone from one XSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); } - throw new IllegalArgumentException("Can only clone from one XSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); } /**