From 9b790cb8054684d08477a057898ad3633e873f9f Mon Sep 17 00:00:00 2001 From: Cyrus <24922493+cyrus-dev@users.noreply.github.com> Date: Fri, 3 Dec 2021 17:01:18 -0500 Subject: [PATCH] checking for class cast now. Highlighting appears. --- .../SupplyChainCredentialValidator.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/validation/SupplyChainCredentialValidator.java b/HIRS_Utils/src/main/java/hirs/validation/SupplyChainCredentialValidator.java index 4b9985d4..acd0a921 100644 --- a/HIRS_Utils/src/main/java/hirs/validation/SupplyChainCredentialValidator.java +++ b/HIRS_Utils/src/main/java/hirs/validation/SupplyChainCredentialValidator.java @@ -566,11 +566,19 @@ public final class SupplyChainCredentialValidator implements CredentialValidator // pass information of which ones failed in additionInfo for (ComponentIdentifier ci : validPcComponents) { - ComponentIdentifierV2 pciCi = (ComponentIdentifierV2) ci; - if (PciIds.DB.isReady()) { - pciCi = PciIds.translate((ComponentIdentifierV2) ci); + try { + if (ci.isVersion2()) { + ComponentIdentifierV2 pciCi = (ComponentIdentifierV2) ci; + if (PciIds.DB.isReady()) { + pciCi = PciIds.translate((ComponentIdentifierV2) ci); + } + additionalInfo.append(String.format("%d;", pciCi.hashCode())); + } else { + additionalInfo.append(String.format("%d;", ci.hashCode())); + } + } catch (Exception ex) { + LOGGER.error(ex.getMessage()); } - additionalInfo.append(String.format("%d;", pciCi.hashCode())); } }