private GeneralSubtree createWidestSubtree(GeneralNameInterface name) {
        try {
            GeneralName newName;
            switch (name.getType()) {
            case GeneralNameInterface.NAME_ANY:
                // Create new OtherName with same OID as baseName, but
                // empty value
                ObjectIdentifier otherOID = ((OtherName)name).getOID();
                newName = new GeneralName(new OtherName(otherOID, null));
                break;
            case GeneralNameInterface.NAME_RFC822:
                newName = new GeneralName(new RFC822Name(""));
                break;
            case GeneralNameInterface.NAME_DNS:
                newName = new GeneralName(new DNSName(""));
                break;
            case GeneralNameInterface.NAME_X400:
                newName = new GeneralName(new X400Address((byte[])null));
                break;
            case GeneralNameInterface.NAME_DIRECTORY:
                newName = new GeneralName(new X500Name(""));
                break;
            case GeneralNameInterface.NAME_EDI:
                newName = new GeneralName(new EDIPartyName(""));
                break;
            case GeneralNameInterface.NAME_URI:
                newName = new GeneralName(new URIName(""));
                break;
            case GeneralNameInterface.NAME_IP:
                newName = new GeneralName(new IPAddressName((byte[])null));
                break;
            case GeneralNameInterface.NAME_OID:
                newName = new GeneralName
                    (new OIDName(new ObjectIdentifier((int[])null)));
                break;
            default:
                throw new IOException
                    ("Unsupported GeneralNameInterface type: " + name.getType());
            }
            return new GeneralSubtree(newName, 0, -1);
        } catch (IOException e) {
            throw new RuntimeException("Unexpected error: " + e, e);
        }
    }
private GeneralSubtree createWidestSubtree ( GeneralNameInterface name ) { try { GeneralName newName ; switch ( name . getType ( ) ) { case GeneralNameInterface . NAME_ANY : ObjectIdentifier otherOID = ( ( OtherName ) name ) . getOID ( ) ; newName = new GeneralName ( new OtherName ( otherOID , null ) ) ; break ; case GeneralNameInterface . NAME_RFC822 : newName = new GeneralName ( new RFC822Name ( "" ) ) ; break ; case GeneralNameInterface . NAME_DNS : newName = new GeneralName ( new DNSName ( "" ) ) ; break ; case GeneralNameInterface . NAME_X400 : newName = new GeneralName ( new X400Address ( ( byte [ ] ) null ) ) ; break ; case GeneralNameInterface . NAME_DIRECTORY : newName = new GeneralName ( new X500Name ( "" ) ) ; break ; case GeneralNameInterface . NAME_EDI : newName = new GeneralName ( new EDIPartyName ( "" ) ) ; break ; case GeneralNameInterface . NAME_URI : newName = new GeneralName ( new URIName ( "" ) ) ; break ; case GeneralNameInterface . NAME_IP : newName = new GeneralName ( new IPAddressName ( ( byte [ ] ) null ) ) ; break ; case GeneralNameInterface . NAME_OID : newName = new GeneralName ( new OIDName ( new ObjectIdentifier ( ( int [ ] ) null ) ) ) ; break ; default : throw new IOException ( "Unsupported GeneralNameInterface type: " + name . getType ( ) ) ; } return new GeneralSubtree ( newName , 0 , - 1 ) ; } catch ( IOException e ) { throw new RuntimeException ( "Unexpected error: " + e , e ) ; } }
create a subtree containing an instance of the input
name type that widens all other names of that type.

@params name GeneralNameInterface name
@returns GeneralSubtree containing widest name of that type
@throws RuntimeException on error (should not occur)