Skip to content

Commit e55fc54

Browse files
committed
ocd: Minor codestyle corrections to jar repacker
1 parent 168b95f commit e55fc54

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/main/java/org/cadixdev/atlas/util/JarRepacker.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
package org.cadixdev.atlas.util;
88

9+
import static java.nio.file.StandardCopyOption.ATOMIC_MOVE;
10+
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
11+
912
import java.io.IOException;
1013
import java.io.InputStream;
1114
import java.io.OutputStream;
@@ -19,12 +22,17 @@
1922
import java.util.jar.Manifest;
2023
import java.util.zip.ZipEntry;
2124

22-
import static java.nio.file.StandardCopyOption.ATOMIC_MOVE;
23-
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
24-
25+
/**
26+
* A helper class for repackaging jar files so that they're read by Java correctly, see {@link #verifyJarManifest(Path)}
27+
* for more details.
28+
*
29+
* @author Kyle Wood
30+
* @since 0.2.1
31+
*/
2532
public final class JarRepacker {
2633

27-
private JarRepacker() {}
34+
private JarRepacker() {
35+
}
2836

2937
/**
3038
* {@link JarInputStream} requires that if a {@code META-INF/MANIFEST.MF} record is present in a jar file, it must be
@@ -86,14 +94,16 @@ private static void fixJarManifest(final Path outputJar) throws IOException {
8694
out.putNextEntry(new ZipEntry(name));
8795
try (final InputStream input = jarFile.getInputStream(currentEntry)) {
8896
copy(input, out, buffer);
89-
} finally {
97+
}
98+
finally {
9099
out.closeEntry();
91100
}
92101
}
93102
}
94103

95104
Files.move(tempOut, outputJar, REPLACE_EXISTING, ATOMIC_MOVE);
96-
} finally {
105+
}
106+
finally {
97107
Files.deleteIfExists(tempOut);
98108
}
99109
}
@@ -137,4 +147,5 @@ private static void copy(final InputStream from, final OutputStream to, final by
137147
to.write(buffer, 0, read);
138148
}
139149
}
150+
140151
}

0 commit comments

Comments
 (0)