You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by ja...@apache.org on 2016/01/28 16:41:25 UTC

svn commit: r1727388 - /ace/trunk/org.apache.ace.test/src/org/apache/ace/it/IntegrationTestBase.java

Author: jawi
Date: Thu Jan 28 15:41:25 2016
New Revision: 1727388

URL: http://svn.apache.org/viewvc?rev=1727388&view=rev
Log:
Try to improve the CI on Apache:

- it appears that the configuration of the HTTP service can cause other
  exceptions than we anticipate in the integration test base. Catching all
  IO-exceptions might improve the stability of this method.



Modified:
    ace/trunk/org.apache.ace.test/src/org/apache/ace/it/IntegrationTestBase.java

Modified: ace/trunk/org.apache.ace.test/src/org/apache/ace/it/IntegrationTestBase.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.test/src/org/apache/ace/it/IntegrationTestBase.java?rev=1727388&r1=1727387&r2=1727388&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.test/src/org/apache/ace/it/IntegrationTestBase.java (original)
+++ ace/trunk/org.apache.ace.test/src/org/apache/ace/it/IntegrationTestBase.java Thu Jan 28 15:41:25 2016
@@ -25,7 +25,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Method;
-import java.net.ConnectException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -37,8 +36,6 @@ import java.util.Properties;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import junit.framework.TestCase;
-
 import org.apache.ace.test.constants.TestConstants;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.ComponentDependencyDeclaration;
@@ -59,6 +56,8 @@ import org.osgi.service.event.EventHandl
 import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 
+import junit.framework.TestCase;
+
 /**
  * Base class for integration tests. There is no technical reason to use this, but it might make your life easier.<br>
  * <br>
@@ -227,18 +226,17 @@ public class IntegrationTestBase extends
         do {
             Thread.sleep(50);
 
-            try {
-                InputStream is = url.openStream();
+            try (InputStream is = url.openStream()) {
                 is.close();
                 ready = true;
             }
-            catch (ConnectException exception) {
-                // Not there yet...
-            }
             catch (FileNotFoundException exception) {
                 // Ok; expected...
                 ready = true;
             }
+            catch (IOException exception) {
+                // Not there yet...
+            }
         }
         while (!ready && tries-- > 0);