|
|
@@ -3,6 +3,7 @@ package de.jplag;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashSet;
|
|
|
@@ -209,23 +210,19 @@ public class Submission implements Comparable<Submission> {
|
|
|
* This method is used to copy files that can not be parsed to a special folder.
|
|
|
*/
|
|
|
private void copySubmission() {
|
|
|
- File rootDirectory = submissionRootFile.getParentFile();
|
|
|
- assert rootDirectory != null;
|
|
|
- File submissionDirectory = createSubdirectory(rootDirectory, ERROR_FOLDER, language.getIdentifier(), name);
|
|
|
+ File errorDirectory = createErrorDirectory(language.getIdentifier(), name);
|
|
|
+ logger.info("Copying erroneous submission to {}", errorDirectory.getAbsolutePath());
|
|
|
for (File file : files) {
|
|
|
try {
|
|
|
- Files.copy(file.toPath(), new File(submissionDirectory, file.getName()).toPath());
|
|
|
+ Files.copy(file.toPath(), new File(errorDirectory, file.getName()).toPath());
|
|
|
} catch (IOException exception) {
|
|
|
logger.error("Error copying file: " + exception.getMessage(), exception);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static File createSubdirectory(File parent, String... subdirectoryNames) {
|
|
|
- File subdirectory = parent;
|
|
|
- for (String name : subdirectoryNames) {
|
|
|
- subdirectory = new File(subdirectory, name);
|
|
|
- }
|
|
|
+ private static File createErrorDirectory(String... subdirectoryNames) {
|
|
|
+ File subdirectory = Path.of(ERROR_FOLDER, subdirectoryNames).toFile();
|
|
|
if (!subdirectory.exists()) {
|
|
|
subdirectory.mkdirs();
|
|
|
}
|