Improved null import account/identity

pull/212/head
M66B 2 years ago
parent 85d15c277b
commit b28c2d6e38

@ -336,7 +336,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
if (json.has("id"))
account.id = json.getLong("id");
if (json.has("uuid"))
if (json.has("uuid") && !json.isNull("uuid"))
account.uuid = json.getString("uuid");
if (json.has("order"))
@ -356,15 +356,15 @@ public class EntityAccount extends EntityOrder implements Serializable {
account.insecure = (json.has("insecure") && json.getBoolean("insecure"));
account.port = json.getInt("port");
account.auth_type = json.getInt("auth_type");
if (json.has("provider"))
if (json.has("provider") && !json.isNull("provider"))
account.provider = json.getString("provider");
account.user = json.getString("user");
account.password = json.getString("password");
if (json.has("certificate_alias"))
if (json.has("certificate_alias") && !json.isNull("certificate_alias"))
account.certificate_alias = json.getString("certificate_alias");
if (json.has("realm"))
if (json.has("realm") && !json.isNull("realm"))
account.realm = json.getString("realm");
if (json.has("fingerprint"))
if (json.has("fingerprint") && !json.isNull("fingerprint"))
account.fingerprint = json.getString("fingerprint");
if (json.has("name") && !json.isNull("name"))
@ -373,7 +373,8 @@ public class EntityAccount extends EntityOrder implements Serializable {
account.category = json.getString("category");
if (json.has("color"))
account.color = json.getInt("color");
account.calendar = json.optString("calendar", null);
if (json.has("calendar") && !json.isNull("calendar"))
account.calendar = json.getString("calendar");
account.synchronize = json.getBoolean("synchronize");
if (json.has("ondemand"))

@ -249,7 +249,7 @@ public class EntityIdentity {
EntityIdentity identity = new EntityIdentity();
identity.id = json.getLong("id");
if (json.has("uuid"))
if (json.has("uuid") && !json.isNull("uuid"))
identity.uuid = json.getString("uuid");
identity.name = json.getString("name");
@ -270,19 +270,19 @@ public class EntityIdentity {
identity.insecure = (json.has("insecure") && json.getBoolean("insecure"));
identity.port = json.getInt("port");
identity.auth_type = json.getInt("auth_type");
if (json.has("provider"))
if (json.has("provider") && !json.isNull("provider"))
identity.provider = json.getString("provider");
identity.user = json.getString("user");
identity.password = json.getString("password");
if (json.has("certificate_alias"))
if (json.has("certificate_alias") && !json.isNull("certificate_alias"))
identity.certificate_alias = json.getString("certificate_alias");
if (json.has("realm") && !json.isNull("realm"))
identity.realm = json.getString("realm");
if (json.has("fingerprint"))
if (json.has("fingerprint") && !json.isNull("fingerprint"))
identity.fingerprint = json.getString("fingerprint");
if (json.has("use_ip"))
identity.use_ip = json.getBoolean("use_ip");
if (json.has("ehlo"))
if (json.has("ehlo") && !json.isNull("ehlo"))
identity.ehlo = json.getString("ehlo");
identity.synchronize = json.getBoolean("synchronize");
@ -293,7 +293,7 @@ public class EntityIdentity {
identity.sender_extra = json.getBoolean("sender_extra");
if (json.has("sender_extra_name"))
identity.sender_extra_name = json.getBoolean("sender_extra_name");
if (json.has("sender_extra_regex"))
if (json.has("sender_extra_regex") && !json.isNull("sender_extra_regex"))
identity.sender_extra_regex = json.getString("sender_extra_regex");
if (json.has("replyto") && !json.isNull("replyto"))

Loading…
Cancel
Save