Skip to content

Commit

Permalink
grader: dont crash when zip file contains empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar committed Aug 26, 2024
1 parent d9068a1 commit 06396f8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.zip.ZipException;
import judgels.fs.FileSystem;
import judgels.fs.local.LocalFileSystem;
import judgels.gabriel.api.EvaluationException;
Expand Down Expand Up @@ -33,7 +34,12 @@ public void prepare(Scorer scorer, File evaluationDir, File sourceFile) throws P
try {
fs.uploadZippedFiles(Paths.get(""), new FileInputStream(sourceFile));
} catch (RuntimeException | FileNotFoundException e) {
throw new PreparationException(e);
if (e.getCause() instanceof ZipException) {
// Pass through.
// A possible cause is when zip file contains empty output file(s).
} else {
throw new PreparationException(e);
}
}

for (File file : FileUtils.listFiles(evaluationDir, null, false)) {
Expand Down

0 comments on commit 06396f8

Please sign in to comment.