From 6b27737db61ec1dccab01055a199e1b2ac1ad04c Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Mon, 21 Jan 2013 13:40:17 +0100
Subject: [PATCH] fix error in handling of empty subdomain-property

---
 hsarback/src/de/hsadmin/mods/email/EMailAddress.java           |    4 ++--
 hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java |    3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/email/EMailAddress.java b/hsarback/src/de/hsadmin/mods/email/EMailAddress.java
index 5dd2c89..dcd2ee0 100644
--- a/hsarback/src/de/hsadmin/mods/email/EMailAddress.java
+++ b/hsarback/src/de/hsadmin/mods/email/EMailAddress.java
@@ -66,8 +66,8 @@
 
 	public EMailAddress(String localpart, String subdomain, Domain domain,
 			String target) {
-		this.localpart = localpart;
-		this.subdomain = subdomain;
+		this.localpart = trimToEmpty(localpart);
+		this.subdomain = trimToNull(subdomain);
 		this.domain = domain;
 		this.target = target;
 	}
diff --git a/hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java b/hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java
index e8447cd..175ef4e 100644
--- a/hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java
@@ -35,6 +35,9 @@
 		if (adr.getLocalpart() == null) {
 			adr.setLocalpart("");
 		}
+		if (adr.getSubdomain() == null) {
+			adr.setSubdomain("");
+		}
 		if (adr.getDomain() == null
 				|| adr.getDomain().getName() == null
 				|| adr.getDomain().getName().length() == 0) {

--
Gitblit v1.9.1