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 03:56:43 UTC

[GitHub] [ozone] sky76093016 opened a new pull request #2380: HDDS-5396. Fix potential IndexOutOfBoundsException in MockCRLStore.java

sky76093016 opened a new pull request #2380:
URL: https://github.com/apache/ozone/pull/2380


   ## What changes were proposed in this pull request?
   
   Fix potential IndexOutOfBoundsException.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-5396
   
   ## How was this patch tested?
   
   No test.
   


-- 
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


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

Posted by GitBox <gi...@apache.org>.
sky76093016 commented on pull request #2380:
URL: https://github.com/apache/ozone/pull/2380#issuecomment-871076675


   @jojochuang Please help me review. Thank you.


-- 
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


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

Posted by GitBox <gi...@apache.org>.
sky76093016 commented on a change in pull request #2380:
URL: https://github.com/apache/ozone/pull/2380#discussion_r661135261



##########
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` is empty, `crlInfos.get(0)` will have something feels unreasonable. After I communicated with Xiaoyu Yao, it was because of the original negligence, it should be `if (!crlInfos.isEmpty())`.




-- 
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


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

Posted by GitBox <gi...@apache.org>.
sky76093016 commented on a change in pull request #2380:
URL: https://github.com/apache/ozone/pull/2380#discussion_r661135261



##########
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` is empty, `crlInfos.get(0)` will have something feels unreasonable. After I communicated with @xiaoyuyao , it was because of the original negligence, it should be `if (!crlInfos.isEmpty())`.




-- 
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


[GitHub] [ozone] jojochuang merged pull request #2380: HDDS-5396. Fix negligence issue conditional expressions in MockCRLStore.java

Posted by GitBox <gi...@apache.org>.
jojochuang merged pull request #2380:
URL: https://github.com/apache/ozone/pull/2380


   


-- 
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


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

Posted by GitBox <gi...@apache.org>.
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