Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with marshall object with JAXB and StAXEncoder #9

Closed
mkrzempek opened this issue Apr 28, 2017 · 2 comments
Closed

Problem with marshall object with JAXB and StAXEncoder #9

mkrzempek opened this issue Apr 28, 2017 · 2 comments

Comments

@mkrzempek
Copy link

I try to marshall Java object using JAXB API. Using EXIResult object works all right.

But when I try to do it through StaXEncoder class within method like this:

    public void marshalToExiStream(CmmMessage jaxbMessage, OutputStream outputStream) throws EXIException, IOException, JAXBException {
        StAXEncoder encoder = new StAXEncoder(exiFactory);
        encoder.setOutputStream(outputStream);

        produceMarshaller().marshal(jaxbMessage, encoder);
    }

I receive such error because deflate stream is finished:

Caused by: java.io.IOException: write beyond end of stream
at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:201)
at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:188)
at com.siemens.ct.exi.io.channel.ByteEncoderChannel.encode(ByteEncoderChannel.java:70)
at com.siemens.ct.exi.io.channel.AbstractEncoderChannel.encodeUnsignedInteger(AbstractEncoderChannel.java:151)
at com.siemens.ct.exi.datatype.strings.StringEncoderImpl.writeValue(StringEncoderImpl.java:71)
at com.siemens.ct.exi.datatype.StringDatatype.writeValue(StringDatatype.java:81)
at com.siemens.ct.exi.types.TypedTypeEncoder.writeValue(TypedTypeEncoder.java:70)
at com.siemens.ct.exi.core.EXIBodyEncoderReordered.closeBlock(EXIBodyEncoderReordered.java:197)
at com.siemens.ct.exi.core.EXIBodyEncoderReordered.flush(EXIBodyEncoderReordered.java:278)
at com.siemens.ct.exi.api.stream.StAXEncoder.flush(StAXEncoder.java:549)
at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.endDocument(XMLStreamWriterOutput.java:97)
at com.sun.xml.internal.bind.v2.runtime.output.ForkXmlOutput.endDocument(ForkXmlOutput.java:59)
at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.endDocument(XMLSerializer.java:836)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.postwrite(MarshallerImpl.java:362)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:309)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:163)

@mkrzempek mkrzempek changed the title Problem with marshal object with JAXB and StAXEncoder Problem with marshall object with JAXB and StAXEncoder Apr 28, 2017
danielpeintner added a commit that referenced this issue May 2, 2017
@danielpeintner
Copy link
Member

b886b41 should resolve the issue.

Having that said, there was an issue with StAX and EXI compression on.

Please let me know if the issue is resolved.

@mkrzempek
Copy link
Author

It seems that problem is resolved. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants