Example usage for javax.xml.bind MarshalException getMessage

List of usage examples for javax.xml.bind MarshalException getMessage

Introduction

In this page you can find the example usage for javax.xml.bind MarshalException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:jails.http.converter.xml.Jaxb2RootElementHttpMessageConverter.java

@Override
protected void writeToResult(Object o, HttpHeaders headers, Result result) throws IOException {
    try {/*w w  w. j a  v  a 2s .  c o m*/
        Class clazz = ClassUtils.getUserClass(o);
        Marshaller marshaller = createMarshaller(clazz);
        setCharset(headers.getContentType(), marshaller);
        marshaller.marshal(o, result);
    } catch (MarshalException ex) {
        throw new HttpMessageNotWritableException("Could not marshal [" + o + "]: " + ex.getMessage(), ex);
    } catch (JAXBException ex) {
        throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
    }
}

From source file:org.jasig.portlet.courses.dao.xml.Jaxb2CourseSummaryHttpMessageConverter.java

@Override
protected void writeToResult(Object o, HttpHeaders headers, Result result) throws IOException {
    try {//from w  w  w  . j a v  a2s .c om
        Class clazz = ClassUtils.getUserClass(o);
        Marshaller marshaller = createWrapperMarshaller(clazz);
        setCharset(headers.getContentType(), marshaller);
        marshaller.marshal(o, result);
    } catch (MarshalException ex) {
        throw new HttpMessageNotWritableException("Could not marshal [" + o + "]: " + ex.getMessage(), ex);
    } catch (JAXBException ex) {
        throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
    }
}

From source file:org.alfresco.repo.publishing.JaxbHttpMessageConverter.java

@Override
protected void writeToResult(Object o, HttpHeaders headers, Result result) throws IOException {
    try {/*  w w w .j  a  va  2  s .  c  om*/
        Class<?> clazz = ClassUtils.getUserClass(o);
        Marshaller marshaller = createMarshaller(clazz);
        setCharset(headers.getContentType(), marshaller);
        marshaller.marshal(o, result);
    } catch (MarshalException ex) {
        throw new HttpMessageNotWritableException("Could not marshal [" + o + "]: " + ex.getMessage(), ex);
    } catch (JAXBException ex) {
        throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
    }
}