private static X509Certificate[] getX509CertsFromStringList(
            String[] paramArrayOfString1, String[] paramArrayOfString2)
            throws CertificateException {
        CertificateFactory localCertificateFactory = CertificateFactory
                .getInstance("X.509");
        ArrayList localArrayList = new ArrayList(paramArrayOfString1.length);
        for (int i = 0; i < paramArrayOfString1.length; i++) {
            int j = -1;
            String str = paramArrayOfString1[i];
            if (str != null) {
                j = str.indexOf("-----BEGIN CERTIFICATE-----");
            }
            if (j >= 0) {
                str = str.substring(j);

                // Read String and remove white spaces
                Scanner scanner = new Scanner(str);
                StringBuilder stringBuilder = new StringBuilder();

                while (scanner.hasNextLine()) {
                    String line = scanner.nextLine();
                    stringBuilder.append(line.trim());
                    stringBuilder.append("\n");
                }
                scanner.close();

                ByteArrayInputStream localByteArrayInputStream = new ByteArrayInputStream(
                        stringBuilder.toString().getBytes());

                try {
                    X509Certificate localX509Certificate = (X509Certificate) localCertificateFactory
                            .generateCertificate(localByteArrayInputStream);
                    localArrayList.add(localX509Certificate);
                } catch (Exception localException) {
                    if (paramArrayOfString2 != null) {
                        logger.warning(paramArrayOfString2[i]
                                + " can not be parsed as an X509Certificate.");
                    } else {
                        logger.warning("failed to parse an X509Certificate");
                    }
                }
            }
        }
        if (localArrayList.isEmpty()) {
            return null;
        }
        return (X509Certificate[]) localArrayList
                .toArray(new X509Certificate[0]);
    }