Example usage for java.util UnknownFormatConversionException UnknownFormatConversionException

List of usage examples for java.util UnknownFormatConversionException UnknownFormatConversionException

Introduction

In this page you can find the example usage for java.util UnknownFormatConversionException UnknownFormatConversionException.

Prototype

public UnknownFormatConversionException(String s) 

Source Link

Document

Constructs an instance of this class with the unknown conversion.

Usage

From source file:org.silverpeas.core.contribution.converter.openoffice.OpenOfficeConverter.java

private org.jodconverter.document.DocumentFormat documentFormat(final DocumentFormat format) {
    String mimeType = format.getMimeType();
    org.jodconverter.document.DocumentFormat docFormat = DefaultDocumentFormatRegistry
            .getFormatByMediaType(mimeType);
    if (docFormat == null) {
        if (RTF_MIME_TYPE.equals(mimeType)) {
            mimeType = mimeType.replaceFirst("application", "text");
        }/*  ww w.j  av a  2s .  c o  m*/
        docFormat = DefaultDocumentFormatRegistry.getFormatByMediaType(mimeType);
    }
    if (docFormat == null) {
        throw new UnknownFormatConversionException(
                "Unknown document format for MIME-TYPE: " + format.getMimeType());
    }
    return docFormat;
}