Results 1 to 2 of 2

Thread: j2me exception

  1. #1
    manojp476 is offline Member
    Join Date
    Apr 2010
    Posts
    4
    Rep Power
    0

    Default j2me exception

    on client side:

    private static final UUID uuid =new UUID("A55665EE9F9146109085C2055C888B39", false);

    int[] attributes = {0x0001,0x0003,0x0008,0x000C,0x0100,0x000F,0x1101, 0x1000,0x1001,0x1002,0x1115,0x1116,0x1117};
    UUID[] uuids = new UUID[1];
    //uuids[0] = new UUID(0x0003);
    uuids[0] = uuid;

    try
    {
    agent_client.searchServices(null,uuids,RemoteDevic e_array[m],this);
    }
    catch (Exception e)
    {
    System.out.println("exception generated before searching for service");
    // Error handling code here
    }




    on server side:
    private static final UUID uuid =new UUID("A55665EE9F9146109085C2055C888B39", false);
    StringBuffer url = new StringBuffer("btspp://");
    url.append("localhost").append(':');
    url.append(uuid.toString());
    //url.append(";name=Picture Server");
    //url.append(";authorize=false");

    try {
    server = (StreamConnectionNotifier)Connector.open(url.toStr ing());
    record = Device.getRecord(server);
    DataElement base = new DataElement(DataElement.DATSEQ);
    record.setAttributeValue(IMAGES_NAMES_ATTRIBUTE_ID , base);

    }
    catch (IOException e1)
    {
    System.out.println("problem while assigning connection string");
    // Error handling code here
    }





    when I search for service then I m getting a null pointer exception.
    assuming that all variables are declared & initialized properly then what can be the problem in the code?

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    952
    Rep Power
    10

    Default

    Please use CODE tags when posting code.
    Quote Originally Posted by manojp476 View Post
    on client side:
    Java Code:
            private static final UUID uuid = new UUID("A55665EE9F9146109085C2055C888B39", false);
    
            int[] attributes = {0x0001, 0x0003, 0x0008, 0x000C, 0x0100, 0x000F, 0x1101, 0x1000, 0x1001, 0x1002, 0x1115, 0x1116, 0x1117};
            UUID[] uuids = new UUID[1];
            // uuids[0] = new UUID(0x0003);
            uuids[0] = uuid;
    
            try
            {
                    agent_client.searchServices(null, uuids, RemoteDevice_array[m], this);
            }
            catch (Exception e)
            {
                    System.out.println("exception generated before searching for service");
                    // Error handling code here
            }
    on server side:
    Java Code:
            private static final UUID uuid = new UUID("A55665EE9F9146109085C2055C888B39", false);
            StringBuffer url = new StringBuffer("btspp://");
            url.append("localhost").append(':');
            url.append(uuid.toString());
            // url.append(";name=Picture Server");
            // url.append(";authorize=false");
    
            try {
                    server = (StreamConnectionNotifier)Connector.open(url.toString());
                    record = Device.getRecord(server);
                    DataElement base = new DataElement(DataElement.DATSEQ);
                    record.setAttributeValue(IMAGES_NAMES_ATTRIBUTE_ID, base);
            }
            catch (IOException e1)
            {
                    System.out.println("problem while assigning connection string");
                    // Error handling code here
            }
    when I search for service then I m getting a null pointer exception.
    assuming that all variables are declared & initialized properly then what can be the problem in the code?
    Seems to me there's not enough to go on here. When you say "when I search for service" I presume you mean this call:
    Java Code:
                    agent_client.searchServices(null, uuids, RemoteDevice_array[m], this);
    But I don't know where that method is declared, what it does, what the parameters are supposed to be, what is in RemoteDevice_array... You'll need to give us a few more hints.

    -Gary-

Similar Threads

  1. Replies: 4
    Last Post: 10-25-2010, 07:42 PM
  2. Replies: 0
    Last Post: 04-22-2009, 01:30 PM
  3. J2me
    By Renjini in forum CLDC and MIDP
    Replies: 1
    Last Post: 08-14-2008, 10:58 AM
  4. Replies: 1
    Last Post: 03-08-2008, 06:41 PM
  5. J2me
    By kuttyniti@gmail.com in forum Sun Java Wireless Toolkit
    Replies: 0
    Last Post: 11-24-2007, 06:27 AM

Posting Permissions

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