AmazonS3: Open InputStream/FileInputStream in try-with-resource
Change-Id: I71606e14d2b3cf085b8d1343c3858e7a729a173e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
c633ea2ac4
commit
f6dbc7d472
|
@ -650,11 +650,8 @@ void authorize(final HttpURLConnection c) throws IOException {
|
|||
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 @@ void list() throws IOException {
|
|||
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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue