From a5e49f64d040e7a1c04d9ed1a2f7717645779b97 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 16 Jul 2007 10:52:03 +0000
Subject: [PATCH] Close the client socket that we used when trying to check that we can use a given port in the canUseAsPort method.
---
opends/src/server/org/opends/server/util/SetupUtils.java | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/util/SetupUtils.java b/opends/src/server/org/opends/server/util/SetupUtils.java
index 9719b62..20e779e 100644
--- a/opends/src/server/org/opends/server/util/SetupUtils.java
+++ b/opends/src/server/org/opends/server/util/SetupUtils.java
@@ -272,14 +272,30 @@
* socket there is already someone listening to the port (is the case
* of products as Sun DS 6.0).
*/
+ Socket s = null;
try
{
- new Socket().connect(socketAddress, 1000);
+ s = new Socket();
+ s.connect(socketAddress, 1000);
canUseAsPort = false;
- } catch (IOException ioe)
+ } catch (Throwable t)
{
}
+ finally
+ {
+ if (s != null)
+ {
+ try
+ {
+ s.close();
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+ }
+
} catch (IOException ex)
{
--
Gitblit v1.10.0