hello guys, i have several problem with exception such as IOException , NullPointerException,and ArrayIndexOutOfBoundsException.
i do BLUETOOTH PUBLIC AND PRIVATE CHATROOM. so, while im running the emulator in netbeans, the problem with exception appear in output pane:
i already choose PUBLIC chat and do chatting without any problem, let say i go back and try to join PRIVATE chat.key in username and password without problem.that means im no more in PUBLIC chat. at the same time, i try to send message in PRIVATE chat to other emulators.and it all started to lagging..where it shows SENDING...i checked the error, and it shows error about Exception.

1) deviceDiscovered(): java.lang.NullPointerException

public void deviceDiscovered(RemoteDevice remoteDevice, DeviceClass cod) {
    try {
      // Start service to searching other device 
      LocalDevice bt = LocalDevice.getLocalDevice();
      DiscoveryAgent da = bt.getDiscoveryAgent();

      UUID[] uuidSet = { BTService.BLUETOOTHCHAT_UUID };

      mCarianServicePending++;
      da.searchServices(
          null,
          uuidSet,
          remoteDevice,
          this);
    }
    catch (IOException ioe) {
      BTLog.log("deviceDiscovered(): " + ioe);
    }
    catch (Throwable t) {
      BTLog.log("deviceDiscovered(): " + t);
    }
  }

2) BluetoothChatMIDlet.run(): java.io.IOException: JSR082 support is not available.

public void run() {
    Vector urls = new Vector();

    synchronized(mBTFinder){
      int n = mDestinasi.size();
      boolean[] flags = new boolean[n];
      mDestinasi.getSelectedFlags(flags);
      for (int i = 0; i < n; i++) {
        if (flags[i] == true) {
          String url = mBTFinder.getURL(i);
          urls.addElement(url);
        }
      }
    }

    for (int i = 0; i < urls.size(); i++) {
        
      String url = (String)urls.elementAt(i);
      
      try { 
          runURL(url); 
      }
      catch (IOException ioe) {
          
        BTLog.log("BluetoothChatMIDlet.run(): " + ioe);
      }
    }
    Display.getDisplay(this).setCurrent(mSendForm);
    }

3)BTServer.run(): java.io.IOException: JSR082 support is not available. Uncaught exception java/lang/ArrayIndexOutOfBoundsException: 0 >= 0.

public void run() {
    
    try {
      LocalDevice bt = LocalDevice.getLocalDevice();
      bt.setDiscoverable(DiscoveryAgent.GIAC);
    }
    catch (BluetoothStateException bse) {

      BTLog.log("BTServer.run(): " + bse);
    }

    try {
      UUID uuid = BTService.BLUETOOTHCHAT_UUID;

      String cs = "btspp://localhost:" + uuid.toString() + ";name=BluetoothChat";
      mNotifier = (StreamConnectionNotifier)Connector.open(cs);

      while (mTrucking) {
        
        StreamConnection sc = mNotifier.acceptAndOpen();

        DataInputStream dataIn = new DataInputStream(sc.openInputStream());
        String from = dataIn.readUTF();
        String message = dataIn.readUTF();
        mBluetoothChatMIDlet.messageReceived(from, message);
        dataIn.close();
        sc.close();
      }
    }
    catch (BluetoothStateException bse) {
      BTLog.log("BTServer.run(): " + bse);
    }
    catch (IOException ioe) {
      if (mTrucking == true)
        BTLog.log("BTServer.run(): " + ioe);
    }
  }

it seem that every exception relate to BTLog.log func call.
BTLog.java class snippet:

public static void log(String s) {
    if (sLines == null) sLines = new Vector();

        try {
          LocalDevice bt = LocalDevice.getLocalDevice();
          String address = bt.getBluetoothAddress();
          s = address + ": " + s;
            }

        catch (BluetoothStateException bse){}

    sLines.addElement(s);
    logToForm(s);
    System.out.println(s);
  }

i hope someone could tell me whats the problem here.
thanks in advance

Sorry, at this point without look on whole code I cannot help...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.