×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    6

    OBEX problem! IllegalStateException:add Notify when already added

    Hi guys,
    I'm working to a Java application that should send a file using OBEX and without need of a server application running on the other device. So I have implemented successfully device and service discovery (with the uuid 0x1105 for ObjectPush) but I have a great problem in the next section of the application: I have created connection but I've got an error on Operation.dataOutputStream() method...

    Code:
        private void pushImage(String serviceURL){
            
            HeaderSet hs = null;
            ClientSession cs = null;
            
            try {
                
                /* Start OBEX connection*/
                cs = (ClientSession) Connector.open(serviceURL);
                hs = cs.connect( hs );
                hs.getResponseCode();
                hs = cs.createHeaderSet();
                
            } catch (Exception e){
                
                append(checkNo);
                append( new StringItem( "ERROR! ", "Error creating OBEX connection!", StringItem.PLAIN  ) );
                
            }
            
            ...
            
            try {
                
                hs.setHeader( HeaderSet.LENGTH, new Long((long)(file.length)) );
                
                Operation op = cs.put(hs);
                
                // Debug message...
                append( new StringItem( "SUCCESS! ", "Start creation of DataOutputStream!", StringItem.PLAIN  ) );
                
                DataOutputStream out = op.openDataOutputStream();
                
                // Debug message...
                append(checkOk);
                append( new StringItem( "SUCCESS! ", "Starting transferring!" + file.length, StringItem.PLAIN  ) );
                
                out.write( file, 0, file.length );
                
                out.close();
                op.close();
                cs.disconnect(null);
                cs.close();
                
            } catch (Exception e){
                
                append(checkNo);
                append( new StringItem( "ERROR! ", "Sending file error: " + e.getClass() + e.getMessage(), StringItem.PLAIN  ) );
                
            }
            
            // Debug message...
            append(checkOk);
            append( new StringItem( "SUCCESS! ", "File successfully sended!", StringItem.PLAIN  ) );
            
        }

    Anyone can help me? Thanks in advance.


    P.S. I'm testing application with a Nokia N73
    Last edited by backspace; 2007-07-26 at 17:31.

  2. #2
    Registered User
    Join Date
    Jun 2007
    Posts
    6

    Re: OBEX problem! IllegalStateException:add Notify when already added

    yeeeeeeeess! problem solved! I have removed append methods and now application works perfectly. I can send files to my laptop with no problems...

Similar Threads

  1. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12:36
  2. What is the real problem to receive data calls with Nokia TDMA cel modems?
    By jackal_jr in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2002-12-09, 09:02
  3. What is the real problem to receive data calls with Nokia TDMA cell modem?
    By jackal_jr in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2002-12-04, 16:05
  4. Replies: 0
    Last Post: 2002-12-04, 15:46
  5. PJava runtime problem within Nokia 9210, Hrlp~!
    By Nokia_Archive in forum PersonalJava
    Replies: 1
    Last Post: 2002-05-28, 13:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×