Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Optional<Long> revokeCert(List<BigInteger> certs,
List<CRLInfo> crlInfos =
scmCertStore.getCrls(ImmutableList.of(crlId.get()));

if (crlInfos.isEmpty()) {
if (crlInfos == null || crlInfos.isEmpty()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sky76093016 sky76093016 Jun 30, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()).

log.debug("CRL[0]: {}", crlInfos.get(0));
}
return crlId;
Expand Down