From edcdc2c5881a69a1b735f7e0571d8c409c1df49c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 1 Aug 2017 15:39:04 +0200 Subject: [client] Only try sat server in OrgCache if it is set yet --- .../openslx/dozmod/thrift/cache/OrganizationCache.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'dozentenmodul/src/main/java') diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/OrganizationCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/OrganizationCache.java index c76da623..f4e0a430 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/OrganizationCache.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/OrganizationCache.java @@ -5,6 +5,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.openslx.bwlp.thrift.iface.Organization; +import org.openslx.bwlp.thrift.iface.SatelliteServer; import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.dozmod.thrift.Sorters; import org.openslx.thrifthelper.ThriftManager; @@ -34,11 +35,16 @@ public class OrganizationCache { e); } if (orgs == null) { - try { - orgs = ThriftManager.getSatClient().getAllOrganizations(); - } catch (Exception e) { - LOGGER.error("Failed to get organization list from satellite server. ", e); - // both failed, can this ever happen? TODO if it does, what do we do? + SatelliteServer.Iface client = ThriftManager.getSatClient(); + if (client == null) { + LOGGER.warn("Satellite server not known yet."); + } else { + try { + orgs = client.getAllOrganizations(); + } catch (Exception e) { + LOGGER.error("Failed to get organization list from satellite server. ", e); + // both failed, can this ever happen? TODO if it does, what do we do? + } } } if (orgs != null) -- cgit v1.2.3-55-g7522