Example usage for org.springframework.oxm XmlMappingException getMessage

List of usage examples for org.springframework.oxm XmlMappingException getMessage

Introduction

In this page you can find the example usage for org.springframework.oxm XmlMappingException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:de.drv.dsrv.extra.marshaller.impl.ExtraUnmarschallerTest.java

@Test
public final void testUnmarschallRequest() {
    final InputStream inputStream = new ByteArrayInputStream(validTestRequest.getBytes());
    try {//from  ww w. java2  s  .  com
        final RequestTransport unmarschall = extraUnmarschaller.unmarshal(inputStream,
                de.drv.dsrv.extrastandard.namespace.request.RequestTransport.class, true);
        // Keine Exception und der Object nicht leer
        Assert.assertNotNull("transport is null", unmarschall);
    } catch (final XmlMappingException e) {
        Assert.fail(e.getMessage());
    } catch (final IOException e) {
        Assert.fail(e.getMessage());
    }
}

From source file:org.emonocot.job.io.StaxEventItemWriter.java

/**
 * Write the value objects and flush them to the file.
 *
 * @param items//from  www  .j  a va2  s.  c om
 *            the value object
 * @throws IOException
 *             if there is a problem writing to the resource
 */
public final void write(final List<? extends T> items) throws IOException {

    currentRecordCount += items.size();

    for (Object object : items) {
        Assert.state(marshaller.supports(object.getClass()),
                "Marshaller must support the class of the marshalled object");
        try {
            marshaller.marshal(object, StaxUtils.createStaxResult(eventWriter));
        } catch (XmlMappingException e) {
            throw new IOException(e.getMessage());
        } catch (XMLStreamException e) {
            throw new IOException(e.getMessage());
        }
    }
    try {
        eventWriter.flush();
    } catch (XMLStreamException e) {
        throw new WriteFailedException("Failed to flush the events", e);
    }

}