1515 * See the License for the specific language governing permissions and
1616 * limitations under the License.
1717 */
18+
1819package org .apache .omid ;
1920
21+ import org .slf4j .Logger ;
22+ import org .slf4j .LoggerFactory ;
23+
2024import java .net .DatagramSocket ;
2125import java .net .InetAddress ;
2226import java .net .NetworkInterface ;
2327import java .net .SocketException ;
2428import java .util .Collections ;
2529import java .util .Enumeration ;
2630
27- import org .slf4j .Logger ;
28- import org .slf4j .LoggerFactory ;
29-
3031public class NetworkUtils {
3132
3233 private static final Logger LOG = LoggerFactory .getLogger (NetworkUtils .class );
@@ -36,7 +37,7 @@ public class NetworkUtils {
3637
3738 public static String getDefaultNetworkInterface () {
3839
39- try (DatagramSocket s = new DatagramSocket ()) {
40+ try (DatagramSocket s = new DatagramSocket ()) {
4041 s .connect (InetAddress .getByAddress (new byte []{1 ,1 ,1 ,1 }), 0 );
4142 return NetworkInterface .getByInetAddress (s .getLocalAddress ()).getName ();
4243 } catch (Exception e ) {
@@ -51,13 +52,14 @@ public static String getDefaultNetworkInterface() {
5152 NetworkInterface nextElement = networkInterfaces .nextElement ();
5253 String name = nextElement .getDisplayName ();
5354 LOG .info ("Iterating over network interfaces, found '{}'" , name );
54- boolean hasInet = Collections .list (nextElement .getInetAddresses ()).size () > 1 ; // Checking that inet exists, to avoid taking iBridge
55+ // Checking that inet exists, to avoid taking iBridge
56+ boolean hasInet = Collections .list (nextElement .getInetAddresses ()).size () > 1 ;
5557 if (hasInet && fallBackName == null ) {
5658 fallBackName = name ;
5759 }
58- if ((name .startsWith (MAC_TSO_NET_IFACE_PREFIX ) && hasInet ) ||
59- name .startsWith (LINUX_TSO_NET_IFACE_PREFIX )) {
60- return name ;
60+ if ((name .startsWith (MAC_TSO_NET_IFACE_PREFIX ) && hasInet )
61+ || name .startsWith (LINUX_TSO_NET_IFACE_PREFIX )) {
62+ return name ;
6163 }
6264 }
6365 if (fallBackName != null ) {
0 commit comments