SachinPuthran / bluecove

Automatically exported from code.google.com/p/bluecove
0 stars 0 forks source link

Possible bug in UUID expansion #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The story so far:

at 2006-05-24 13:09 kimmov@users.sourceforge.net wrote:
> There may be a bug in BlueCove 1.1.1 UUID promotion, i.e., short UUID is 
> not expanded to long UUID as it should.
> 
> We are not however sure if this is BlueCove or Windows XP SP2 stack's
> bug. If that is the case (Windows XP bug) can you add a note about it to 
> this item?
>
> The comment in the following code explains the situation.
>
> DiscoveryAgent discv = LocalDevice.getLocalDevice().getDiscoveryAgent(); 
> // if connecting to BlueCove and Windows machine it's recommended to use
> // UUID("1101", true) rather than UUID(0x1101) which seems not towork.
> UUID uuids[] = new UUID[] { new UUID("1101", true) };
> discv.searchServices(null, uuids, remoteDevice, this);

This sounds very implausible, because the UUID(long)-constructor calls the
UUIS(String)-constructor. But the UUID(String)-constructor seems very
weird. Look at this:

public UUID(String stringValue, boolean shortUUID) {
 int length = stringValue.length();
 if (shortUUID) {
  if (length < 1 || length > 8)
   throw new IllegalArgumentException();
  // How does this look to you?
  init("00000000".substring(length) + stringValue +
   "00001000800000805F9B34FB");
 } else {
  if (length < 1 || length > 32)
   throw new IllegalArgumentException();

init("00000000000000000000000000000000".substring(length)
   + stringValue);
 }
}

Original issue reported on code.google.com by paul.tot...@gmail.com on 19 Aug 2006 at 1:06

GoogleCodeExporter commented 9 years ago
As of version BlueCove 2.0.1 we are running JSR-82 TCK. There are no errors 
reported
in the tests related to UUID constructors.

Original comment by skarzhev...@gmail.com on 14 Jul 2007 at 5:49