The WCS20GetCoverageMultipartResponse does encoding 2 times:
the write method has this piece of code:
BodyPart coveragePart = new MimeBodyPart();
CoverageEncoder encoder = new CoverageEncoder(delegate, coverage, format, encodingParameters);
coveragePart.setDataHandler(new DataHandler(encoder, “geoserver/coverageDelegate”));
…
multipart.addBodyPart(coveragePart);
// write out the multipart (we need to use mime message trying to
// encode directly with multipart or BodyPart does not set properly
// the encodings and binary files gets ruined
MimeMessage message = new GeoServerMimeMessage();
message.setContent(multipart);
message.writeTo(output);
output.flush();
…
delegate.encode(coverage, format, encodingParameters, output);
Which results in 2 encodings:
- message.writeTo(output)
- delegate.encode(…)
I guess the last delegate.encode(…) has been forgotten here by mistake.
Also note that WCSMultipartResponse has very similar MimeMessaging based encoding code without the second delegate.encode invocation (since it’s internally called by the message.writeTo(output) ) …
Even removing that last encode, a JPEG multipart test still works so it should be safe to be removed.
Pull request incoming…
|