From b08696f7010977b4978c107d0cdc2cf1fbc04262 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 24 Jul 2021 07:08:39 +0000 Subject: [PATCH] remove unchecked cast from setHyperlink git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891761 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/poi/hssf/usermodel/HSSFCell.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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()); -- 2.39.5