Converting javax.security.cert.X509Certificate[] to java.security.cert.X509Certificate[] keeping order
private X509Certificate[] x509Certificates;

private void setX509Certificates(javax.security.cert.X509Certificate[] certs) throws CertificateException {
    CertificateFactory certificateFactory = certificateFactory = CertificateFactory.getInstance("X.509");
    List&lt;X509Certificate&gt; x509List = new ArrayList&lt;&gt;();

    for (javax.security.cert.X509Certificate cert : certs) {
        try {
            ByteArrayInputStream bais = new ByteArrayInputStream(cert.getEncoded());
            X509Certificate x509Certificate = (X509Certificate) certificateFactory.generateCertificate(bais);
            if (x509Certificate != null) {
                x509List.add(x509Certificate);
            }
        } catch (CertificateEncodingException e) {
            e.printStackTrace(System.err);
        }
    }
    this.x509Certificates = x509List.toArray(new X509Certificate[]{});
}


Linked List which you have used for temporary purpose. This could be achieved in a single for loop. Since there will not be any duplicate certificate it is safe to use ArrayList for collecting the certifcates. 

I am not sure your exception handling strategy. So I am throwing the CertificateException you are free to change it based on your exception strategy.