[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VM randomly crashes whilst using bluecove

Posted on 2006-03-23
6
Medium Priority
?
182 Views
Last Modified: 2010-07-27
Ok, I'm using the latest version of bluecove, and java 1.5 (v6). The following code seems to randomly cause the following error. It's very strange, sometimes the code will run for 40 loops with no problems, sometimes it will crash on the first one... it's really starting to bug me, and it sorting out asap...

Anyway

<a href="http://www.pvba13764.pwp.blueyonder.co.uk/hs_err_pid2004.log">Log file of crash</a>

Code:

import javax.bluetooth.LocalDevice;
import javax.bluetooth.*;
import java.util.Vector;
import java.io.*; /**

 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class BTH extends Thread{
  public static void main(String[] args) {
  BTH phas = new BTH();


}


  Vector<RemoteDevice> devices = new Vector();

  private
      LocalDevice BTAdapter;
  DiscoveryAgent BTDA;

  public BTH() {
    try {
      BTAdapter = LocalDevice.getLocalDevice();
      start();
    }
    catch (BluetoothStateException ex) {
      ex.printStackTrace();
    }

  }

  public void run()
  {
          int counter=0;
    while(true)
    {

      Search();
      counter++;
      System.out.println(counter + " Successful Searches");
      try {
        this.currentThread().sleep(60000);
      }
      catch (InterruptedException ex) {
      }
    }
  }
  public void Search() {
    devices.clear();

    System.out.println("Searching for devices...");
    BTDA = BTAdapter.getDiscoveryAgent();
    try {
      BTDA.startInquiry(DiscoveryAgent.GIAC, new Listener());
    }
    catch (BluetoothStateException ex) {
    }

  }




  class Listener
      implements DiscoveryListener {

    public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {

      try {
        System.out.println("Device discovered:" + btDevice.getFriendlyName(false));
        devices.add(btDevice);
      }
      catch (IOException ex) {
      }

    }

    public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
    }

    public void serviceSearchCompleted(int transID, int respCode) {

    }

    public void inquiryCompleted(int discType) {
      System.out.println("\nFound " + devices.size() + " devices");

      for (RemoteDevice aDevice : devices) {
        try {
          System.out.println(aDevice.getBluetoothAddress() + "\t" +
                             aDevice.getFriendlyName(false));
        }
        catch(IOException ex)
        {

        }
      }

    }

  }
}


Any thoughts? What does the error code actually mean? and is there any way that I can simply ignore the error, reboot the affected bit and carry on, in real time?
0
Comment
Question by:PaulVinten
  • 3
5 Comments
 

Author Comment

by:PaulVinten
ID: 16267929
D'oh, it doesn't support html tags. Never mind lol
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16267953
Try another version of bluecove - it's probably an internal error
0
 

Author Comment

by:PaulVinten
ID: 16268071
Tried that, the only other version I could find just crashed it full stop
0
 

Author Comment

by:PaulVinten
ID: 16462122
This turns out to be a semi-known bug with the deviceDiscovered function, it is buggy when used with the friendly name function. I've got conflicting information whether or not it's the bluecove or an inherrant problem with bluetooth itself. The solution is just to use the inquiryCompleted function.
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16485465
PAQed with points refunded (125)

GranMod
Community Support Moderator
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month18 days, 15 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question