Skip to content

Commit 40df55c

Browse files
committed
added some security try catch
1 parent 5e5a8a2 commit 40df55c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/main/java/ch/ethz/seb/sps/server/servicelayer/impl/ScreenshotStore_S3.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,21 @@ public void storeScreenshot(
165165
}
166166

167167
private void processStore(final Collection<ScreenshotQueueData> batch) {
168-
batch.clear();
169-
this.screenshotDataQueue.drainTo(batch);
168+
try {
169+
batch.clear();
170+
this.screenshotDataQueue.drainTo(batch);
170171

171-
if (batch.isEmpty()) {
172-
return;
173-
}
172+
if (batch.isEmpty()) {
173+
return;
174+
}
174175

175-
if (batchStore) {
176-
applyBatchStore(batch);
177-
} else {
178-
applySingleStore(batch);
176+
if (batchStore) {
177+
applyBatchStore(batch);
178+
} else {
179+
applySingleStore(batch);
180+
}
181+
} catch (Exception e) {
182+
log.error("Failed to drain and process batch - should never happen: ", e);
179183
}
180184
}
181185

0 commit comments

Comments
 (0)