You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2020/11/30 10:44:53 UTC
[sling-org-apache-sling-karaf-integration-tests] branch master
updated: style
This is an automated email from the ASF dual-hosted git repository.
olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-karaf-integration-tests.git
The following commit(s) were added to refs/heads/master by this push:
new 129de19 style
129de19 is described below
commit 129de1948c711e387147bcac866788b96876f407
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Nov 30 11:43:52 2020 +0100
style
---
src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java b/src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java
index 2f99729..0d755e7 100644
--- a/src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java
+++ b/src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java
@@ -69,11 +69,8 @@ public abstract class KarafTestSupport {
}
protected synchronized int findFreePort() {
- try {
- final ServerSocket serverSocket = new ServerSocket(0);
- final int port = serverSocket.getLocalPort();
- serverSocket.close();
- return port;
+ try (final ServerSocket serverSocket = new ServerSocket(0)) {
+ return serverSocket.getLocalPort();
} catch (Exception e) {
throw new RuntimeException(e);
}