public MimeType forName(String name) throws MimeTypeException {
        MediaType type = MediaType.parse(name);
        if (type != null) {
            MediaType normalisedType = registry.normalize(type);
            MimeType mime = types.get(normalisedType);

            if (mime == null) {
                synchronized (this) {
                    // Double check it didn't already get added while
                    //  we were waiting for the lock
                    mime = types.get(normalisedType);
                    if (mime == null) {
                        mime = new MimeType(type);
                        add(mime);
                        types.put(type, mime);
                    }
                }
            }
            return mime;
        } else {
            throw new MimeTypeException("Invalid media type name: " + name);
        }
    }
Returns the registered media type with the given name (or alias).
The named media type is automatically registered (and returned) if
it doesn't already exist.

@param name media type name (case-insensitive)
@return the registered media type with the given name or alias
@throws MimeTypeException if the given media type name is invalid
tika-core/src/main/java/org/apache/tika/mime/MimeTypes.java