voice.getSMSTreads() Error

108 views
Skip to first unread message

Biomiblab mHealth

unread,
Mar 19, 2012, 4:17:20 PM3/19/12
to Google Voice Java
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!

Joseph Malone

unread,
Mar 19, 2012, 4:49:30 PM3/19/12
to google-v...@googlegroups.com
http://code.google.com/p/google-voice-java/issues/detail?id=33&thanks=33&ts=1332190134

Created Issue


--
You received this message because you are subscribed to the Google Groups "Google Voice Java" group.
To post to this group, send email to google-v...@googlegroups.com.
To unsubscribe from this group, send email to google-voice-j...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-voice-java?hl=en.


Biomiblab mHealth

unread,
Mar 20, 2012, 11:32:21 AM3/20/12
to Google Voice Java
The error occurs when I called:

Collection<SMSThread> treads = voice.getSMSThreads();

The error message is as follows (it is weird because the error message
is different from what I posted yesterday):

Caused by: java.lang.NullPointerException
at
com.techventus.server.voice.util.SMSParser.buildSMSThreadMap(SMSParser.java:
196)
at
com.techventus.server.voice.util.SMSParser.getSMSThreads(SMSParser.java:
100)
at com.techventus.server.voice.Voice.getSMSThreads(Voice.java:688)
at
miblab.sicklecellmanager.server.logicManagers.GoogleServiceManagers.VoiceManager.performMessageChecking(VoiceManager.java:
55)
at
miblab.sicklecellmanager.server.RPCServiceImpl.performPendingMessageCheck(RPCServiceImpl.java:
135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:
104)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
569)


Now, 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

}
}
}




On Mar 19, 4:49 pm, Joseph Malone <malone.jos...@gmail.com> wrote:
> http://code.google.com/p/google-voice-java/issues/detail?id=33&thanks...

Frederick Martinez

unread,
Mar 20, 2012, 3:14:42 PM3/20/12
to google-v...@googlegroups.com

Looking at both my google voice accounts the lastest account which is the new one does not display anything in the inbox, but in the sms.  The older account will display messages in the inbox and sms. I don't know if this might help.


In the past If I could not see any sms messages in the inbox of my application. I would have to login into GV web application and delete the Spam popup message, it prevented any parsing of messages; now this does not work.




New

https://www.google.com/voice#inbox  does not show anything.

 

https://www.google.com/voice#sms will show sms messages

 

 

Old

https://www.google.com/voice?pli=1#inbox

 

https://www.google.com/voice?pli=1#sms



Reply all
Reply to author
Forward
0 new messages