You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/06/30 04:16:01 UTC

[GitHub] [ozone] ayushtkn commented on a change in pull request #2380: HDDS-5396. Fix potential IndexOutOfBoundsException in MockCRLStore.java

ayushtkn commented on a change in pull request #2380:
URL: https://github.com/apache/ozone/pull/2380#discussion_r661117604



##########
File path: hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/MockCRLStore.java
##########
@@ -106,7 +106,7 @@ public BigInteger issueCert() throws Exception {
     List<CRLInfo> crlInfos =
         scmCertStore.getCrls(ImmutableList.of(crlId.get()));
 
-    if (crlInfos.isEmpty()) {
+    if (crlInfos == null || crlInfos.isEmpty()) {

Review comment:
       When `crlInfos ` can be `null`? 
   The value is fetched from. ``scmCertStore.getCrls(ImmutableList.of(crlId.get()));`` and this doesn't look like returning a `null` in any case. It is in general returning an empty list, if it can not find anything?
   
   Secondly, If I understand the code correct, now if `crlInfos` is null, we will log the line below, so, will this ` crlInfos.get(0)` not throw a NPE since `crlInfos` is null?
   
   Thirdly, How this `null` check, preventing an `IndexOutOfBoundsException`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org