aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTedd Hansen2008-09-21 00:42:27 +0000
committerTedd Hansen2008-09-21 00:42:27 +0000
commit9c8aeff27c503beedc2e8566a4a7401dfe3fd15d (patch)
tree29033a3a0cf3b482a2147be29cb40d4fea778d63 /OpenSim
parentOne small bug fixed, now it compiles. (diff)
downloadopensim-SC-9c8aeff27c503beedc2e8566a4a7401dfe3fd15d.zip
opensim-SC-9c8aeff27c503beedc2e8566a4a7401dfe3fd15d.tar.gz
opensim-SC-9c8aeff27c503beedc2e8566a4a7401dfe3fd15d.tar.bz2
opensim-SC-9c8aeff27c503beedc2e8566a4a7401dfe3fd15d.tar.xz
Some error handling to avoid errors in SEC
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEngineBase.cs45
-rw-r--r--OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEnginePlugin.cs13
2 files changed, 40 insertions, 18 deletions
diff --git a/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEngineBase.cs b/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEngineBase.cs
index c0a37a0..e6f5210 100644
--- a/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEngineBase.cs
+++ b/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEngineBase.cs
@@ -72,21 +72,25 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine
72 foreach (string c in ComponentList) 72 foreach (string c in ComponentList)
73 { 73 {
74 m_log.Info("[" + Name + "]: Loading: " + c); 74 m_log.Info("[" + Name + "]: Loading: " + c);
75 try 75 lock (Components)
76 {
77 if (ComponentRegistry.providers.ContainsKey(c))
78 Components.Add(Activator.CreateInstance(ComponentRegistry.providers[c]) as ComponentBase);
79 else
80 m_log.Error("[" + Name + "]: Component \"" + c + "\" not found, can not load");
81 } catch (Exception ex)
82 { 76 {
83 m_log.Error("[" + Name + "]: Exception loading \"" + c + "\": " + ex.ToString()); 77 try
78 {
79 if (ComponentRegistry.providers.ContainsKey(c))
80 Components.Add(Activator.CreateInstance(ComponentRegistry.providers[c]) as ComponentBase);
81 else
82 m_log.Error("[" + Name + "]: Component \"" + c + "\" not found, can not load");
83 }
84 catch (Exception ex)
85 {
86 m_log.Error("[" + Name + "]: Exception loading \"" + c + "\": " + ex.ToString());
87 }
84 } 88 }
85 } 89 }
86 90
87 91
88 // Run Initialize on all our providers, hand over a reference of ourself. 92 // Run Initialize on all our providers, hand over a reference of ourself.
89 foreach (ComponentBase p in Components) 93 foreach (ComponentBase p in Components.ToArray())
90 { 94 {
91 try 95 try
92 { 96 {
@@ -94,12 +98,17 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine
94 } 98 }
95 catch (Exception ex) 99 catch (Exception ex)
96 { 100 {
97 m_log.Error("[" + Name + "]: Error initializing \"" + p.GetType().FullName + "\": " + ex.ToString()); 101 lock (Components)
98 Components.Remove(p); 102 {
103 m_log.Error("[" + Name + "]: Error initializing \"" + p.GetType().FullName + "\": " +
104 ex.ToString());
105 if (Components.Contains(p))
106 Components.Remove(p);
107 }
99 } 108 }
100 } 109 }
101 // All modules has been initialized, call Start() on them. 110 // All modules has been initialized, call Start() on them.
102 foreach (ComponentBase p in Components) 111 foreach (ComponentBase p in Components.ToArray())
103 { 112 {
104 try 113 try
105 { 114 {
@@ -107,8 +116,12 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine
107 } 116 }
108 catch (Exception ex) 117 catch (Exception ex)
109 { 118 {
110 m_log.Error("[" + Name + "]: Error starting \"" + p.GetType().FullName + "\": " + ex.ToString()); 119 lock (Components)
111 Components.Remove(p); 120 {
121 m_log.Error("[" + Name + "]: Error starting \"" + p.GetType().FullName + "\": " + ex.ToString());
122 if (Components.Contains(p))
123 Components.Remove(p);
124 }
112 } 125 }
113 } 126 }
114 127
@@ -149,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine
149 PreClose(); 162 PreClose();
150 163
151 // Then Call Close() on all components 164 // Then Call Close() on all components
152 foreach (ComponentBase p in Components) 165 foreach (ComponentBase p in Components.ToArray())
153 { 166 {
154 try 167 try
155 { 168 {
diff --git a/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEnginePlugin.cs b/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEnginePlugin.cs
index a0622ea..c4f4bbe 100644
--- a/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEnginePlugin.cs
+++ b/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEnginePlugin.cs
@@ -45,8 +45,17 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine
45 { 45 {
46 // New region is being created 46 // New region is being created
47 // Create a new script engine 47 // Create a new script engine
48 scriptEngine = Activator.CreateInstance(ComponentRegistry.scriptEngines[tempScriptEngineName]) as RegionScriptEngineBase; 48 try
49 scriptEngine.Initialize(scene, source); 49 {
50 scriptEngine =
51 Activator.CreateInstance(ComponentRegistry.scriptEngines[tempScriptEngineName]) as
52 RegionScriptEngineBase;
53 scriptEngine.Initialize(scene, source);
54 }
55 catch (Exception ex)
56 {
57 scriptEngine.m_log.Error("[ScriptEngine]: Unable to load engine \"" + tempScriptEngineName + "\": " + ex.ToString());
58 }
50 } 59 }
51 60
52 public void PostInitialise() 61 public void PostInitialise()