×

Discussion Board

Results 1 to 7 of 7

Thread: Error 4158

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    25

    Error 4158

    I have J2ME application which plays on-line Internet radios - mWebPlayer. While starting it loads the playlist file from my web site using regular HTTPConnection. This code works fine on many phones but on Nokia N95 it throws error with code 4158?

    Any idea what is wrong?

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Error 4158

    What does the application do when the error is displayed (what line causes the issue)? Does the phone have cellular/network access? does it show the access point selection dialog or the confirmation dialog asking for permission to use network connection?

    Hartti

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    25

    Re: Error 4158

    Quote Originally Posted by hartti View Post
    What does the application do when the error is displayed (what line causes the issue)? Does the phone have cellular/network access? does it show the access point selection dialog or the confirmation dialog asking for permission to use network connection?

    Hartti
    I don't know exact line of code since it happened on user's phone. I don't have access to this phone, only log file and some feedback from user. Below is code of the method where the problem occurs. Confirmation dialog for permission was shown.

    private String getPage(String locator) throws Exception {
    HttpConnection connection = null;
    DataInputStream is = null;
    //InputStream is = null;
    String res = null;
    Log.write("Getting page " + locator);

    try {
    connection = (HttpConnection)Connector.open(locator);
    connection.setRequestMethod(HttpConnection.GET);
    connection.setRequestProperty("User-Agent", "mWebPlayer");
    connection.setRequestProperty("Connection", "close");
    connection.setRequestProperty("Content-Language", "en-US");

    StringBuffer response = new StringBuffer();
    code = connection.getResponseCode();
    Log.write("code: " + code);
    is = connection.openDataInputStream();
    if (code != HttpConnection.HTTP_OK)
    throw new IOException(Lang.ERR_NetBadCode + code);
    long length = connection.getLength();
    int ch = 0;
    if (length != -1) {
    for(int i =0 ; i < length ; i++ )
    if((ch = is.read()) != -1) {
    response.append((char) ch);
    }
    } else {
    //int ch = 0;
    while (!stopFlag && (ch != -1)) {
    ch = is.read();
    response.append((char)ch);
    }
    }
    return response.toString();

    } finally {
    if (is != null)
    is.close();
    if (connection != null)
    connection.close();
    }
    }

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Error 4158

    Was the access point dialog shown as well? Or has the user defined a default access point for the MIDlet? is that connection available?

    Hartti

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    25

    Re: Error 4158

    Quote Originally Posted by hartti View Post
    Was the access point dialog shown as well?
    No.

    Quote Originally Posted by hartti View Post
    Or has the user defined a default access point for the MIDlet?
    No.

    Quote Originally Posted by hartti View Post
    is that connection available?
    Yes.

  6. #6
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Error 4158

    Whooa. Your answer does not make sense at all. (I think the problem was in my questions though :-)

    So the access point dialog was not shown and there was no default access point defined for the MIDlet... so what connection (I should have said access point) the MIDlet was trying to use to connect and how do you know that this connection exists and works?

    Hartti

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    25

    Re: Error 4158

    Yeah, seems we did not understand each other

    I meant there was no access point dialog and midlet used default system access point. Since this user loaded my app from Internet I believe his Internet connection worked properly. Also I am pretty sure that on-line file that the app tried to download using the code above exists.

    As I wrote unfortunately I don't have Nokia 95 myself to test it but I have Nokia 75 and it works properly on it. Perhaps something is really wrong with settings in that phone.

Posting Permissions

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