This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 6b87582  Using try-with-resources in a few places
6b87582 is described below

commit 6b87582164f2d6e950bc896176d72ff28cebfad0
Author: Colm O hEigeartaigh <cohei...@apache.org>
AuthorDate: Mon Apr 9 17:51:21 2018 +0100

    Using try-with-resources in a few places
---
 .../java/org/apache/cxf/jaxrs/utils/ResourceUtils.java   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
index 62ead3b..39d9769 100644
--- 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
+++ 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
@@ -537,8 +537,7 @@ public final class ResourceUtils {
 
 
     public static List<UserResource> getUserResources(String loc, Bus bus) {
-        try {
-            InputStream is = ResourceUtils.getResourceStream(loc, bus);
+        try (InputStream is = ResourceUtils.getResourceStream(loc, bus)) {
             if (is == null) {
                 return null;
             }
@@ -602,8 +601,9 @@ public final class ResourceUtils {
 
     public static Properties loadProperties(String propertiesLocation, Bus 
bus) throws Exception {
         Properties props = new Properties();
-        InputStream is = getResourceStream(propertiesLocation, bus);
-        props.load(is);
+        try (InputStream is = getResourceStream(propertiesLocation, bus)) {
+            props.load(is);
+        }
         return props;
     }
 
@@ -823,7 +823,7 @@ public final class ResourceUtils {
         Annotation[][] anns = c.getParameterAnnotations();
         Type[] genericTypes = c.getGenericParameterTypes();
         @SuppressWarnings("unchecked")
-        MultivaluedMap<String, String> templateValues = 
+        MultivaluedMap<String, String> templateValues =
             (MultivaluedMap<String, 
String>)m.get(URITemplate.TEMPLATE_PARAMETERS);
         Object[] values = new Object[params.length];
         for (int i = 0; i < params.length; i++) {
@@ -848,11 +848,11 @@ public final class ResourceUtils {
         }
         return values;
     }
-    
+
     @SuppressWarnings("unchecked")
-    public static JAXRSServerFactoryBean createApplication(Application app, 
+    public static JAXRSServerFactoryBean createApplication(Application app,
                                                            boolean 
ignoreAppPath,
-                                                           boolean 
staticSubresourceResolution, 
+                                                           boolean 
staticSubresourceResolution,
                                                            boolean 
useSingletonResourceProvider,
                                                            Bus bus) {
 

-- 
To stop receiving notification emails like this one, please contact
cohei...@apache.org.

Reply via email to