You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Martin Styk (JIRA)" <ji...@apache.org> on 2016/08/31 11:34:20 UTC

[jira] [Created] (ARTEMIS-709) Possible NPE on UUIDGenerator.getAllNetworkInterfaces()

Martin Styk created ARTEMIS-709:
-----------------------------------

             Summary: Possible NPE on UUIDGenerator.getAllNetworkInterfaces()
                 Key: ARTEMIS-709
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-709
             Project: ActiveMQ Artemis
          Issue Type: Bug
    Affects Versions: 1.4.0
            Reporter: Martin Styk
            Priority: Minor


There is possibility of NPE on class {{UUIDGenerator}} in method {{getAllNetworkInterfaces()}}. 
{code:java}
   private static List<NetworkInterface> getAllNetworkInterfaces() {
      Enumeration<NetworkInterface> networkInterfaces;
      try {
         networkInterfaces = NetworkInterface.getNetworkInterfaces();

         List<NetworkInterface> ifaces = new ArrayList<>();
         while (networkInterfaces.hasMoreElements()) {
            ifaces.add(networkInterfaces.nextElement());
         }
         return ifaces;
      }
      catch (SocketException e) {
         return Collections.emptyList();
      }
   }
{code}

In case there are none network interfaces found on machine, method {{NetworkInterface.getNetworkInterfaces()}} returns {{null}} which can cause NPE in while cycle condition.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)