From 29711da626fffd4bcf2a47396ebfeb27f1bb69cb Mon Sep 17 00:00:00 2001 From: Pankaj Godiyal Date: Thu, 9 Nov 2023 15:52:42 +0530 Subject: [PATCH] MOSIP-28970 Signed-off-by: Pankaj Godiyal --- .../mock/sbi/devicehelper/SBIDeviceHelper.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/MockMDS/src/main/java/io/mosip/mock/sbi/devicehelper/SBIDeviceHelper.java b/MockMDS/src/main/java/io/mosip/mock/sbi/devicehelper/SBIDeviceHelper.java index eb397fc0..a9276d05 100644 --- a/MockMDS/src/main/java/io/mosip/mock/sbi/devicehelper/SBIDeviceHelper.java +++ b/MockMDS/src/main/java/io/mosip/mock/sbi/devicehelper/SBIDeviceHelper.java @@ -821,20 +821,8 @@ private void loadKeys(String keyStoreFileName, String alias, String keystorePass */ - public static boolean evictKeys(String keystoreFilePath) { - boolean bKeyFound = false; - for (Entry entry : privateKeyMap.entrySet()) { - if (entry.getKey().startsWith(keystoreFilePath)) { - bKeyFound = true; - break; - } - } - if (bKeyFound == false) - return true; // No key to remove - boolean bRetVal = privateKeyMap.entrySet().removeIf(e -> e.getKey().startsWith(keystoreFilePath)); - if (bRetVal) { - bRetVal = certificateMap.entrySet().removeIf(e -> e.getKey().startsWith(keystoreFilePath)); - } - return bRetVal; + public static synchronized void evictKeys(String keystoreFilePath) { + privateKeyMap.entrySet().removeIf(e -> e.getKey().startsWith(keystoreFilePath)); + certificateMap.entrySet().removeIf(e -> e.getKey().startsWith(keystoreFilePath)); } }