syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/6] syncope git commit: [SYNCOPE-938] Applying all Netbeans hints for upgrade to JDK 8
Date Fri, 25 Aug 2017 15:37:30 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 4e6f6d0e4 -> 5b9cb93da
  refs/heads/master a02779a2c -> 62d3a901c


http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
b/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
index 0fc7b22..5cafb9b 100644
--- a/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
+++ b/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
@@ -22,8 +22,6 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.panels.SAML2IdPsDirectoryPanel;
 import org.apache.syncope.client.console.rest.SAML2IdPsRestClient;
@@ -103,25 +101,25 @@ public class SAML2IdPWizardBuilder extends AjaxWizardBuilder<SAML2IdPTO>
{
             List<Component> fields = new ArrayList<>();
 
             FieldPanel<String> name = new AjaxTextFieldPanel(
-                    "field", "name", new PropertyModel<String>(idpTO, "name"), false);
+                    "field", "name", new PropertyModel<>(idpTO, "name"), false);
             name.setRequired(true);
             fields.add(name);
 
             AjaxCheckBoxPanel createUnmatching = new AjaxCheckBoxPanel(
-                    "field", "createUnmatching", new PropertyModel<Boolean>(idpTO,
"createUnmatching"), false);
+                    "field", "createUnmatching", new PropertyModel<>(idpTO, "createUnmatching"),
false);
             fields.add(createUnmatching);
 
             AjaxCheckBoxPanel updateMatching = new AjaxCheckBoxPanel(
-                    "field", "updateMatching", new PropertyModel<Boolean>(idpTO, "updateMatching"),
false);
+                    "field", "updateMatching", new PropertyModel<>(idpTO, "updateMatching"),
false);
             fields.add(updateMatching);
 
             AjaxCheckBoxPanel useDeflateEncoding = new AjaxCheckBoxPanel(
-                    "field", "useDeflateEncoding", new PropertyModel<Boolean>(idpTO,
"useDeflateEncoding"), false);
+                    "field", "useDeflateEncoding", new PropertyModel<>(idpTO, "useDeflateEncoding"),
false);
             fields.add(useDeflateEncoding);
 
             AjaxDropDownChoicePanel<SAML2BindingType> bindingType =
                     new AjaxDropDownChoicePanel<>("field", "bindingType",
-                            new PropertyModel<SAML2BindingType>(idpTO, "bindingType"),
false);
+                            new PropertyModel<>(idpTO, "bindingType"), false);
             bindingType.setChoices(Arrays.asList(SAML2BindingType.values()));
             fields.add(bindingType);
 
@@ -162,13 +160,7 @@ public class SAML2IdPWizardBuilder extends AjaxWizardBuilder<SAML2IdPTO>
{
 
     @Override
     protected Serializable onApplyInternal(final SAML2IdPTO modelObject) {
-        long connObjectKeyCount = IterableUtils.countMatches(modelObject.getItems(), new
Predicate<ItemTO>() {
-
-            @Override
-            public boolean evaluate(final ItemTO item) {
-                return item.isConnObjectKey();
-            }
-        });
+        long connObjectKeyCount = modelObject.getItems().stream().filter(ItemTO::isConnObjectKey).count();
         if (connObjectKeyCount != 1) {
             throw new IllegalArgumentException(
                     new StringResourceModel("connObjectKeyValidation", directoryPanel).getString());

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPCache.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPCache.java
b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPCache.java
index e56b4f8..9333923 100644
--- a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPCache.java
+++ b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPCache.java
@@ -46,8 +46,7 @@ import org.w3c.dom.Element;
 @Component
 public class SAML2IdPCache {
 
-    private final Map<String, SAML2IdPEntity> cache =
-            Collections.synchronizedMap(new HashMap<String, SAML2IdPEntity>());
+    private final Map<String, SAML2IdPEntity> cache = Collections.synchronizedMap(new
HashMap<>());
 
     @Autowired
     private SAML2SPLoader loader;

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java
----------------------------------------------------------------------
diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java
b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java
index dcfe72e..65261f2 100644
--- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java
+++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java
@@ -53,11 +53,8 @@ public class ServiceTimeoutServlet extends HttpServlet {
             // ignore
         }
 
-        final PrintWriter out = response.getWriter();
-        try {
+        try (PrintWriter out = response.getWriter()) {
             out.println("OK");
-        } finally {
-            out.close();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
----------------------------------------------------------------------
diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
index 6eefe5c..0a4f996 100644
--- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
+++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
@@ -64,16 +64,14 @@ public class ProvisioningImpl implements Provisioning {
         try {
             conn = DataSourceUtils.getConnection(dataSource);
 
-            PreparedStatement statement =
-                conn.prepareStatement("DELETE FROM user WHERE userId=?");
-            statement.setString(1, accountid);
-
-            String query = "DELETE FROM user WHERE userId='" + accountid + "';";
-            LOG.debug("Execute query: " + query);
+            try (PreparedStatement statement = conn.prepareStatement("DELETE FROM user WHERE
userId=?")) {
+                statement.setString(1, accountid);
 
-            statement.executeUpdate();
+                String query = "DELETE FROM user WHERE userId='" + accountid + "';";
+                LOG.debug("Execute query: " + query);
 
-            statement.close();
+                statement.executeUpdate();
+            }
 
             return accountid;
         } catch (SQLException e) {
@@ -108,9 +106,9 @@ public class ProvisioningImpl implements Provisioning {
 
         List<WSAttribute> schema = schema();
         Set<String> schemaNames = new HashSet<>();
-        for (WSAttribute attr : schema) {
+        schema.forEach(attr -> {
             schemaNames.add(attr.getName());
-        }
+        });
         schemaNames.add("__NAME__");
         schemaNames.add("__PASSWORD__");
 
@@ -159,14 +157,14 @@ public class ProvisioningImpl implements Provisioning {
             }
 
             if (set.length() > 0) {
-                PreparedStatement statement =
-                    conn.prepareStatement("UPDATE user SET " + set.toString() + " WHERE userId=?");
-                statement.setString(1, accountid);
-                String query = "UPDATE user SET " + set.toString() + " WHERE userId='" +
accountid + "';";
-                LOG.debug("Execute query: " + query);
+                try (PreparedStatement statement =
+                        conn.prepareStatement("UPDATE user SET " + set.toString() + " WHERE
userId=?")) {
+                    statement.setString(1, accountid);
+                    String query = "UPDATE user SET " + set.toString() + " WHERE userId='"
+ accountid + "';";
+                    LOG.debug("Execute query: " + query);
 
-                statement.executeUpdate();
-                statement.close();
+                    statement.executeUpdate();
+                }
             }
 
             return accountid;
@@ -200,36 +198,32 @@ public class ProvisioningImpl implements Provisioning {
             }
 
             conn = DataSourceUtils.getConnection(dataSource);
-            Statement statement = conn.createStatement();
-
-            ResultSet rs = statement.executeQuery(queryString);
-
-            ResultSetMetaData metaData = rs.getMetaData();
-            LOG.debug("Metadata: {}", metaData);
-
-            while (rs.next()) {
-                WSUser user = new WSUser();
+            try (Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery(queryString))
{
+                ResultSetMetaData metaData = rs.getMetaData();
+                LOG.debug("Metadata: {}", metaData);
+
+                while (rs.next()) {
+                    WSUser user = new WSUser();
+
+                    for (int i = 0; i < metaData.getColumnCount(); i++) {
+                        WSAttributeValue attr = new WSAttributeValue();
+                        attr.setName(metaData.getColumnLabel(i + 1));
+                        if (StringUtil.isNotBlank(rs.getString(i + 1))) {
+                            attr.addValue(rs.getString(i + 1));
+                        }
+                        if ("userId".equalsIgnoreCase(metaData.getColumnName(i + 1))) {
+                            attr.setKey(true);
+                            user.setAccountid(rs.getString(i + 1));
+                        }
 
-                for (int i = 0; i < metaData.getColumnCount(); i++) {
-                    WSAttributeValue attr = new WSAttributeValue();
-                    attr.setName(metaData.getColumnLabel(i + 1));
-                    if (StringUtil.isNotBlank(rs.getString(i + 1))) {
-                        attr.addValue(rs.getString(i + 1));
-                    }
-                    if ("userId".equalsIgnoreCase(metaData.getColumnName(i + 1))) {
-                        attr.setKey(true);
-                        user.setAccountid(rs.getString(i + 1));
+                        user.addAttribute(attr);
                     }
 
-                    user.addAttribute(attr);
+                    results.add(user);
                 }
 
-                results.add(user);
+                LOG.debug("Retrieved users: {}", results);
             }
-
-            LOG.debug("Retrieved users: {}", results);
-            rs.close();
-            statement.close();
         } catch (SQLException e) {
             LOG.error("Search operation failed", e);
         } finally {
@@ -245,9 +239,9 @@ public class ProvisioningImpl implements Provisioning {
 
         final List<WSAttribute> schema = schema();
         final Set<String> schemaNames = new HashSet<>();
-        for (WSAttribute attr : schema) {
+        schema.forEach(attr -> {
             schemaNames.add(attr.getName());
-        }
+        });
         schemaNames.add("__NAME__");
         schemaNames.add("__PASSWORD__");
 
@@ -255,65 +249,60 @@ public class ProvisioningImpl implements Provisioning {
         String query = null;
         try {
             conn = DataSourceUtils.getConnection(dataSource);
-            final Statement statement = conn.createStatement();
-
-            final StringBuilder keys = new StringBuilder();
-            final StringBuilder values = new StringBuilder();
-
-            String accountid = null;
-            String value;
-            for (WSAttributeValue attr : data) {
-                if (schemaNames.contains(attr.getName())) {
-                    LOG.debug("Bind attribute: {}", attr);
-
-                    if (attr.getValues() == null || attr.getValues().isEmpty()) {
-                        value = null;
-                    } else if (attr.getValues().size() == 1) {
-                        value = attr.getValues().get(0).toString();
-                    } else {
-                        value = attr.getValues().toString();
-                    }
+            String accountid;
+            try (Statement statement = conn.createStatement()) {
+                final StringBuilder keys = new StringBuilder();
+                final StringBuilder values = new StringBuilder();
+                accountid = null;
+                String value;
+                for (WSAttributeValue attr : data) {
+                    if (schemaNames.contains(attr.getName())) {
+                        LOG.debug("Bind attribute: {}", attr);
+
+                        if (attr.getValues() == null || attr.getValues().isEmpty()) {
+                            value = null;
+                        } else if (attr.getValues().size() == 1) {
+                            value = attr.getValues().get(0).toString();
+                        } else {
+                            value = attr.getValues().toString();
+                        }
 
-                    if (keys.length() > 0) {
-                        keys.append(",");
-                    }
+                        if (keys.length() > 0) {
+                            keys.append(",");
+                        }
 
-                    if (null == attr.getName()) {
-                        keys.append(attr.getName());
-                    } else {
-                        switch (attr.getName()) {
-                            case "__NAME__":
-                                keys.append("userId");
-                                break;
-                            case "__PASSWORD__":
-                                keys.append("password");
-                                break;
-                            default:
-                                keys.append(attr.getName());
-                                break;
+                        if (null == attr.getName()) {
+                            keys.append(attr.getName());
+                        } else {
+                            switch (attr.getName()) {
+                                case "__NAME__":
+                                    keys.append("userId");
+                                    break;
+                                case "__PASSWORD__":
+                                    keys.append("password");
+                                    break;
+                                default:
+                                    keys.append(attr.getName());
+                                    break;
+                            }
                         }
-                    }
 
-                    if (values.length() > 0) {
-                        values.append(",");
-                    }
+                        if (values.length() > 0) {
+                            values.append(",");
+                        }
 
-                    values.append(value == null ? null : "'" + value + "'");
+                        values.append(value == null ? null : "'" + value + "'");
 
-                    if (attr.isKey() && !attr.getValues().isEmpty()) {
-                        accountid = attr.getValues().get(0).toString();
+                        if (attr.isKey() && !attr.getValues().isEmpty()) {
+                            accountid = attr.getValues().get(0).toString();
+                        }
                     }
                 }
+                query = "INSERT INTO user (" + keys.toString() + ") VALUES (" + values.toString()
+ ")";
+                LOG.debug("Execute query: " + query);
+                statement.executeUpdate(query);
             }
 
-            query = "INSERT INTO user (" + keys.toString() + ") VALUES (" + values.toString()
+ ")";
-
-            LOG.debug("Execute query: " + query);
-
-            statement.executeUpdate(query);
-
-            statement.close();
-
             return accountid;
         } catch (SQLException e) {
             LOG.error("Creation failed:\n" + query, e);
@@ -352,7 +341,7 @@ public class ProvisioningImpl implements Provisioning {
         try {
             conn = DataSourceUtils.getConnection(dataSource);
             PreparedStatement statement =
-                conn.prepareStatement("SELECT userId FROM user WHERE userId=?");
+                    conn.prepareStatement("SELECT userId FROM user WHERE userId=?");
             statement.setString(1, username);
 
             final String query = "SELECT userId FROM user WHERE userId='" + username + "';";

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
index 32b3357..6e8e170 100644
--- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
@@ -205,20 +205,16 @@ public class ITImplementationLookup implements ImplementationLookup
{
         // in case the Elasticsearch extension is enabled, reinit a clean index for all available
domains
         if (AopUtils.getTargetClass(anySearchDAO).getName().contains("Elasticsearch")) {
             for (Map.Entry<String, DataSource> entry : domainsHolder.getDomains().entrySet())
{
-                AuthContextUtils.execWithAuthContext(entry.getKey(), new AuthContextUtils.Executable<Void>()
{
+                AuthContextUtils.execWithAuthContext(entry.getKey(), () -> {
+                    SchedTaskTO task = new SchedTaskTO();
+                    task.setJobDelegateClassName(
+                            "org.apache.syncope.core.provisioning.java.job.ElasticsearchReindex");
+                    task.setName("Elasticsearch Reindex");
+                    task = taskLogic.createSchedTask(task);
 
-                    @Override
-                    public Void exec() {
-                        SchedTaskTO task = new SchedTaskTO();
-                        task.setJobDelegateClassName(
-                                "org.apache.syncope.core.provisioning.java.job.ElasticsearchReindex");
-                        task.setName("Elasticsearch Reindex");
-                        task = taskLogic.createSchedTask(task);
+                    taskLogic.execute(task.getKey(), null, false);
 
-                        taskLogic.execute(task.getKey(), null, false);
-
-                        return null;
-                    }
+                    return null;
                 });
             }
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
index fcb6173..5ba0f70 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
@@ -26,13 +26,11 @@ import org.apache.syncope.common.rest.api.service.SyncopeService;
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.behavior.AbstractAjaxBehavior;
-import org.apache.wicket.behavior.Behavior;
 import org.apache.wicket.core.util.lang.PropertyResolver;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.util.tester.FormTester;
 import org.apache.wicket.util.tester.WicketTester;
 import org.apache.wicket.util.visit.IVisit;
-import org.apache.wicket.util.visit.IVisitor;
 import org.junit.BeforeClass;
 import org.junit.FixMethodOrder;
 import org.junit.runners.MethodSorters;
@@ -82,18 +80,14 @@ public abstract class AbstractConsoleITCase {
 
         Component component = TESTER.getComponentFromLastRenderedPage(searchPath);
         return (component instanceof MarkupContainer ? MarkupContainer.class.cast(component)
: component.getPage()).
-                visitChildren(ListItem.class, new IVisitor<ListItem<?>, Component>()
{
-
-                    @Override
-                    public void component(final ListItem<?> object, final IVisit<Component>
visit) {
-                        try {
-                            Method getter = PropertyResolver.getPropertyGetter(property,
object.getModelObject());
-                            if (getter != null && getter.invoke(object.getModelObject()).equals(key))
{
-                                visit.stop(object);
-                            }
-                        } catch (Exception e) {
-                            LOG.error("Error invoke method", e);
+                visitChildren(ListItem.class, (final ListItem<?> object, final IVisit<Component>
visit) -> {
+                    try {
+                        Method getter = PropertyResolver.getPropertyGetter(property, object.getModelObject());
+                        if (getter != null && getter.invoke(object.getModelObject()).equals(key))
{
+                            visit.stop(object);
                         }
+                    } catch (Exception e) {
+                        LOG.error("Error invoke method", e);
                     }
                 });
     }
@@ -101,22 +95,18 @@ public abstract class AbstractConsoleITCase {
     protected Component findComponentById(final String searchPath, final String id) {
         Component component = TESTER.getComponentFromLastRenderedPage(searchPath);
         return (component instanceof MarkupContainer ? MarkupContainer.class.cast(component)
: component.getPage()).
-                visitChildren(Component.class, new IVisitor<Component, Component>()
{
-
-                    @Override
-                    public void component(final Component object, final IVisit<Component>
visit) {
-                        if (object.getId().equals(id)) {
-                            visit.stop(object);
-                        }
+                visitChildren(Component.class, (final Component object, final IVisit<Component>
visit) -> {
+                    if (object.getId().equals(id)) {
+                        visit.stop(object);
                     }
                 });
     }
 
     protected void closeCallBack(final Component modal) {
-        for (Behavior behavior : modal.getBehaviors()) {
-            if (behavior instanceof AbstractAjaxBehavior) {
-                TESTER.executeBehavior((AbstractAjaxBehavior) behavior);
-            }
-        }
+        modal.getBehaviors().stream().
+                filter(behavior -> (behavior instanceof AbstractAjaxBehavior)).
+                forEachOrdered(behavior -> {
+                    TESTER.executeBehavior((AbstractAjaxBehavior) behavior);
+                });
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java
index e076c8c..904afab 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java
@@ -30,7 +30,6 @@ import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.util.visit.IVisit;
-import org.apache.wicket.util.visit.IVisitor;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -98,18 +97,14 @@ public class LogsITCase extends AbstractConsoleITCase {
         Component component = TESTER.getComponentFromLastRenderedPage(searchPath);
 
         Component result = component.getPage().
-                visitChildren(ListItem.class, new IVisitor<ListItem<LoggerTO>, Component>()
{
-
-                    @Override
-                    public void component(final ListItem<LoggerTO> object, final IVisit<Component>
visit) {
-                        try {
-                            if (object.getModelObject() instanceof LoggerTO && PropertyResolver.getPropertyGetter(
-                                    property, object.getModelObject()).invoke(object.getModelObject()).equals(key))
{
-                                visit.stop(object);
-                            }
-                        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
ex) {
-                            LOG.error("Error invoke method", ex);
+                visitChildren(ListItem.class, (final ListItem<LoggerTO> object, final
IVisit<Component> visit) -> {
+                    try {
+                        if (object.getModelObject() instanceof LoggerTO && PropertyResolver.getPropertyGetter(
+                                property, object.getModelObject()).invoke(object.getModelObject()).equals(key))
{
+                            visit.stop(object);
                         }
+                    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
ex) {
+                        LOG.error("Error invoke method", ex);
                     }
                 });
         return result;

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
b/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
index 3c121ca..dfc17d9 100644
--- a/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
+++ b/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
@@ -141,13 +141,12 @@ public class HttpUtils {
         try {
             final HttpPost httPost = httpPost(url, new StringEntity(stringEntity));
             httPost.addHeader("Content-Type", ContentType.APPLICATION_JSON.getMimeType());
-            final CloseableHttpResponse response = httpClient.execute(
-                    targetHost, httPost, setAuth(targetHost, new DigestScheme()));
-            status = response.getStatusLine().getStatusCode();
-            handler.logOutput("Http status: " + status, true);
-            InstallLog.getInstance().info("Http status: " + status);
-
-            response.close();
+            try (CloseableHttpResponse response =
+                    httpClient.execute(targetHost, httPost, setAuth(targetHost, new DigestScheme())))
{
+                status = response.getStatusLine().getStatusCode();
+                handler.logOutput("Http status: " + status, true);
+                InstallLog.getInstance().info("Http status: " + status);
+            }
         } catch (final IOException ioe) {
             final String messageError = "Error calling " + url + ": " + ioe.getMessage();
             handler.emitError(messageError, messageError);


Mime
View raw message