• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getHardwareAddress returning null with JDK 6 Update 22 enabled browser

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using the follwoing code and calling it in an applet. It used to work completely fine when I used with browser with JRE 6 Update 21. However, the code is now returning null for all browsers that support JRE 6 Update 22. Here is the code -

 
Nitin Sinha
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is a specific business requirement for which I need hardwareaddress.
thats why i posted the code.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does it print if you try that code on a command line? I tried it (after removing the remaining call to checkValidMAC), and the only null MAC address was that of my "lo" adapter - which is the loopback adapter, and not really a physical device.
 
Nitin Sinha
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
TRY THIS CODE THEN -

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That code doesn't compile for me because there's no checkValidMAC method declared anywhere.

By the way you appear to be in the habit of cross-posting your questions on the Oracle forum. Please read this: BeForthrightWhenCrossPostingToOtherSites.

 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, if I run that code after changing line 43, I see all my network adapters - lo, two VMware virtual adapters and my actual network adapter (well, the one that isn't disabled - I have two). The MAC address (LAN ID) printed at the bottom is my actual MAC address. So I'll ask you again - what is the output when you run it?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never, never write == false or == true.
Those lines with multiple || checks are too long to read; they ought to have newlines in to break them up.
The multiple || look very inelegant. See if you can create a regular expression to match the multiple possibilities.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic