Java 8 MarshalException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MarshalException class.

This code example shows how to use the following methods:getMessage
            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);
        } 
    } 
 
    private void setCharset(MediaType contentType, Marshaller marshaller) throws PropertyException
    { 
        if (contentType != null && contentType.getCharSet() != null)
        { 
            marshaller.setProperty(Marshaller.JAXB_ENCODING, contentType.getCharSet().name());
        } 
    } 
5
CodeRank
This code example shows how to use the following methods:getMessage
            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);
        } 
    } 
 
    private void setCharset(MediaType contentType, Marshaller marshaller) throws PropertyException
    { 
        if (contentType != null && contentType.getCharSet() != null)
        { 
            marshaller.setProperty(Marshaller.JAXB_ENCODING, contentType.getCharSet().name());
        } 
    } 
4
CodeRank
This code example shows how to use the following methods:
                    if (e instanceof XMLStreamException) {
                        final Throwable cause = e.getCause();
                        if (cause instanceof JAXBException) {
                            throw (JAXBException) e;
                        } 
                        throw new MarshalException(cause == null ? e : cause);
                    } 
                    throw new MarshalException(e);
 
                } 
 
                w.writeEndDocument();
            } catch (final Exception e) {
                throw new MarshalException(e);
            } 
 
 
        } catch (final XMLStreamException e) {
            throw new JAXBException("Could not close XMLStreamWriter.", e);
        } finally { 
3
CodeRank
See Code Examples for Java 8 MarshalException Methods: