Fix unit test failure. Ignore exceptions when destroying APR connector if APR was...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 27 Jul 2010 20:56:10 +0000 (20:56 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 27 Jul 2010 20:56:10 +0000 (20:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@979865 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/AprEndpoint.java

index c96edc1..2400ebf 100644 (file)
@@ -700,14 +700,26 @@ public class AprEndpoint extends AbstractEndpoint {
         if (running) {
             stop();
         }
-        Pool.destroy(serverSockPool);
+        try {
+            Pool.destroy(serverSockPool);
+        } catch (UnsatisfiedLinkError e) {
+            // Ignore - APR was not initialised
+        }
         serverSockPool = 0;
         // Close server socket
-        Socket.close(serverSock);
+        try {
+            Socket.close(serverSock);
+        } catch (UnsatisfiedLinkError e) {
+            // Ignore - APR was not initialised
+        }
         serverSock = 0;
         sslContext = 0;
         // Close all APR memory pools and resources
-        Pool.destroy(rootPool);
+        try {
+            Pool.destroy(rootPool);
+        } catch (UnsatisfiedLinkError e) {
+            // Ignore - APR was not initialised
+        }
         rootPool = 0;
         initialized = false;
     }