PenguinPaul/google-voice-java

Empty Sms Message Body Breaks the Parser

Opened this issue · 7 comments

What steps will reproduce the problem?
1. Using any google voice account, send a message with an empty body (not even 
spaces) to the account.
2. Connect to the account with google-voice-java.
3. Call the getSMSThreads() method in the Voice class.
4. Weep as you get a null pointer exception.

What is the expected output? What do you see instead?
I would expect to get an sms thread with a single sms that had no text in the 
body of the message.  I get a null pointer exception instead.

What version of the product are you using? On what operating system?
Changeset 137 on mac osx 10.6 and ubuntu linux.


Original issue reported on code.google.com by walt.jav...@gmail.com on 4 Mar 2011 at 11:03

I have a patch that fixes this as well as a junit test case to ensure it 
doesn't break in the future.

Currently there isn't a test suite for this project... so I won't force it, if 
folks don't care.  But if there is interest in beginning to unit test, I'd 
contribute to the cause.

Original comment by walt.jav...@gmail.com on 4 Mar 2011 at 11:13

Original comment by walt.jav...@gmail.com on 22 Mar 2011 at 6:12

Original comment by walt.jav...@gmail.com on 22 Mar 2011 at 6:13

  • Changed state: Started
Hi Walt, I wanted to check on the status of this one as well.

Original comment by malone.j...@gmail.com on 3 Feb 2012 at 3:48

Replace SMSParser.java line 178:

String text = 
element.selectSingleNode(XPathQuery.MESSAGE_SMS_TEXT).getText().trim();

With:

String text = "";
 if (element.selectSingleNode(XPathQuery.MESSAGE_SMS_TEXT) != null) {
     text = element.selectSingleNode(XPathQuery.MESSAGE_SMS_TEXT).getText().trim();
 }

Original comment by natecmic...@gmail.com on 23 Mar 2012 at 4:13

Nate, your fix has been committed.  I would love to hear again from Walt about 
his patch and test cases.


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

Can I close this issue?

Original comment by malone.j...@gmail.com on 14 May 2012 at 3:39