]> source.dussan.org Git - poi.git/commitdiff
moved 'throw' into else clause avoiding exception on every call of cloneStyleFrom...
authorYegor Kozlov <yegor@apache.org>
Mon, 20 Apr 2009 16:58:29 +0000 (16:58 +0000)
committerYegor Kozlov <yegor@apache.org>
Mon, 20 Apr 2009 16:58:29 +0000 (16:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@766755 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java

index a56143ff42cc521c8b0cf94ba6559612243ae4f1..00de9410cd573a289c284ab69e8c6a05fac51734 100644 (file)
@@ -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
index fcc87f8cb7d4825354d0ed7a669ce44fa10c3413..bfcdd6065b606758be0571a85e83a736a3b5df49 100644 (file)
@@ -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");
     }
 
     /**