Skip to content

Commit 210a6f1

Browse files
committed
just-in-time after clearExports
1 parent f79a02b commit 210a6f1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/edu/harvard/iq/dataverse/export/ExportService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ public InputStream getExport(DatasetVersion datasetVersion, String formatName) t
134134

135135
Dataset dataset = datasetVersion.getDataset();
136136
InputStream exportInputStream = null;
137-
137+
Date lastExportDate = dataset.getLastExportTime();
138+
138139
if (datasetVersion.isDraft()) {
139140
// For drafts we create the export on the fly rather than caching.
140141
Exporter exporter = exporterMap.get(formatName);
@@ -156,8 +157,9 @@ public InputStream getExport(DatasetVersion datasetVersion, String formatName) t
156157
return new ByteArrayInputStream(outputStream.toByteArray());
157158
}
158159
}
159-
} else {
160+
} else if(lastExportDate!= null) {
160161
// for non-drafts (published versions) we try to locate an already existing, cached export
162+
// unless the lastExportDate is null (either never created so there's no cached value, or was cleared because we want a new version)
161163
exportInputStream = getCachedExportFormat(dataset, formatName);
162164
}
163165

@@ -168,7 +170,6 @@ public InputStream getExport(DatasetVersion datasetVersion, String formatName) t
168170
if (formatName.equals(DDIExporter.PROVIDER_NAME) && (exportInputStream != null)) {
169171
// We want ddi and there was a cached version
170172
LocalDate exportLocalDate = null;
171-
Date lastExportDate = dataset.getLastExportTime();
172173
// if lastExportDate == null, assume it's not set because were exporting for the
173174
// first time now (e.g. during publish) and therefore no changes are needed
174175
if (lastExportDate != null) {

0 commit comments

Comments
 (0)