diff --git a/source/java/org/alfresco/filesys/FTPServerBean.java b/source/java/org/alfresco/filesys/FTPServerBean.java index c20bbe7c1e..cf3d0d2661 100644 --- a/source/java/org/alfresco/filesys/FTPServerBean.java +++ b/source/java/org/alfresco/filesys/FTPServerBean.java @@ -164,11 +164,12 @@ public class FTPServerBean extends AbstractLifecycleBean out.println("FTP Server Test"); out.println("---------------"); + ClassPathXmlApplicationContext ctx = null; try { // Create the configuration service in the same way that Spring creates it - ApplicationContext ctx = new ClassPathXmlApplicationContext("alfresco/application-context.xml"); + ctx = new ClassPathXmlApplicationContext("alfresco/application-context.xml"); // Get the FTP server bean @@ -227,6 +228,13 @@ public class FTPServerBean extends AbstractLifecycleBean { ex.printStackTrace(); } + finally + { + if (ctx != null) + { + ctx.close(); + } + } System.exit(1); }