×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    [SOLVED] Midlet crashes on N95 while connecting to an Https server

    Hello,
    This is something I only noticed while testing my Midlet on an N95 device. This worked well on many tested Samsung, LG and Sony Ericsson devices. This also worked well on N97 devices.

    A real device simply closed the application, but an emulator displayed a Panic error User 23 (some memory error ...?)

    I discovered, using debug mode with S60 J2ME SDK and netbeans, that this would happen while flushing data to a connection outpustream (see code snippet).
    If i don't call os.flush(), this crash will happen when I call cnx.getResponseCode. This means something is wrong with sending my data.

    Code:
    cnx = (HttpConnection) Connector.open(url, Connector.READ_WRITE);
    cnx.setRequestMethod(method);
    cnx.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0");
    cnx.setRequestProperty("Accept", "application/xml");
    cnx.setRequestProperty("HTTP-Version", "HTTP/1.0");
    if (method.equals(HttpConnection.POST)) {
        cnx.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
        cnx.setRequestProperty("Accept-Charset","UTF-8;q=0.7,*;q=0.7");
    }
    if (cookie!=null) cnx.setRequestProperty("Cookie", cookie);
    
    if (method.equals(HttpConnection.POST)) {
        cnx.setRequestProperty("Content-Length", new Integer(paramsStr.getBytes("UTF-8").length).toString());
        OutputStream os = cnx.openOutputStream() ;
        os.write(paramsStr.getBytes("UTF-8"));
        os.flush() ;
    }
     int codeReponse = cnx.getResponseCode() ;
    Do you have any clue ?

    Thx

    Yannik Soubigou
    Last edited by ysoubigo; 2011-03-15 at 13:07.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Re: Midlet crashes on N95 while connecting to an Https server

    Hi Yannik Soubigou,

    Welcome to Forum Nokia Discussion Board!!

    According to the documentation flush() method is optional . If you call the getResponseCode() It will automatically flushes the data .
    The output stream you are getting inside the if loop and you are not closing it . You have taken that as a local variable . Please declare that at the begining and close all your connections and streams in the finally block . And go through the http j2me documentation.

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Midlet crashes on N95 while receiving an HTTP response witha cookie.

    Hello, and thank you for your answer.

    I do close all connections and streams in a "finaly" block.
    I tested it on different server configurations (secured and non secured HTTP, with and without cookies) and I can now say that the problem is caused by the session cookie.
    The response to my request contains a "Set-Cookie" header with a cookie named "idSess" and its value.

    If the server does not return any cookie, the response does not crash my application, whereas it crashes when cookie is set.

    I know the cookie is quite a long string (but still shorter than 1000 caracters). As "User 23" is a memory error, could it be the reason ?

    Thx

    Yannik Soubigou
    Last edited by ysoubigo; 2011-03-14 at 16:52.

  4. #4
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Re: [SOLVED] Midlet crashes on N95 while connecting to an Https server

    After several tests with serveral cookie sizes I discovered that the crash occures when cookie size is bigger than 900 bytes (almost).
    I looked for a known issue in forum.nokia knowledge base and I found this :
    http://wiki.forum.nokia.com/index.ph...ater_than_1_kB

    The problem is that I cannot change the cookie size.
    The conclusion is that 50 Nokia phones cannot use my application. That's a lot !!

    Yannik Soubigou

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: [SOLVED] Midlet crashes on N95 while connecting to an Https server

    Please, ignore my post, sorry.
    Last edited by traud; 2011-03-21 at 16:16.

Similar Threads

  1. [moved] Why emulator is exit while connecting to server.
    By 182guide in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2010-01-17, 21:37
  2. problem while connecting to the service provider's server
    By beenicravi in forum General Messaging
    Replies: 3
    Last Post: 2007-03-08, 09:41
  3. Hiding access-point selection dialog while connecting to FTP server
    By SymbianSandy in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2006-11-17, 06:11
  4. Hiding access-point selection dialog while connecting to FTP server
    By SymbianSandy in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-11-17, 06:11
  5. Hiding access-point selection dialog while connecting to FTP server
    By SymbianSandy in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-11-17, 06:07

Posting Permissions

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