[Geoserver-devel] [jira] (GEOS-6679) WCS20 GetCoverage multipart does encoding 2 times

Daniele Romagnoli created an issue

GeoServer / BugGEOS-6679

WCS20 GetCoverage multipart does encoding 2 times

Issue Type:

BugBug

Affects Versions:

2.6-RC1

Assignee:

Andrea Aime

Components:

WCS

Created:

17/Sep/14 5:10 AM

Fix Versions:

2.6-RC2, 2.7-beta

Priority:

MinorMinor

Reporter:

Daniele Romagnoli

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:

  1. message.writeTo(output)
  2. 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…

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v6.1.6#6162-sha1:7af547c)

Atlassian logo