Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Blackberry error

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Blackberry error

    I was trying to POST a URL to the server but it gives an exception (no NullPointer caught), but the same application works on other mobile perfectly...please, is there any thing I have to do on the application to make it work on the Blackberry?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Blackberry error

    Look at the code and see why there is NullPointerException. Fix that code so that it works on the device.

  3. #3
    Junior Member
    Join Date
    May 2011
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Blackberry error

    this is the method performing the work...its actually giving this kind of error: error 104 No NullPointerException Caught.

    private boolean login = false;
    private String response = null;

    private void login() throws IOException, InterruptedException {

    HttpConnection hc = null;
    InputStream input = null;
    //OutputStream output = null;
    try
    {
    String url = "http://www.mantraa360.com/sefex/payment.php/?vin=" + vinTextField.getString() + "&pin="
    + pinTextField.getString();

    //connect to server
    hc = ( HttpConnection )Connector.open( url );
    hc.setRequestMethod( HttpConnection.GET );

    //Authentication
    if ( hc.getResponseCode() == HttpConnection.HTTP_OK )
    {
    login = true;
    }//end if
    // if ( !login )
    // {
    // getFailureAlert().setString( "Error..File Not Found" );
    // failureAlert.setTimeout(Alert.FOREVER);
    // switchDisplayable( failureAlert, sefexLoginForm );
    // vinTextField.setString("");
    // pinTextField.setString("");
    // System.out.println( "Invalid" );
    // }

    input = hc.openInputStream();
    int length = (int)hc.getLength();
    byte[] data = new byte[ length ];

    if ( input != null )
    {
    input.read( data, 0, length );
    response = new String(data, 0, length);
    System.out.println(response);


    /* if ( response.startsWith( "P" ) )
    {
    getSefexRespStringItem().setText( response );
    }//end inner if(response.startsWith("P"))

    else if ( response.startsWith( "I" ) )
    {
    getSefexRespStringItem().setText( response );
    }//end inner if(response.startsWith("I"))
    :
    else
    sefexRespStringItem.setText( response );
    }//end if(input != null)
    */
    }
    else
    return;

    input.close();
    hc.close();

    if ( response.trim().equals( "0" ) )
    {
    response = "Successfully Credited \n Account No : "+vinTextField.getString();
    System.out.println(response);
    }//end if
    }//end try
    finally
    {
    if ( input != null )
    input.close();
    if ( hc != null )
    hc.close();
    }//end finally

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Blackberry error

    its actually giving this kind of error:
    What is the its you are talking about? I don't recognize the text of the error message

    What variable is null? Why is it null?

    Please wrap your posted code in code tags. See:http://www.java-forums.org/misc.php?do=bbcode#code
    or Go Advanced and use the # icon

  5. #5
    Junior Member
    Join Date
    May 2011
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Blackberry error

    actually, i ran an application on another emulator and a Nokia phone..the application worked perfectly..the application is to POST a url to the server and then get a response....i got my response correctly but when i ran it on the BlackBerry simulator and the mobile itself..it was giving errors....: "App Error 104 Uncaught: NullPointerException Scroll for available commands", that was the error been displayed on the screen..

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Blackberry error

    No ideas on how to debug code on an emulator, simulator or phone.

Similar Threads

  1. Starting BlackBerry development
    By AttilioCarotenuto in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: July 29th, 2011, 12:11 PM
  2. Help stuck with building a Logic Probe for the Blackberry
    By delphijustin in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 5th, 2011, 09:48 AM
  3. Replies: 1
    Last Post: January 27th, 2011, 08:13 AM
  4. BlackBerry
    By Msm in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: July 19th, 2010, 01:33 AM