BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-11-2007, 02:23 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Synchronization Problem?

Please Login to Remove!

Hi, I make a SocketConnection to connect to a server to make an OTA synchronization. I did that to 8100 and when i go to the Options/Network an put the Data Services to OFF and I cannot establish the socket connection. I tried to catch the exception to display a message to the Screen. But it does not display itself. What is the problem. Here is my code:

Code:
public void run() {
    try{
      connect();
      InputStream in = socket.openInputStream();
      OutputStream out = socket.openOutputStream();
      List rdfs = init(in, out, dataBase);
      dataBase = sync(in, out, rdfs, dataBase);
      socket.close();     
    } catch (IllegalArgumentException e) {
      Dialog.alert("1");
    } catch (ConnectionNotFoundException e) {
      Dialog.alert("2");
    } catch (ControlledAccessException e) {
      Dialog.alert("The connection can not be set!");
    } catch (IOException e) {
      Dialog.alert("The connection can not be found!");
    } catch(Exception e) {
    }
    synchronized(monitor) {
      isRunning = false;
    }
  }

  private void connect() throws IOException, ControlledAccessException {
    socket = (SocketConnection) Connector.open(link);
    socket.setSocketOption(SocketConnection.KEEPALIVE, 0);
    socket.setSocketOption(SocketConnection.LINGER, timeout);
  }
Offline  
Old 09-12-2007, 02:43 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found out where is the problem. When the Data Services is off, the synchronization can not be made and the Connector.open() throws an exception (IOException). It is caught but when a new thread (not the main thread) is started, Dialog.alert() can not show the dialog box on the screen so I could not understand why the exception is not caught. That was the problem . Thank you for the attention!
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.