Skip to content

Commit

Permalink
Merge pull request #4691 from Consorcio-Madrono/4548-harvesting-clients
Browse files Browse the repository at this point in the history
Fixed ServletException #4548
  • Loading branch information
kcondon authored May 18, 2018
2 parents 000c205 + 36837f6 commit b4e1f2a
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,30 @@ public void writeToStream(OutputStream outputStream) throws IOException {

outputStream.write(headerString.getBytes());

if (!isExtendedDataverseMetadataMode(formatName)) {
outputStream.write(METADATA_START_ELEMENT.getBytes());

outputStream.flush();

if (dataset != null && formatName != null) {
InputStream inputStream = null;
try {
inputStream = ExportService.getInstance().getExport(dataset, formatName);
} catch (ExportException ex) {
inputStream = null;
}

if (inputStream == null) {
throw new IOException("Xrecord: failed to open metadata stream.");
// header.getStatus() is only non-null when it's indicating "deleted".
if (header.getStatus() == null) { // Deleted records should not show metadata
if (!isExtendedDataverseMetadataMode(formatName)) {
outputStream.write(METADATA_START_ELEMENT.getBytes());

outputStream.flush();

if (dataset != null && formatName != null) {
InputStream inputStream = null;
try {
inputStream = ExportService.getInstance().getExport(dataset, formatName);
} catch (ExportException ex) {
inputStream = null;
}

if (inputStream == null) {
throw new IOException("Xrecord: failed to open metadata stream.");
}
writeMetadataStream(inputStream, outputStream);
}
writeMetadataStream(inputStream, outputStream);
outputStream.write(METADATA_END_ELEMENT.getBytes());
} else {
outputStream.write(customMetadataExtensionRef(this.dataset.getGlobalId()).getBytes());
}
outputStream.write(METADATA_END_ELEMENT.getBytes());
} else {
outputStream.write(customMetadataExtensionRef(this.dataset.getGlobalId()).getBytes());
}
outputStream.flush();

Expand Down

0 comments on commit b4e1f2a

Please sign in to comment.