private static long getIPAddress ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getIPAddress" ) ; int lower32Bits = 0 ; try { final byte [ ] address = AccessController . doPrivileged ( new PrivilegedExceptionAction < byte [ ] > ( ) { @ Override public byte [ ] run ( ) throws UnknownHostException { return java . net . InetAddress . getLocalHost ( ) . getAddress ( ) ; } } ) ; lower32Bits = ( ( address [ 0 ] & 0xFF ) << 24 ) | ( ( address [ 1 ] & 0xFF ) << 16 ) | ( ( address [ 2 ] & 0xFF ) << 8 ) | ( ( address [ 3 ] & 0xFF ) << 0 ) ; } catch ( PrivilegedActionException paex ) { com . ibm . ws . ffdc . FFDCFilter . processException ( paex . getCause ( ) , "com.ibm.ws.util.UUID.getIPAddress" , "794" ) ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Exception caught getting host address." , paex . getCause ( ) ) ; // Try random number instead! lower32Bits = new java . util . Random ( ) . nextInt ( ) ; } catch ( Exception e ) // Host address unavailable { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ws.util.UUID.getIPAddress" , "661" ) ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Exception caught getting host address." , e ) ; // Try random number instead! lower32Bits = new java . util . Random ( ) . nextInt ( ) ; } final long ipAddress = lower32Bits & 0x00000000FFFFFFFF L ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getIPAddress" , Long . valueOf ( ipAddress ) ) ; return ipAddress ; }
return value when the IP address is 9 . 20 . 217 . 12