[jboss-svn-commits] JBL Code SVN: r29866 - labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/submit.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Oct 29 09:52:45 EDT 2009


Author: mazz
Date: 2009-10-29 09:52:44 -0400 (Thu, 29 Oct 2009)
New Revision: 29866

Modified:
   labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/submit/Submit.java
Log:
make sure the socket is closed, even if an error occurs

Modified: labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/submit/Submit.java
===================================================================
--- labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/submit/Submit.java	2009-10-28 22:55:19 UTC (rev 29865)
+++ labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/submit/Submit.java	2009-10-29 13:52:44 UTC (rev 29866)
@@ -93,10 +93,13 @@
      */
     public String deleteAllRules() throws Exception {
         Comm comm = new Comm(address, port);
-        comm.println("DELETEALL");
-        String results = comm.readResponse();
-        comm.close();
-        return results;
+        try {
+            comm.println("DELETEALL");
+            String results = comm.readResponse();
+            return results;
+        } finally {
+            comm.close();
+        }
     }
 
     /**
@@ -109,10 +112,13 @@
      */
     public String listAllRules() throws Exception {
         Comm comm = new Comm(address, port);
-        comm.println("LIST");
-        String results = comm.readResponse();
-        comm.close();
-        return results;
+        try {
+            comm.println("LIST");
+            String results = comm.readResponse();
+            return results;
+        } finally {
+            comm.close();
+        }
     }
 
     /**
@@ -141,10 +147,13 @@
         str.append("ENDBOOT\n");
 
         Comm comm = new Comm(this.address, this.port);
-        comm.print(str.toString());
-        String results = comm.readResponse();
-        comm.close();
-        return results;
+        try {
+            comm.print(str.toString());
+            String results = comm.readResponse();
+            return results;
+        } finally {
+            comm.close();
+        }
     }
 
     /**
@@ -173,10 +182,13 @@
         str.append("ENDSYS\n");
 
         Comm comm = new Comm(this.address, this.port);
-        comm.print(str.toString());
-        String results = comm.readResponse();
-        comm.close();
-        return results;
+        try {
+            comm.print(str.toString());
+            String results = comm.readResponse();
+            return results;
+        } finally {
+            comm.close();
+        }
     }
 
     /**
@@ -229,11 +241,13 @@
         str.append("ENDLOAD\n");
 
         Comm comm = new Comm(this.address, this.port);
-        comm.print(str.toString());
-        String results = comm.readResponse();
-        comm.close();
-        return results;
-
+        try {
+            comm.print(str.toString());
+            String results = comm.readResponse();
+            return results;
+        } finally {
+            comm.close();
+        }
     }
 
     /**
@@ -288,11 +302,13 @@
         str.append("ENDDELETE\n");
 
         Comm comm = new Comm(this.address, this.port);
-        comm.print(str.toString());
-        String results = comm.readResponse();
-        comm.close();
-        return results;
-
+        try {
+            comm.print(str.toString());
+            String results = comm.readResponse();
+            return results;
+        } finally {
+            comm.close();
+        }
     }
 
     private Map<String, String> getRulesFromRuleFiles(List<String> filePaths) throws Exception {



More information about the jboss-svn-commits mailing list