[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
Wed Feb 4 13:50:21 EST 2009


If anyone out there with windows out there, wants to help us verifying this:

:-)

You just need to download trunk on SVN, build it and run org.jboss.messaging.tests.unit.util.UUIDTest through Eclipse

But before that add a System.out on UUIDGenerator::getHardwareAddress


  |    public final static byte[] getHardwareAddress()
  |    {
  |       Method getHardwareAddressMethod;
  |       try
  |       {
  |          getHardwareAddressMethod = NetworkInterface.class.getMethod("getHardwareAddress");
  |       }
  |       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);
  |             if (res != null && res instanceof byte[])
  |             {
  |                byte[] address = (byte[])res;
  |                byte[] paddedAddress = getZeroPaddedSixBytes(address);
  |                if (paddedAddress != null)
  |                {
  |                   System.out.println(networkInterface.getDisplayName() + "  " + asString(paddedAddress));
  |                   if (log.isDebugEnabled())
  |                   {
  |                      log.debug("using hardware address " + asString(paddedAddress));
  |                   }
  |                   return paddedAddress;                  
  |                }
  |             }
  |          }
  |       }
  |       catch (Throwable t)
  |       {
  |       }
  | 
  |       return null;
  |    }
  | 

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

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



More information about the jboss-dev-forums mailing list