mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-30 08:04:05 +00:00
Making fix to null pointer exception (when fetching from /list).
This commit is contained in:
parent
cc5db6e3ed
commit
f244afffe0
@ -215,9 +215,10 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
|||||||
String orderColumnName = input.getOrderColumnName();
|
String orderColumnName = input.getOrderColumnName();
|
||||||
log.debug("Ordering on column: " + orderColumnName);
|
log.debug("Ordering on column: " + orderColumnName);
|
||||||
|
|
||||||
Order order = input.getOrder().get(0);
|
List<Order> orderList = input.getOrder();
|
||||||
|
Order order = null;
|
||||||
|
if (orderList.size() > 0)
|
||||||
|
order = input.getOrder().get(0);
|
||||||
|
|
||||||
int currentPage = input.getStart() / input.getLength();
|
int currentPage = input.getStart() / input.getLength();
|
||||||
Pageable paging = PageRequest.of(currentPage, input.getLength(), Sort.by(orderColumnName));
|
Pageable paging = PageRequest.of(currentPage, input.getLength(), Sort.by(orderColumnName));
|
||||||
@ -276,17 +277,19 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
|||||||
} else if (certificateType.equals(TRUSTCHAIN)) {
|
} else if (certificateType.equals(TRUSTCHAIN)) {
|
||||||
FilteredRecordsList<CertificateAuthorityCredential> records = new FilteredRecordsList<>();
|
FilteredRecordsList<CertificateAuthorityCredential> records = new FilteredRecordsList<>();
|
||||||
org.springframework.data.domain.Page<CertificateAuthorityCredential> pagedResult = this.caCredentialRepository.findByArchiveFlag(false, paging);;
|
org.springframework.data.domain.Page<CertificateAuthorityCredential> pagedResult = this.caCredentialRepository.findByArchiveFlag(false, paging);;
|
||||||
if (orderColumnName.equalsIgnoreCase("Issuer")) {
|
if (order != null) {
|
||||||
if (order.isAscending()) {
|
if (orderColumnName.equalsIgnoreCase("Issuer")) {
|
||||||
pagedResult = this.caCredentialRepository.findByArchiveFlagOrderByIssuerAsc(false, paging);
|
if (order.isAscending()) {
|
||||||
} else {
|
pagedResult = this.caCredentialRepository.findByArchiveFlagOrderByIssuerAsc(false, paging);
|
||||||
pagedResult = this.caCredentialRepository.findByArchiveFlagOrderByIssuerDesc(false, paging);
|
} else {
|
||||||
}
|
pagedResult = this.caCredentialRepository.findByArchiveFlagOrderByIssuerDesc(false, paging);
|
||||||
} else if (orderColumnName.equalsIgnoreCase("Subject")) {
|
}
|
||||||
if (order.isAscending()) {
|
} else if (orderColumnName.equalsIgnoreCase("Subject")) {
|
||||||
pagedResult = this.caCredentialRepository.findByArchiveFlagOrderBySubjectAsc(false, paging);
|
if (order.isAscending()) {
|
||||||
} else {
|
pagedResult = this.caCredentialRepository.findByArchiveFlagOrderBySubjectAsc(false, paging);
|
||||||
pagedResult = this.caCredentialRepository.findByArchiveFlagOrderBySubjectDesc(false, paging);
|
} else {
|
||||||
|
pagedResult = this.caCredentialRepository.findByArchiveFlagOrderBySubjectDesc(false, paging);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,8 +629,8 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ZipOutputStream bulkDownload(final ZipOutputStream zipOut,
|
private ZipOutputStream bulkDownload(final ZipOutputStream zipOut,
|
||||||
final List<Certificate> certificates,
|
final List<Certificate> certificates,
|
||||||
final String singleFileName) throws IOException {
|
final String singleFileName) throws IOException {
|
||||||
String zipFileName;
|
String zipFileName;
|
||||||
// get all files
|
// get all files
|
||||||
for (Certificate certificate : certificates) {
|
for (Certificate certificate : certificates) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user