1
0
mirror of https://github.com/etesync/android synced 2024-12-24 07:28:09 +00:00

Check for null values in StructuredPostal.TYPE (should fix #549)

This commit is contained in:
Ricki Hirner 2015-06-14 12:00:34 +02:00
parent 18c08bc9dd
commit 534953fe4c

View File

@ -142,7 +142,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
String where;
if (remoteResources.length != 0) {
List<String> sqlFileNames = new LinkedList<String>();
List<String> sqlFileNames = new LinkedList<>();
for (Resource res : remoteResources)
sqlFileNames.add(DatabaseUtils.sqlEscapeString(res.getName()));
where = entryColumnRemoteName() + " NOT IN (" + StringUtils.join(sqlFileNames, ",") + ")";
@ -472,6 +472,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
protected void populatePostalAddress(Contact c, ContentValues row) {
Address address = new Address();
address.setLabel(row.getAsString(StructuredPostal.FORMATTED_ADDRESS));
if (row.containsKey(StructuredPostal.TYPE))
switch (row.getAsInteger(StructuredPostal.TYPE)) {
case StructuredPostal.TYPE_HOME:
address.addType(AddressType.HOME);
@ -965,7 +966,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
String lineStreet = StringUtils.join(new String[] { address.getStreetAddress(), address.getPoBox(), address.getExtendedAddress() }, " "),
lineLocality = StringUtils.join(new String[] { address.getPostalCode(), address.getLocality() }, " ");
List<String> lines = new LinkedList<String>();
List<String> lines = new LinkedList<>();
if (lineStreet != null)
lines.add(lineStreet);
if (address.getRegion() != null && !address.getRegion().isEmpty())
@ -1031,7 +1032,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
}
protected Builder buildRelated(Builder builder, RelatedType type, String name) {
int typeCode = 0;
int typeCode;
String typeLabel = null;
if (type == RelatedType.CHILD)
typeCode = Relation.TYPE_CHILD;