srikanthtalasila / ez-vcard

Automatically exported from code.google.com/p/ez-vcard
0 stars 0 forks source link

NullPointerException in AddressType #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call method AdressType.getTimezome() when no timezone set.

What is the expected output?
null value, no exception.

What do you see instead?
NullPointerException.

What version of the product are you using? On what operating system?
ez-vcard 0.7.2, java 1.6, Windows 7

---------------
Stack trace :

Caused by: java.lang.NullPointerException
    at ezvcard.types.AddressType.getTimezone(AddressType.java:381)

---------------
AdressType.java :

public String getTimezone() {
    String value = subTypes.getFirst("TZ");
    if (value.matches("(?i)tz:.*")) {    <====== NullPointerException
        //remove the "tz:"
        value = (value.length() > 3) ? value.substring(3) : "";
    }
    return value;
}

---------------
VCardSubTypes.java :

    public String getFirst(String name) {
        List<String> list = get(name);
        return list.isEmpty() ? null : list.get(0);
    }

Original issue reported on code.google.com by yannick....@gmail.com on 10 Apr 2013 at 2:28

GoogleCodeExporter commented 9 years ago
This will be resolved in the next release.  "TZ" parameters will no longer be 
parsed as URIs.  Instead, the return value of "subTypes.getFirst("TZ")" will be 
returned as-is.

Original comment by mike.angstadt on 10 Apr 2013 at 11:18