manniru / bluecove

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

When Bluetooth is disabled a RuntimeException is thrown instead of BluetoothStateException #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Disable Bluetooth on a device
2. Run the BlueCove tests
3. A RuntimeException will be thrown saying "BluetoothStack not detected"

What is the expected output? What do you see instead?

   A BluetoothStateException is thrown by other JSR-82 implementations for
this use case.  I know this to be true for Nokia, Motorola, Sony Ericsson,
and the Sun WTK.  Also Avetana's implementation does this.  BlackBerry
phones actually prompt the user to enable Bluetooth in such a situation.
   BlueCove throws a RuntimeException.  This makes it difficult for a
program to catch this exception and warn the user.  After all a
RuntimeException is very generic and can be from other situations too.

What version of the product are you using? On what operating system?

   This happens with BlueCove 2.0.1.

Please provide any additional information below.

   com.intel.bluetooth.BlueCoveImpl line 182 says:

     throw new RuntimeException("BluetoothStack not detected");

   It should say something like:

     throw new BluetoothStateException("Bluetooth stack not detected. 
Bluetooth must be enabled on the device.");

Original issue reported on code.google.com by deanbro...@gmail.com on 2 Sep 2007 at 6:10

GoogleCodeExporter commented 9 years ago
related problem:

> I'm writing to you to signal a little bit surprising behaviour of my version
> of BlueCove (a SNAPSHOT of the beginning of August..) with WIDCOMM drivers
> on Windows XP:
> (that's what i tried, i don't know the behaviour with different operating
> systems... but i found that only with WIDCOMM drivers on XP..):
> when the bluetooth is off, a call to Connector.open with a server connection
> string doesn't throw any exception! The exception is only thrown if you call
> acceptAndOpen or updateRecord on the ConnectionNotifier returned from the
> Connector...
> I'm signaling you this because that's a difference of behaviour with the
> other types of drivers (with XP-sp2 and BlueSoleil the VM can't load the
> implementation class..), and then a programmer would have to consider it
> (and would have to known it!) while handling the exceptions...

> Greetings and smiles,
> Fabrizio. 

Original comment by skarzhev...@gmail.com on 9 Sep 2007 at 5:33

GoogleCodeExporter commented 9 years ago
Made initial refactoring for the use of the reference to used BluetoothStack.
Now BluetoothStateException is thrown when required.

Original comment by skarzhev...@gmail.com on 5 Oct 2007 at 2:18

GoogleCodeExporter commented 9 years ago
fixed initialization exceptions, e.g. BluetoothStateException when device is not
ready or no stack found

Original comment by skarzhev...@gmail.com on 5 Oct 2007 at 3:55