aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs163
1 files changed, 93 insertions, 70 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 31684ae..fd12741 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -78,6 +78,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
78 private string m_ScriptErrorMessage; 78 private string m_ScriptErrorMessage;
79 private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>(); 79 private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>();
80 private bool m_AppDomainLoading; 80 private bool m_AppDomainLoading;
81 private Dictionary<UUID,ArrayList> m_ScriptErrors =
82 new Dictionary<UUID,ArrayList>();
81 83
82 // disable warning: need to keep a reference to XEngine.EventManager 84 // disable warning: need to keep a reference to XEngine.EventManager
83 // alive to avoid it being garbage collected 85 // alive to avoid it being garbage collected
@@ -657,87 +659,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine
657 659
658 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap; 660 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
659 661
660 try 662 lock(m_ScriptErrors)
661 { 663 {
662 lock (m_AddingAssemblies) 664 try
663 { 665 {
664 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); 666 lock (m_AddingAssemblies)
665 if (!m_AddingAssemblies.ContainsKey(assembly)) { 667 {
666 m_AddingAssemblies[assembly] = 1; 668 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
667 } else { 669 if (!m_AddingAssemblies.ContainsKey(assembly)) {
668 m_AddingAssemblies[assembly]++; 670 m_AddingAssemblies[assembly] = 1;
671 } else {
672 m_AddingAssemblies[assembly]++;
673 }
669 } 674 }
670 }
671 675
672 string[] warnings = m_Compiler.GetWarnings(); 676 string[] warnings = m_Compiler.GetWarnings();
673 677
674 if (warnings != null && warnings.Length != 0) 678 if (warnings != null && warnings.Length != 0)
675 {
676 foreach (string warning in warnings)
677 { 679 {
678 try 680 foreach (string warning in warnings)
679 { 681 {
680 // DISPLAY WARNING INWORLD 682 if (!m_ScriptErrors.ContainsKey(itemID))
681 string text = "Warning:\n" + warning; 683 m_ScriptErrors[itemID] = new ArrayList();
682 if (text.Length > 1000) 684
683 text = text.Substring(0, 1000); 685 m_ScriptErrors[itemID].Add(warning);
684 if (!ShowScriptSaveResponse(item.OwnerID, 686 // try
685 assetID, text, true)) 687 // {
686 { 688 // // DISPLAY WARNING INWORLD
687 if (presence != null && (!postOnRez)) 689 // string text = "Warning:\n" + warning;
688 presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false); 690 // if (text.Length > 1000)
689 691 // text = text.Substring(0, 1000);
690 World.SimChat(Utils.StringToBytes(text), 692 // if (!ShowScriptSaveResponse(item.OwnerID,
691 ChatTypeEnum.DebugChannel, 2147483647, 693 // assetID, text, true))
692 part.AbsolutePosition, 694 // {
693 part.Name, part.UUID, false); 695 // if (presence != null && (!postOnRez))
694 } 696 // presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
695 } 697 //
696 catch (Exception e2) // LEGIT: User Scripting 698 // World.SimChat(Utils.StringToBytes(text),
697 { 699 // ChatTypeEnum.DebugChannel, 2147483647,
698 m_log.Error("[XEngine]: " + 700 // part.AbsolutePosition,
699 "Error displaying warning in-world: " + 701 // part.Name, part.UUID, false);
700 e2.ToString()); 702 // }
701 m_log.Error("[XEngine]: " + 703 // }
702 "Warning:\r\n" + 704 // catch (Exception e2) // LEGIT: User Scripting
703 warning); 705 // {
706 // m_log.Error("[XEngine]: " +
707 // "Error displaying warning in-world: " +
708 // e2.ToString());
709 // m_log.Error("[XEngine]: " +
710 // "Warning:\r\n" +
711 // warning);
712 // }
704 } 713 }
705 } 714 }
706 } 715 }
707 } 716 catch (Exception e)
708 catch (Exception e)
709 {
710 try
711 { 717 {
712 // DISPLAY ERROR INWORLD 718 // try
713 m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString(); 719 // {
714 720 if (!m_ScriptErrors.ContainsKey(itemID))
715 m_ScriptFailCount++; 721 m_ScriptErrors[itemID] = new ArrayList();
716 string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString(); 722 // DISPLAY ERROR INWORLD
717 if (text.Length > 1000) 723 // m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
718 text = text.Substring(0, 1000); 724 //
719 if (!ShowScriptSaveResponse(item.OwnerID, 725 m_ScriptFailCount++;
720 assetID, text, false)) 726 m_ScriptErrors[itemID].Add(e.Message.ToString());
721 { 727 // string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
722 if (presence != null && (!postOnRez)) 728 // if (text.Length > 1000)
723 presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false); 729 // text = text.Substring(0, 1000);
724 World.SimChat(Utils.StringToBytes(text), 730 // if (!ShowScriptSaveResponse(item.OwnerID,
725 ChatTypeEnum.DebugChannel, 2147483647, 731 // assetID, text, false))
726 part.AbsolutePosition, 732 // {
727 part.Name, part.UUID, false); 733 // if (presence != null && (!postOnRez))
728 } 734 // presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
729 } 735 // World.SimChat(Utils.StringToBytes(text),
730 catch (Exception e2) // LEGIT: User Scripting 736 // ChatTypeEnum.DebugChannel, 2147483647,
731 { 737 // part.AbsolutePosition,
732 m_log.Error("[XEngine]: "+ 738 // part.Name, part.UUID, false);
733 "Error displaying error in-world: " + 739 // }
734 e2.ToString()); 740 // }
735 m_log.Error("[XEngine]: " + 741 // catch (Exception e2) // LEGIT: User Scripting
736 "Errormessage: Error compiling script:\r\n" + 742 // {
737 e.Message.ToString()); 743 // m_log.Error("[XEngine]: "+
738 } 744 // "Error displaying error in-world: " +
745 // e2.ToString());
746 // m_log.Error("[XEngine]: " +
747 // "Errormessage: Error compiling script:\r\n" +
748 // e.Message.ToString());
749 // }
739 750
740 return false; 751 return false;
752 }
741 } 753 }
742 754
743 755
@@ -1555,7 +1567,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1555 1567
1556 public ArrayList GetScriptErrors(UUID itemID) 1568 public ArrayList GetScriptErrors(UUID itemID)
1557 { 1569 {
1558 return new ArrayList(); 1570 System.Threading.Thread.Sleep(1000);
1571
1572 lock (m_ScriptErrors)
1573 {
1574 if (m_ScriptErrors.ContainsKey(itemID))
1575 {
1576 ArrayList ret = m_ScriptErrors[itemID];
1577 m_ScriptErrors.Remove(itemID);
1578 return ret;
1579 }
1580 return new ArrayList();
1581 }
1559 } 1582 }
1560 } 1583 }
1561} 1584}