Skip to content

Commit 5e300d5

Browse files
ServerBuilderTest: ip calculation was improved
1 parent 916afef commit 5e300d5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/test/java/io/appium/java_client/service/local/ServerBuilderTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,18 @@ public class ServerBuilderTest {
6464
private OutputStream stream;
6565

6666
private static String getLocalIP(NetworkInterface intf) {
67-
String result = null;
6867
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr
6968
.hasMoreElements(); ) {
70-
String calculated;
7169
InetAddress inetAddress = enumIpAddr.nextElement();
7270
if (!inetAddress.isLoopbackAddress()) {
7371
InetAddressValidator validator = InetAddressValidator.getInstance();
74-
calculated = inetAddress.getHostAddress().toString();
72+
String calculated = inetAddress.getHostAddress().toString();
7573
if (validator.isValid(calculated)) {
76-
result = calculated;
77-
break;
74+
return calculated;
7875
}
7976
}
8077
}
81-
return result;
78+
return null;
8279
}
8380

8481
/**

0 commit comments

Comments
 (0)