@@ -30,8 +30,7 @@ public final class StudentFileAwareUnzipper implements Unzipper {
30
30
31
31
private StudentFilePolicy filePolicy ;
32
32
33
- public StudentFileAwareUnzipper () {
34
- }
33
+ public StudentFileAwareUnzipper () {}
35
34
36
35
public StudentFileAwareUnzipper (StudentFilePolicy filePolicy ) {
37
36
this .filePolicy = filePolicy ;
@@ -70,15 +69,22 @@ public UnzipResult unzip(Path zip, Path target) throws IOException {
70
69
ZipArchiveEntry entry = entries .nextElement ();
71
70
72
71
if (entry .getName ().startsWith (projectDirInZip )) {
73
- String restOfPath = trimSlashes (entry .getName ().substring (projectDirInZip .length ()));
72
+ String restOfPath =
73
+ trimSlashes (entry .getName ().substring (projectDirInZip .length ()));
74
74
75
- Path entryTargetPath = target .resolve (trimSlashes (restOfPath .replace ("/" , File .separator )));
75
+ Path entryTargetPath =
76
+ target .resolve (trimSlashes (restOfPath .replace ("/" , File .separator )));
76
77
pathsInZip .add (entryTargetPath );
77
78
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 );
79
83
if (entry .isDirectory () || entryTargetPath .toFile ().isDirectory ()) {
80
84
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 ());
82
88
continue ;
83
89
}
84
90
boolean shouldWrite ;
@@ -121,10 +127,11 @@ public UnzipResult unzip(Path zip, Path target) throws IOException {
121
127
}
122
128
123
129
// 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 {
125
133
126
134
for (File file : curDir .toFile ().listFiles ()) {
127
- // Path relPath = Paths.get(trimSlashes(file.getPath().substring(projectDir.getPath().length())));
128
135
Path filePath = file .toPath ();
129
136
if (file .isDirectory ()) {
130
137
deleteFilesNotInZip (projectDir , file .toPath (), result , pathsInZip );
0 commit comments