Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6594645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:50:16+00:00 2026-05-25T17:50:16+00:00

I’m working on an application which communicates with server and receiving a data stream,which

  • 0

I’m working on an application which communicates with server and receiving a data stream,which is like 60-80k symbols.So I am splitin’ that string and calculating the stream into a pieces and when I get the type of the stream I create an instance of class like this :

BasePacket packet=null; // this is the base packet
if(packetType=1)
    startPacket packet = new startPacket(params) // startPacket class extends BasePacket

if(packetType=2)
    endPacket packet = new endPacket(params) // endPacket class extends BasePacket
......

In startPacket I create instance to userPacket which extends BasePacket too:

userPacket user; // in startPacket

I have another class which is RPCCommunicator where I include all the methods which I need to communicate with server.

In RPCCommnicator I have :

userPacket user;
startPacket startP;
.......

And here is my problem…
In RPCCOmmunicator I have a method like this :

    private static Integer localUserIdByServerUserId(int serverUserId, String serverName,Context context){

    try {
        dbHelper = new DataBaseHelper(context, "opa_sys_tpl.sqlite", null, 1);
        dbHelper.checkDatabase("opa_sys_tpl.sqlite");
        dbHelper.copyDataBase("opa_sys_tpl.sqlite");
    } catch (IOException e) {
        e.printStackTrace();
    }
    dbHelper.getDatabase();

    String query = "SELECT id FROM users WHERE objectId = "+serverUserId+" AND serverName = '"+serverName+"' LIMIT 1";
    ArrayList<String> result = new ArrayList<String>();
    cursor = dbHelper.executeSQLQuery(query);
    cursor.moveToFirst();
    while(!cursor.isAfterLast()) {
        result.add(cursor.getString(cursor.getColumnIndex("id")));
         cursor.moveToNext();
    }

    Log.i("result ","Result : "+result.toString());
    Log.i("CURSOR ","Cursor Position : "+cursor.getPosition());
    Integer uuid = Integer.parseInt(result.get(cursor.getColumnIndex("id")));
    Log.w("localUSerByIdServerUserId","LocalUserByIdServerUserId result : "+uuid);
    cursor.close();
    return uuid;
}

and I’m calling it in startPacket like this :

int uuId = rpc.lUserIdByServerUserId(userId,newServerName,context);

And the NullPointerException it throws on that last line and I can’t find how to fix it.I’m using a helper class for my database so I don’t think that the problem is there,but here is a link to my DataBaseHelper.class code : DatabaseHelper.class.

So thanks in advance!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:50:17+00:00Added an answer on May 25, 2026 at 5:50 pm

    If this line

    int uuId = rpc.lUserIdByServerUserId(userId,newServerName,context);
    

    is indeed the line that throws the exception, rpc must be null.

    Use a debugger to step through the program to find out why this is the case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I would like to count the length of a string with PHP. The string
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.