You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by am...@apache.org on 2013/08/14 15:03:55 UTC

svn commit: r1513861 - /cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java

Author: amichai
Date: Wed Aug 14 13:03:55 2013
New Revision: 1513861

URL: http://svn.apache.org/r1513861
Log:
Merged revisions 1513793 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1513793 | amichai | 2013-08-14 13:03:55 +0300 (Wed, 14 Aug 2013) | 2 lines

  [CXF-5188] Fix resource leak when server fails to start

........

Modified:
    cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java

Modified: cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=1513861&r1=1513860&r2=1513861&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java Wed Aug 14 13:03:55 2013
@@ -201,7 +201,12 @@ public class ServerFactoryBean extends A
                                               : getServiceClass());
             
             if (start) {
-                server.start();
+                try {
+                    server.start();
+                } catch (RuntimeException re) {
+                    server.destroy(); // prevent resource leak
+                    throw re;
+                }
             }
             return server;
         } finally {