Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException from SMSParser. Voice.getSMSThreads... #33

Open
GoogleCodeExporter opened this issue Apr 11, 2015 · 4 comments
Open

Comments

@GoogleCodeExporter
Copy link

My App Engine app retrieves SMS messages from Google Voice using this
API. It worked before, but  started crashed from today. I am not sure
if I made any changes. The crash caused when my app tries to call
"voice.getSMStreads()". It triggers the following exception:

Caused by: java.lang.NullPointerException
       at
com.techventus.server.voice.util.SMSParser.parseContact(SMSParser.java:
125)
       at
com.techventus.server.voice.util.SMSParser.getSMSThreads(SMSParser.java:
106)
       at com.techventus.server.voice.Voice.getSMSThreads(Voice.java:688)

Could anyone please provide any insight about how to solve this
problem? Thank you very much!

Original issue reported on code.google.com by malone.j...@gmail.com on 19 Mar 2012 at 8:48

@GoogleCodeExporter
Copy link
Author

The voice.getSMSTreads() still produces the same error as I mentioned in the 
Google Group. Instead, I read SMS directly from the JSON response. And it works 
now, but I can read only the latest SMS in each tread. Here is the code I wrote:

//After Voice setup
String unReadSMSXML = voice.getUnreadSMS();
jsonString = parseXML(unReadSMSXML);
JSONObject json = new JSONObject(jsonString);
JSONObject smsObjects = json.getJSONObject("messages");
if(smsObjects.length() != 0){

     Date now = ServerTimeManipulator.getCurrentTime();
     ArrayList<String> keys = getKeys(jsonString); //the code I wrote that gets only key for each SMS
     readMessages = keys.size();

     for(int i=0; i< keys.size(); i++){
          String currentKey = keys.get(i);
          JSONObject oneMessageJsonObject = (JSONObject) smsObjects.get(currentKey);
          boolean read = (Boolean) oneMessageJsonObject.get("isRead");
          if(!read){
               String phoneNumber = (String) oneMessageJsonObject.get("phoneNumber");
               String messageText = (String) oneMessageJsonObject.get("messageText");
               //Process message
          }
     }
}

Original comment by malone.j...@gmail.com on 20 Mar 2012 at 3:23

@GoogleCodeExporter
Copy link
Author

RI believe Google made a temporary breaking change that has now been fixed.  I 
want to close off this issue if possible.

Original comment by malone.j...@gmail.com on 25 Mar 2012 at 2:04

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

I get basically this same error. I posted a separate issue report for it.

Original comment by cs3vi...@gmail.com on 8 Nov 2013 at 2:33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant