jgit/org.eclipse.jgit.ant
Christian Halstrick 80113c7bb6 Fix resource leaks due to unclosed repositories
Whenever a call to JGit returns a Repository the caller should make sure
to call close() on it if he doesn't need it anymore. Since instances of
Repository contain e.g. open FileOutputStreams (for pack files)
forgetting to close the repository can lead to resource leaks.

This was the reason why dozens of the JUnit tests failed on Windows
with "Can't delete file ...." errors. 

In LocalDiskRepositoryTestCase.tearDown() we tried to delete the
repositories we used during tests which failed because we had open
FileOutputStreams.

Not only the obvious cases during Clone or Init operations returned
Repositories, but also the new SubModule API created repository
instances. In some places we even forgot to close submodule repositories
in our internal coding.

To see the effects of this fix run the JGit JUnit tests under Windows.
On other platforms it's harder to see because either the leaking
resources don't lead to failing JUnit tests (on Unix you can delete
files with open FileOutputStreams) or the java gc runs differently and
cleans up the resources earlier.

Change-Id: I6d4f637b0d4af20ff4d501db091548696373a58a
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-06-16 00:19:51 +02:00
..
.settings Enforce the use of Java5 API:s only (with a few exceptions) 2011-12-16 01:01:36 +01:00
META-INF Prepare 2.1.0 builds 2012-06-14 00:45:13 +02:00
resources/org/eclipse/jgit/ant Add GitAddTask 2011-05-23 08:39:40 -05:00
src/org/eclipse/jgit/ant/tasks Fix resource leaks due to unclosed repositories 2012-06-16 00:19:51 +02:00
.classpath Add org.eclipse.jgit.ant 2011-05-02 09:12:55 -05:00
.gitignore Add org.eclipse.jgit.ant 2011-05-02 09:12:55 -05:00
.project Enforce the use of Java5 API:s only (with a few exceptions) 2011-12-16 01:01:36 +01:00
about.html Add missing about.html files to all shipped bundles 2011-06-08 21:51:51 +02:00
build.properties Add missing about.html files to all shipped bundles 2011-06-08 21:51:51 +02:00
plugin.properties Remove incubation marker 2011-05-31 22:53:53 +02:00
pom.xml Prepare 2.1.0 builds 2012-06-14 00:45:13 +02:00