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

poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java

index 1900d7705c63168862eaa7feb30e7c65859a4fd0..5929a4cad3ff01442be498161cf5d1bc72e72f14 100644 (file)
@@ -1064,7 +1064,12 @@ public final class XSSFCell extends CellBase {
             return;
         }
 
-        XSSFHyperlink link = (XSSFHyperlink)hyperlink;
+        XSSFHyperlink link;
+        if (hyperlink instanceof XSSFHyperlink) {
+            link = (XSSFHyperlink)hyperlink;
+        } else {
+            link = new XSSFHyperlink(hyperlink);
+        }
 
         // Assign to us
         link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() );