From ec5630294a3cee09e34beb716dcda3f8f19ffb5a Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Mon, 30 Jun 2014 08:04:58 -0700 Subject: [PATCH] fix for previous commit, formatting was fixed to pass on CI --- .../filters/SuppressionsLoaderTest.java | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java index 666a1053e..f699f999e 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java @@ -57,28 +57,36 @@ public class SuppressionsLoaderTest } @Test - public void testLoadFromURL() throws CheckstyleException, InterruptedException + public void testLoadFromURL() + throws CheckstyleException, InterruptedException { - FilterSet fc = null; - - int attemptCount = 0; - while (attemptCount < 5) - try{ - - fc = SuppressionsLoader.loadSuppressions("http://checkstyle.sourceforge.net/files/suppressions_none.xml"); - break; - - } catch (CheckstyleException ex) { - // for some reason Travis CI failed some times(unstable) on reading this file - if (ex.getMessage().contains("unable to read")) { - attemptCount++; - // wait for bad/disconnection time to pass - Thread.sleep(1000); - } else { - throw ex; - } - } - + FilterSet fc = null; + + int attemptCount = 0; + final int attemptLimit = 5; + while (attemptCount <= attemptLimit) { + try { + + fc = SuppressionsLoader + .loadSuppressions("http://checkstyle.sourceforge.net/files/suppressions_none.xml"); + break; + + } + catch (CheckstyleException ex) { + // for some reason Travis CI failed some times(unstable) on reading this file + if (attemptCount < attemptLimit + && ex.getMessage().contains("unable to read")) + { + attemptCount++; + // wait for bad/disconnection time to pass + Thread.sleep(1000); + } + else { + throw ex; + } + } + } + final FilterSet fc2 = new FilterSet(); assertEquals(fc, fc2); }