]> source.dussan.org Git - poi.git/commitdiff
remove unchecked cast from setHyperlink
authorPJ Fanning <fanningpj@apache.org>
Sat, 24 Jul 2021 07:08:39 +0000 (07:08 +0000)
committerPJ Fanning <fanningpj@apache.org>
Sat, 24 Jul 2021 07:08:39 +0000 (07:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891761 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java

index 31b6d0d9d5cc6972b83665ac4b4410ca36527ce8..d0259c6805dda9da7bd6a9c156f969363ebdcdb2 100644 (file)
@@ -1114,7 +1114,12 @@ public class HSSFCell extends CellBase {
             return;
         }
 
-        HSSFHyperlink link = (HSSFHyperlink)hyperlink;
+        HSSFHyperlink link;
+        if (hyperlink instanceof HSSFHyperlink) {
+            link = (HSSFHyperlink)hyperlink;
+        } else {
+            link = new HSSFHyperlink(hyperlink);
+        }
 
         link.setFirstRow(_record.getRow());
         link.setLastRow(_record.getRow());