From ee6b3e6f31566b4d816c881482f1620ff0f74b47 Mon Sep 17 00:00:00 2001 From: Sumanth Pasupuleti Date: Wed, 4 Aug 2021 10:24:26 -0700 Subject: [PATCH] Handling null in checksum validation --- .../java/com/netflix/ndbench/core/util/CheckSumUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ndbench-core/src/main/java/com/netflix/ndbench/core/util/CheckSumUtil.java b/ndbench-core/src/main/java/com/netflix/ndbench/core/util/CheckSumUtil.java index c0e02c71..820f71d5 100644 --- a/ndbench-core/src/main/java/com/netflix/ndbench/core/util/CheckSumUtil.java +++ b/ndbench-core/src/main/java/com/netflix/ndbench/core/util/CheckSumUtil.java @@ -82,10 +82,14 @@ public static String appendCheckSumAndEncodeBase64(String inputString, boolean a * Base64 decodes the input string, extracts original string bytes and checksum bytes, generates checksum from the * extracted string bytes, and validates against the extracted checksum bytes. * @param encodedInput - * @return true if the checksum is correct, false otherwise + * @return true if the checksum is correct or if the encodedInput is null, false otherwise. */ public static boolean isChecksumValid(String encodedInput) { + // ignore null input + if (null == encodedInput) + return true; + try { byte[] inputInBytes = Base64.getDecoder().decode(encodedInput);