From: PJ Fanning Date: Sat, 24 Jul 2021 07:08:39 +0000 (+0000) Subject: remove unchecked cast from setHyperlink X-Git-Tag: REL_5_1_0~125 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b08696f7010977b4978c107d0cdc2cf1fbc04262;p=poi.git remove unchecked cast from setHyperlink git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891761 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java index 31b6d0d9d5..d0259c6805 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java @@ -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());