Skip to content

Commit ebd72c9

Browse files
committed
Code style
1 parent ba4fc1f commit ebd72c9

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

tmc-langs-framework/src/main/java/fi/helsinki/cs/tmc/langs/io/zip/StudentFileAwareUnzipper.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public final class StudentFileAwareUnzipper implements Unzipper {
3030

3131
private StudentFilePolicy filePolicy;
3232

33-
public StudentFileAwareUnzipper() {
34-
}
33+
public StudentFileAwareUnzipper() {}
3534

3635
public StudentFileAwareUnzipper(StudentFilePolicy filePolicy) {
3736
this.filePolicy = filePolicy;
@@ -70,15 +69,22 @@ public UnzipResult unzip(Path zip, Path target) throws IOException {
7069
ZipArchiveEntry entry = entries.nextElement();
7170

7271
if (entry.getName().startsWith(projectDirInZip)) {
73-
String restOfPath = trimSlashes(entry.getName().substring(projectDirInZip.length()));
72+
String restOfPath =
73+
trimSlashes(entry.getName().substring(projectDirInZip.length()));
7474

75-
Path entryTargetPath = target.resolve(trimSlashes(restOfPath.replace("/", File.separator)));
75+
Path entryTargetPath =
76+
target.resolve(trimSlashes(restOfPath.replace("/", File.separator)));
7677
pathsInZip.add(entryTargetPath);
7778

78-
log.debug("Processing zipEntry with name {} to {}", entry.getName(), entryTargetPath);
79+
log.debug(
80+
"Processing zipEntry with name {} to {}",
81+
entry.getName(),
82+
entryTargetPath);
7983
if (entry.isDirectory() || entryTargetPath.toFile().isDirectory()) {
8084
Files.createDirectories(entryTargetPath);
81-
log.debug("{} is a directory - creating and off to the next file ", entry.getName());
85+
log.debug(
86+
"{} is a directory - creating and off to the next file ",
87+
entry.getName());
8288
continue;
8389
}
8490
boolean shouldWrite;
@@ -121,10 +127,11 @@ public UnzipResult unzip(Path zip, Path target) throws IOException {
121127
}
122128

123129
// TODO: validate
124-
private void deleteFilesNotInZip(Path projectDir, Path curDir, UnzipResult result, Set<Path> pathsInZip) throws IOException {
130+
private void deleteFilesNotInZip(
131+
Path projectDir, Path curDir, UnzipResult result, Set<Path> pathsInZip)
132+
throws IOException {
125133

126134
for (File file : curDir.toFile().listFiles()) {
127-
// Path relPath = Paths.get(trimSlashes(file.getPath().substring(projectDir.getPath().length())));
128135
Path filePath = file.toPath();
129136
if (file.isDirectory()) {
130137
deleteFilesNotInZip(projectDir, file.toPath(), result, pathsInZip);

tmc-langs-util/src/main/java/fi/helsinki/cs/tmc/langs/util/TaskExecutor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ void extractProject(Path compressedProject, Path targetLocation, boolean overwri
101101
* Extract a given archive file containing a compressed project to a target location.
102102
*
103103
* <p>This will overwrite all files, even when specified as student files. Similar to
104-
* {@link fi.helsinki.cs.tmc.langs.util.TaskExecutor#extractProject(Path, Path, boolean)} but more implicit naming
104+
* {@link fi.helsinki.cs.tmc.langs.util.TaskExecutor#extractProject(Path, Path, boolean)}
105+
* but more implicit naming
105106
*
106107
* @param compressedProject A path to the compressed archive.
107108
* @param targetLocation Location where the archive should be extracted to

tmc-langs-util/src/main/java/fi/helsinki/cs/tmc/langs/util/TaskExecutorImpl.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ public void extractProject(
8585
}
8686

8787
@Override
88-
public void extractAndRewriteEveryhing(Path compressedProject, Path targetLocation) throws IOException {
89-
Unzipper unzipper =
90-
new StudentFileAwareUnzipper(new NothingIsStudentFileStudentFilePolicy());
91-
unzipper.unzip(compressedProject, targetLocation);
88+
public void extractAndRewriteEveryhing(Path compressedProject, Path targetLocation)
89+
throws IOException {
90+
Unzipper unzipper =
91+
new StudentFileAwareUnzipper(new NothingIsStudentFileStudentFilePolicy());
92+
unzipper.unzip(compressedProject, targetLocation);
9293
}
9394

9495
@Override

0 commit comments

Comments
 (0)