List of usage examples for javax.activation MimeTypeParseException getCause
public synchronized Throwable getCause()
From source file:org.osaf.cosmo.dav.impl.StandardDavRequest.java
private Document getSafeRequestDocument(boolean requireDocument) throws DavException { try {/*from ww w . jav a 2 s . co m*/ if (StringUtils.isBlank(getContentType())) { if (requireDocument) throw new BadRequestException("No Content-Type specified"); return null; } MimeType mimeType = new MimeType(getContentType()); if (!(mimeType.match(APPLICATION_XML) || mimeType.match(TEXT_XML))) throw new UnsupportedMediaTypeException( "Expected Content-Type " + APPLICATION_XML + " or " + TEXT_XML); return getRequestDocument(); } catch (MimeTypeParseException e) { throw new UnsupportedMediaTypeException(e.getMessage()); } catch (IllegalArgumentException e) { Throwable cause = e.getCause(); String msg = cause != null ? cause.getMessage() : null; if (msg == null) msg = "Unknown error parsing request document"; throw new BadRequestException(msg); } }