From 02b5eadb02600b7afc44ab8033fa404b840bbfc8 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 3 Apr 2014 21:48:35 +0200 Subject: [PATCH 1/2] close subversion context, if the service provider is closed --- .../spi/SvnRepositoryServiceProvider.java | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java index ba0e9cf888..7626bdd32a 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java @@ -30,18 +30,23 @@ */ + package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- import com.google.common.collect.ImmutableSet; +import com.google.common.io.Closeables; import sonia.scm.repository.Repository; import sonia.scm.repository.SvnRepositoryHandler; +import sonia.scm.repository.SvnUtil; import sonia.scm.repository.api.Command; //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; + import java.util.Set; /** @@ -53,8 +58,8 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider /** Field description */ public static final Set COMMANDS = ImmutableSet.of(Command.BLAME, - Command.BROWSE, Command.CAT, - Command.DIFF, Command.LOG); + Command.BROWSE, Command.CAT, + Command.DIFF, Command.LOG); //~--- constructors --------------------------------------------------------- @@ -66,12 +71,26 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider * @param repository */ SvnRepositoryServiceProvider(SvnRepositoryHandler handler, - Repository repository) + Repository repository) { this.repository = repository; this.context = new SvnContext(handler.getDirectory(repository)); } + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @throws IOException + */ + @Override + public void close() throws IOException + { + Closeables.close(context, true); + } + //~--- get methods ---------------------------------------------------------- /** @@ -149,8 +168,8 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider //~--- fields --------------------------------------------------------------- /** Field description */ - private SvnContext context; + private final SvnContext context; /** Field description */ - private Repository repository; + private final Repository repository; } From 988e85ea71f986ed20708ad77f5de343552f49ed Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 14 Apr 2014 11:38:39 +0200 Subject: [PATCH 2/2] close branch issue-554