Example usage for io.netty.util.internal PlatformDependent isAndroid

List of usage examples for io.netty.util.internal PlatformDependent isAndroid

Introduction

In this page you can find the example usage for io.netty.util.internal PlatformDependent isAndroid.

Prototype

public static boolean isAndroid() 

Source Link

Document

Returns true if and only if the current platform is Android

Usage

From source file:io.vertx.core.net.impl.KeyStoreHelper.java

License:Open Source License

public static List<String> getX509CertificateCommonNames(String dn) throws Exception {
    List<String> names = new ArrayList<>();
    if (!PlatformDependent.isAndroid()) {
        LdapName ldapDN = new LdapName(dn);
        for (Rdn rdn : ldapDN.getRdns()) {
            if (rdn.getType().equalsIgnoreCase("cn")) {
                String name = rdn.getValue().toString();
                names.add(name);/* w  ww.  ja  v  a  2  s. co  m*/
            }
        }
    } else {
        String[] rdns = dn.trim().split("[,;]");
        for (String rdn : rdns) {
            String[] nvp = rdn.trim().split("=");
            if (nvp.length == 2 && "cn".equalsIgnoreCase(nvp[0])) {
                names.add(nvp[1]);
            }
        }
    }

    return names;
}