[spring-extensions] branch master updated: OSJ-285: Ensure that Closeable instances are actually closed after use

Brent Putman putmanb at georgetown.edu
Wed Feb 12 23:23:07 EST 2020


This is an automated email from the git hooks/post-receive script.

putmanb pushed a commit to branch master
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=f3943bcd0cf2fc68e8b1fb5ca837ecff30a3b953

The following commit(s) were added to refs/heads/master by this push:
       new  f3943bc   OSJ-285: Ensure that Closeable instances are actually closed after use
f3943bc is described below

commit f3943bcd0cf2fc68e8b1fb5ca837ecff30a3b953
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Wed Feb 12 23:23:06 2020 -0500

    OSJ-285: Ensure that Closeable instances are actually closed after use
    
    This one was being closed.  Just trying to adhere to the convention
    that the creator of the thing closes it, b/c the intent is clearer.
---
 .../net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java b/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
index 0a74eab..eb6a973 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
@@ -107,16 +107,14 @@ public class FileBackedHTTPResource extends HTTPResource {
             backingResource.getFile().delete();
             log.error("{}: Copy failed: {}", getDescription(), e.getMessage());
             throw e;
-        } finally {
-            input.close();
         }
+
         return new FileInputStream(backingResource.getFile());
     }
 
     /** {@inheritDoc} */
     @Override @Nonnull public InputStream getInputStream() throws IOException {
-        try {
-            final InputStream stream = super.getInputStream();
+        try (final InputStream stream = super.getInputStream()) {
             return saveAndClone(stream);
         } catch (final IOException ex) {
             log.debug("{} Error obtaining HTTPResource InputStream or creating backing file", getDescription(), ex);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list