[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: UUIDGenerator broken on Windows...

clebert.suconic@jboss.com do-not-reply at jboss.com
Tue Feb 3 15:52:05 EST 2009


Actually, I made the test to pass, by changing the method as this:

   public final static byte[] getHardwareAddress()
  |    {
  |       Method getHardwareAddressMethod;
  |       try
  |       {
  |          getHardwareAddressMethod = NetworkInterface.class.getMethod("getHardwareAddress", null);
  |       }
  |       catch (Throwable t)
  |       {
  |          // not on Java 6 or not enough security permission
  |          return null;
  |       }
  | 
  |       try
  |       {
  |          Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
  |          while (networkInterfaces.hasMoreElements())
  |          {
  |             NetworkInterface networkInterface = (NetworkInterface)networkInterfaces.nextElement();
  |             Object res = getHardwareAddressMethod.invoke(networkInterface, null);
  |             if (res instanceof byte[])
  |             {
  |                byte[] address = (byte[])res;
  |                if (address.length == 16)
  |                {
  |                   if (log.isDebugEnabled())
  |                   {
  |                      log.debug("using hardware address " + asString(address));
  |                   }
  |                   return address;
  |                }
  |             }
  |          }
  |       }
  |       catch (Throwable t)
  |       {
  |       }
  | 
  |       return null;
  |    }
  | 

But this is aways returning null on windows.

But I still have an OME on timing.UUIDTest, but it is not caused by an infinite loop as I though. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206726#4206726

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206726



More information about the jboss-dev-forums mailing list