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

Null Pointer Exception Error Parsing Contact #57

Open
GoogleCodeExporter opened this issue Apr 11, 2015 · 1 comment
Open

Null Pointer Exception Error Parsing Contact #57

GoogleCodeExporter opened this issue Apr 11, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

In an Android application, I get the following error:

java.lang.NullPointerException
at com.techventus.server.voice.util.SMSParser.parseContact(SMSParser.java:143)
at com.techventus.server.voice.util.SMSParser.getSMSThreads(SMSParser.java:115)
at com.techventus.server.voice.Voice.getSMSThreads(Voice.java:842)

Original issue reported on code.google.com by cs3vi...@gmail.com on 8 Nov 2013 at 2:29

@GoogleCodeExporter
Copy link
Author

Here is the fix. You can't call .trim() on a text element until you check if 
it's null or not:

    /**
     * Parses the contact information from the DOM Element.
     * 
     * @param element
     *            the DOM Element
     * @return the Contact
     */
    private Contact parseContact(Element element) {
        String name = element.selectSingleNode(XPathQuery.MESSAGE_NAME_LINK).getText();
        if(name != null){
            name = name.trim();
        }

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

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