ralf0131 commented on a change in pull request #2079: [Dubbo-2064] Ipv6 support
URL: https://github.com/apache/incubator-dubbo/pull/2079#discussion_r207085170
 
 

 ##########
 File path: 
dubbo-common/src/main/java/org/apache/dubbo/common/utils/NetUtils.java
 ##########
 @@ -194,26 +194,22 @@ private static InetAddress getLocalAddress0() {
         }
         try {
             Enumeration<NetworkInterface> interfaces = 
NetworkInterface.getNetworkInterfaces();
-            if (interfaces != null) {
-                while (interfaces.hasMoreElements()) {
-                    try {
-                        NetworkInterface network = interfaces.nextElement();
-                        Enumeration<InetAddress> addresses = 
network.getInetAddresses();
-                        if (addresses != null) {
-                            while (addresses.hasMoreElements()) {
-                                try {
-                                    InetAddress address = 
addresses.nextElement();
-                                    if (isValidAddress(address)) {
-                                        return address;
-                                    }
-                                } catch (Throwable e) {
-                                    logger.warn(e);
-                                }
+            while (interfaces.hasMoreElements()) {
+                try {
+                    NetworkInterface network = interfaces.nextElement();
+                    Enumeration<InetAddress> addresses = 
network.getInetAddresses();
+                    while (addresses.hasMoreElements()) {
+                        try {
+                            InetAddress address = addresses.nextElement();
+                            if (isValidAddress(address)) {
+                                return address;
                             }
+                        } catch (Throwable e) {
+                            logger.warn(e);
                         }
-                    } catch (Throwable e) {
-                        logger.warn(e);
                     }
+                } catch (Throwable e) {
 
 Review comment:
   Hi, this is just coding style. I prefer to use 
   
   ```java
   catch (Throwable e) {
      // ignore
   }
   ```
   
   instead of 
   
   ```java
   catch(Throwable ignored) {
   
   }
   ```
   
   I found several codes in Dubbo's code that is written in the former way, but 
did not find my codes that is written in the way you suggested.
   
   So I guess I am going to leave it unchanged.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to