aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java11
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java5
2 files changed, 4 insertions, 12 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java
index 5efc03b287..58acc5cafd 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java
@@ -96,14 +96,9 @@ class Version extends TextBuiltin {
}
private static String getBundleVersion(URL url) {
- try {
- InputStream is = url.openStream();
- try {
- Manifest manifest = new Manifest(is);
- return manifest.getMainAttributes().getValue("Bundle-Version"); //$NON-NLS-1$
- } finally {
- is.close();
- }
+ try (InputStream is = url.openStream()) {
+ Manifest manifest = new Manifest(is);
+ return manifest.getMainAttributes().getValue("Bundle-Version"); //$NON-NLS-1$
} catch (IOException e) {
// do nothing - will return null
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
index 83b7bcea26..6378e8d220 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
@@ -288,11 +288,8 @@ class TextHashFunctions extends TextBuiltin {
else
rb.findGitDir(dir);
- Repository repo = rb.build();
- try {
+ try (Repository repo = rb.build()) {
run(repo);
- } finally {
- repo.close();
}
}
}