From 7576d9bfcf2b499d622c67d2dc914d482e745584 Mon Sep 17 00:00:00 2001 From: Thorsten Vitt Date: Sun, 13 Mar 2016 16:02:17 +0100 Subject: [PATCH] Allow a limited number of pages to fail. Otherwise, even one failing page will inhibit deployment. --- pom.xml | 2 ++ .../java/net/faustedition/gen/DiplomaticConversion.java | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index efa336a..ad6c4c1 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,7 @@ utf-8 beta.faustedition.net:/var/www/dev + 10 @@ -210,6 +211,7 @@ -classpath -Dphantomjs.binary=${phantomjs.binary} + -Dfaust.diplo.allowedFailures=${faust.diplo.allowedFailures} net.faustedition.gen.DiplomaticConversion diff --git a/src/main/java/net/faustedition/gen/DiplomaticConversion.java b/src/main/java/net/faustedition/gen/DiplomaticConversion.java index 5561b1a..28b6960 100644 --- a/src/main/java/net/faustedition/gen/DiplomaticConversion.java +++ b/src/main/java/net/faustedition/gen/DiplomaticConversion.java @@ -176,7 +176,13 @@ public static void main(final String[] args) throws IOException { if (failedConversions.length > 0) { logger.log(Level.SEVERE, MessageFormat.format("Conversion of the following {0} pages failed:\n {1}", failedConversions.length, Joiner.on("\n ").join(failedConversions))); - System.exit(1); + int allowedFailures = Integer.parseUnsignedInt(System.getProperty("faust.diplo.allowedFailures", "0")); + if (failedConversions.length > allowedFailures) { + logger.log(Level.SEVERE, MessageFormat.format("These are more than the {0} tolerated failures.", allowedFailures)); + System.exit(1); + } else { + logger.log(Level.INFO, MessageFormat.format("Up to {0} failures are tolerated.", allowedFailures)); + } } } finally { webServer.stop();