This is an automated email from the ASF dual-hosted git repository.

matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new b373978  LocalAddressUtils#getMostLikelyLocalInetAddresses fails if 
list contains loopback
     new 993c2c2  Merge pull request #1842 from 
matthiasblaesing/remove_loopback_arrays
b373978 is described below

commit b3739788c757c898f076e776aa320256c6bef21e
Author: Matthias Bläsing <[email protected]>
AuthorDate: Sat Jan 4 16:38:09 2020 +0100

    LocalAddressUtils#getMostLikelyLocalInetAddresses fails if list contains 
loopback
    
    The problem is located in IpAddressUtils#removeLoopback. The method
    expects, that the supplied list provides an Iterator, that supports
    remove.
    
    The list returned by Arrays#asList does not provide that, it is just a
    view on the array.
---
 .../src/org/netbeans/core/network/utils/LocalAddressUtils.java        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/platform/core.network/src/org/netbeans/core/network/utils/LocalAddressUtils.java
 
b/platform/core.network/src/org/netbeans/core/network/utils/LocalAddressUtils.java
index 92b739e..73a24cf 100644
--- 
a/platform/core.network/src/org/netbeans/core/network/utils/LocalAddressUtils.java
+++ 
b/platform/core.network/src/org/netbeans/core/network/utils/LocalAddressUtils.java
@@ -436,10 +436,10 @@ public class LocalAddressUtils {
         IpAddressUtils.removeLoopback(filteredList);
         
         try {
-            List<InetAddress> localHostAddresses = 
Arrays.asList(getLocalHostAddresses(ipTypePref));
+            List<InetAddress> localHostAddresses = new 
ArrayList<>(Arrays.asList(getLocalHostAddresses(ipTypePref)));
             IpAddressUtils.removeLoopback(localHostAddresses);
             
-            if (localHostAddresses != null && !localHostAddresses.isEmpty()) {
+            if (!localHostAddresses.isEmpty()) {
                 List<InetAddress> tmpList = new ArrayList<>(5);
                 for (InetAddress addr : filteredList) {
                     if (localHostAddresses.contains(addr)) {


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

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to