aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-05 20:11:59 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-05 20:11:59 +0900
commitf6dbc7d4728c6ed51157a5f05a332b71ecebae3b (patch)
treef2709e797e18a713ebfb151909a087759648cee5 /org.eclipse.jgit/src/org
parentc633ea2ac4762de1b4cbe7101f3da86081f958ab (diff)
downloadjgit-f6dbc7d4728c6ed51157a5f05a332b71ecebae3b.tar.gz
jgit-f6dbc7d4728c6ed51157a5f05a332b71ecebae3b.zip
AmazonS3: Open InputStream/FileInputStream in try-with-resource
Change-Id: I71606e14d2b3cf085b8d1343c3858e7a729a173e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
index 0ed5d3c958..d7c5b9d7f9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
@@ -650,11 +650,8 @@ public class AmazonS3 {
static Properties properties(final File authFile)
throws FileNotFoundException, IOException {
final Properties p = new Properties();
- final FileInputStream in = new FileInputStream(authFile);
- try {
+ try (FileInputStream in = new FileInputStream(authFile)) {
p.load(in);
- } finally {
- in.close();
}
return p;
}
@@ -697,16 +694,13 @@ public class AmazonS3 {
throw new IOException(JGitText.get().noXMLParserAvailable);
}
xr.setContentHandler(this);
- final InputStream in = c.getInputStream();
- try {
+ try (InputStream in = c.getInputStream()) {
xr.parse(new InputSource(in));
} catch (SAXException parsingError) {
throw new IOException(
MessageFormat.format(
JGitText.get().errorListing, prefix),
parsingError);
- } finally {
- in.close();
}
return;