From 2ccb53b42d841237c9de23ff75e9ef9e931f63a4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Nov 2012 04:17:39 +0000
Subject: If no ISimulationDataStore or IEstateDataStore implementations could
 be loaded then halt with informative message rather than a later NRE.

Halt already occurs if the relevant config sections are not present.
So it also makes sense to halt if the implementations themselves cannot be loaded.
---
 OpenSim/Region/Application/OpenSimBase.cs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index a3d6820..808c760 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -199,19 +199,33 @@ namespace OpenSim
             IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
             if (simDataConfig == null)
                 throw new Exception("Configuration file is missing the [SimulationDataStore] section.  Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
+
             string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
             if (String.IsNullOrEmpty(module))
                 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section.");
+
             m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source });
+            if (m_simulationDataService == null)
+                throw new Exception(
+                    string.Format(
+                        "Could not load an ISimulationDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [SimulationDataStore] config section.", 
+                        module));
 
             // Load the estate data service
             IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
             if (estateDataConfig == null)
                 throw new Exception("Configuration file is missing the [EstateDataStore] section.  Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
+
             module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
             if (String.IsNullOrEmpty(module))
                 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
+
             m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source });
+            if (m_estateDataService == null)
+                throw new Exception(
+                    string.Format(
+                        "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.", 
+                        module));
 
             base.StartupSpecific();
 
-- 
cgit v1.1