Skip to content

Commit 1a16b17

Browse files
committed
Fixed too early removal of user upload
1 parent c20bd03 commit 1a16b17

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/edu/kit/datamanager/mappingservice/rest/impl/MappingExecutionController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public ResponseEntity<JobStatus> scheduleMapDocument(String mappingID, Multipart
191191
if (jobManager.getJob(jobId) != null) {
192192
LOG.trace("Duplicated job id detected. Attempt {}/{}", i, 3);
193193
jobId = null;
194-
}else{
194+
} else {
195195
//usable job id found
196196
break;
197197
}
@@ -233,11 +233,11 @@ public ResponseEntity<JobStatus> scheduleMapDocument(String mappingID, Multipart
233233
return ResponseEntity.ok(JobStatus.status(jobId, JobStatus.STATUS.SUBMITTED));
234234
} catch (MappingPluginException e) {
235235
LOG.error("Failed to execute mapping.", e);
236-
return ResponseEntity.status(500).body(JobStatus.error(jobId, JobStatus.STATUS.FAILED, String.format("Failed to schedule mapping with id '%s' on provided input document.", mappingID)));
237-
} finally {
238-
LOG.trace("Removing user upload at {}.", inputFile);
236+
// remove uploaded file
237+
LOG.trace("Removing user upload at {}.", inputPath);
239238
FileUtil.removeFile(inputPath);
240239
LOG.trace("User upload successfully removed.");
240+
return ResponseEntity.status(500).body(JobStatus.error(jobId, JobStatus.STATUS.FAILED, String.format("Failed to schedule mapping with id '%s' on provided input document.", mappingID)));
241241
}
242242
} else {
243243
String message = "Either mapping id or input document are missing. Unable to perform mapping.";

0 commit comments

Comments
 (0)