Skip to content

Commit bcefb09

Browse files
committed
Update for loop
1 parent 697b152 commit bcefb09

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/Apache5HttpClient.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.security.cert.CertificateException;
3232
import java.security.cert.X509Certificate;
3333
import java.time.Duration;
34+
import java.util.Arrays;
3435
import java.util.Iterator;
3536
import java.util.Optional;
3637
import java.util.concurrent.TimeUnit;
@@ -780,24 +781,16 @@ private static void checkTcpSocketOptionPermissions() {
780781
+ String.join("\", \"", REQUIRED_TCP_SOCKET_OPTION_PERMISSIONS)
781782
+ "\" when a SecurityManager is active.", e);
782783
}
783-
log.debug(() -> "SecurityManager denied a non-TCP socket option permission during "
784-
+ "verification: " + e.getMessage(), e);
784+
log.debug(() -> "SecurityManager denied a non-TCP socket option permission during verification: "
785+
+ e.getMessage(), e);
785786
} catch (Exception e) {
786787
log.debug(() -> "Could not verify jdk.net.NetworkPermission for TCP socket options: " + e.getMessage(), e);
787788
}
788789
}
789790

790-
private static boolean isTcpSocketOptionPermissionDenied(SecurityException e) {
791-
String message = e.getMessage();
792-
if (message == null) {
793-
return false;
794-
}
795-
for (String perm : REQUIRED_TCP_SOCKET_OPTION_PERMISSIONS) {
796-
if (message.contains(perm)) {
797-
return true;
798-
}
799-
}
800-
return false;
791+
private static boolean isTcpSocketOptionPermissionDenied(SecurityException securityException) {
792+
String message = securityException.getMessage();
793+
return message != null && Arrays.stream(REQUIRED_TCP_SOCKET_OPTION_PERMISSIONS).anyMatch(message::contains);
801794
}
802795

803796
}

0 commit comments

Comments
 (0)