Browse code

BM-13157 Fix: IDomains npe

David Phan authored on 14/05/2018 13:04:48
Showing 1 changed files
... ...
@@ -49,7 +49,6 @@ import net.bluemind.user.api.User;
49 49
 public final class Nginx implements Handler<HttpServerRequest>, NeedVertxExecutor {
50 50
 
51 51
 	private static final Logger logger = LoggerFactory.getLogger(Nginx.class);
52
-	private final IDomains domainApi;
53 52
 	private Vertx vertx;
54 53
 	private BlockingCode blocking;
55 54
 	private static String defaultDomain;
... ...
@@ -110,7 +109,6 @@ public final class Nginx implements Handler<HttpServerRequest>, NeedVertxExecuto
110 110
 	}
111 111
 
112 112
 	public Nginx() {
113
-		domainApi = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM).instance(IDomains.class);
114 113
 		loadDefaultDomain();
115 114
 	}
116 115
 
... ...
@@ -188,7 +186,8 @@ public final class Nginx implements Handler<HttpServerRequest>, NeedVertxExecuto
188 188
 		if (latd.contains("@")) {
189 189
 			String userDomain = latd.split("@")[1];
190 190
 
191
-			ItemValue<Domain> domain = domainApi.findByNameOrAliases(userDomain);
191
+			ItemValue<Domain> domain = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM)
192
+					.instance(IDomains.class).findByNameOrAliases(userDomain);
192 193
 
193 194
 			if (domain != null) {
194 195
 				IServer serverApi = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM)
... ...
@@ -210,7 +209,8 @@ public final class Nginx implements Handler<HttpServerRequest>, NeedVertxExecuto
210 210
 		if ("pop3".equals(protocol) && latd.contains("@")) {
211 211
 			String[] latdParts = latd.split("@");
212 212
 
213
-			ItemValue<Domain> domain = domainApi.findByNameOrAliases(latdParts[1]);
213
+			ItemValue<Domain> domain = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM)
214
+					.instance(IDomains.class).findByNameOrAliases(latdParts[1]);
214 215
 			if (domain != null) {
215 216
 				IUser userApi = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM).instance(IUser.class,
216 217
 						domain.uid);