Catch, log and continue upon encountering an exception
This commit is contained in:
@@ -36,6 +36,7 @@ public class SimpleRunner {
|
|||||||
|
|
||||||
private static void run(CompressionStats stats, String[] filenames) throws IOException {
|
private static void run(CompressionStats stats, String[] filenames) throws IOException {
|
||||||
for (String filename : filenames) {
|
for (String filename : filenames) {
|
||||||
|
try {
|
||||||
File file = new File(filename);
|
File file = new File(filename);
|
||||||
byte[] bytes = Files.toByteArray(file);
|
byte[] bytes = Files.toByteArray(file);
|
||||||
Font font = FONT_FACTORY.loadFonts(bytes)[0];
|
Font font = FONT_FACTORY.loadFonts(bytes)[0];
|
||||||
@@ -50,6 +51,10 @@ public class SimpleRunner {
|
|||||||
.setSize(CompressionStats.Size.GZIP, gzip.length)
|
.setSize(CompressionStats.Size.GZIP, gzip.length)
|
||||||
.setSize(CompressionStats.Size.WOFF2, woff2.length)
|
.setSize(CompressionStats.Size.WOFF2, woff2.length)
|
||||||
.build());
|
.build());
|
||||||
|
} catch (Throwable t) {
|
||||||
|
System.err.printf("WARNING: failed to compress: %s\n", filename);
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user