@Override public byte[] call() throws Exception { boolean up = networkInterface.isUp(); boolean loopback = networkInterface.isLoopback(); boolean virtual = networkInterface.isVirtual(); if (loopback || virtual || !up) { throw new Exception("not suitable interface"); } byte[] address = networkInterface.getHardwareAddress(); if (address != null) { byte[] paddedAddress = UUIDGenerator.getZeroPaddedSixBytes(address); if (UUIDGenerator.isBlackList(address)) { throw new Exception("black listed address"); } if (paddedAddress != null) { return paddedAddress; } } throw new Exception("invalid network interface"); } });
@Override public byte[] call() throws Exception { boolean up = networkInterface.isUp(); boolean loopback = networkInterface.isLoopback(); boolean virtual = networkInterface.isVirtual(); if (loopback || virtual || !up) { throw new Exception("not suitable interface"); } byte[] address = networkInterface.getHardwareAddress(); if (address != null) { byte[] paddedAddress = UUIDGenerator.getZeroPaddedSixBytes(address); if (UUIDGenerator.isBlackList(address)) { throw new Exception("black listed address"); } if (paddedAddress != null) { return paddedAddress; } } throw new Exception("invalid network interface"); } });
@Override public byte[] call() throws Exception { boolean up = networkInterface.isUp(); boolean loopback = networkInterface.isLoopback(); boolean virtual = networkInterface.isVirtual(); if (loopback || virtual || !up) { throw new Exception("not suitable interface"); } byte[] address = networkInterface.getHardwareAddress(); if (address != null) { byte[] paddedAddress = UUIDGenerator.getZeroPaddedSixBytes(address); if (UUIDGenerator.isBlackList(address)) { throw new Exception("black listed address"); } if (paddedAddress != null) { return paddedAddress; } } throw new Exception("invalid network interface"); } });
@Override public byte[] call() throws Exception { boolean up = networkInterface.isUp(); boolean loopback = networkInterface.isLoopback(); boolean virtual = networkInterface.isVirtual(); if (loopback || virtual || !up) { throw new Exception("not suitable interface"); } byte[] address = networkInterface.getHardwareAddress(); if (address != null) { byte[] paddedAddress = UUIDGenerator.getZeroPaddedSixBytes(address); if (UUIDGenerator.isBlackList(address)) { throw new Exception("black listed address"); } if (paddedAddress != null) { return paddedAddress; } } throw new Exception("invalid network interface"); } });
@Override public byte[] call() throws Exception { boolean up = networkInterface.isUp(); boolean loopback = networkInterface.isLoopback(); boolean virtual = networkInterface.isVirtual(); if (loopback || virtual || !up) { throw new Exception("not suitable interface"); } byte[] address = networkInterface.getHardwareAddress(); if (address != null) { byte[] paddedAddress = UUIDGenerator.getZeroPaddedSixBytes(address); if (UUIDGenerator.isBlackList(address)) { throw new Exception("black listed address"); } if (paddedAddress != null) { return paddedAddress; } } throw new Exception("invalid network interface"); } });
@Override public byte[] call() throws Exception { boolean up = networkInterface.isUp(); boolean loopback = networkInterface.isLoopback(); boolean virtual = networkInterface.isVirtual(); if (loopback || virtual || !up) { throw new Exception("not suitable interface"); } byte[] address = networkInterface.getHardwareAddress(); if (address != null) { byte[] paddedAddress = UUIDGenerator.getZeroPaddedSixBytes(address); if (UUIDGenerator.isBlackList(address)) { throw new Exception("black listed address"); } if (paddedAddress != null) { return paddedAddress; } } throw new Exception("invalid network interface"); } });
@Override public byte[] call() throws Exception { boolean up = networkInterface.isUp(); boolean loopback = networkInterface.isLoopback(); boolean virtual = networkInterface.isVirtual(); if (loopback || virtual || !up) { throw new Exception("not suitable interface"); } byte[] address = networkInterface.getHardwareAddress(); if (address != null) { byte[] paddedAddress = UUIDGenerator.getZeroPaddedSixBytes(address); if (UUIDGenerator.isBlackList(address)) { throw new Exception("black listed address"); } if (paddedAddress != null) { return paddedAddress; } } throw new Exception("invalid network interface"); } });
@Test public void testZeroPaddedBytes() throws Exception { Assert.assertNull(UUIDGenerator.getZeroPaddedSixBytes(null)); Assert.assertNull(UUIDGenerator.getZeroPaddedSixBytes(new byte[0])); Assert.assertNull(UUIDGenerator.getZeroPaddedSixBytes(new byte[7])); byte[] fiveBytes = new byte[]{1, 2, 3, 4, 5}; byte[] zeroPaddedFiveBytes = UUIDGenerator.getZeroPaddedSixBytes(fiveBytes); ActiveMQTestBase.assertEqualsByteArrays(new byte[]{1, 2, 3, 4, 5, 0}, zeroPaddedFiveBytes); byte[] fourBytes = new byte[]{1, 2, 3, 4}; byte[] zeroPaddedFourBytes = UUIDGenerator.getZeroPaddedSixBytes(fourBytes); ActiveMQTestBase.assertEqualsByteArrays(new byte[]{1, 2, 3, 4, 0, 0}, zeroPaddedFourBytes); byte[] threeBytes = new byte[]{1, 2, 3}; byte[] zeroPaddedThreeBytes = UUIDGenerator.getZeroPaddedSixBytes(threeBytes); ActiveMQTestBase.assertEqualsByteArrays(new byte[]{1, 2, 3, 0, 0, 0}, zeroPaddedThreeBytes); }