[fusion-commits] r3031 - in branches/fusion-mg31: . lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Mar 8 07:00:13 PST 2018


Author: jng
Date: 2018-03-08 07:00:13 -0800 (Thu, 08 Mar 2018)
New Revision: 3031

Modified:
   branches/fusion-mg31/
   branches/fusion-mg31/lib/fusion.js
Log:
Merged revision(s) 3030 from trunk:
If a bad app def resource id is passed in, it show alert early about this problem as TraceKit and its error reporting/displaying infrastructure may not be ready at this point.

Fixes #660
........


Index: branches/fusion-mg31
===================================================================
--- branches/fusion-mg31	2018-03-08 14:58:57 UTC (rev 3030)
+++ branches/fusion-mg31	2018-03-08 15:00:13 UTC (rev 3031)

Property changes on: branches/fusion-mg31
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,4 ##
 /sandbox/robust_error_handling:2818-2825
 /sandbox/stamen:2873-2875
 /sandbox/tiling:2845-2846
-/trunk:2946,2950,2954,2956,2960,2964,2993-2995,2999,3003,3028
\ No newline at end of property
+/trunk:2946,2950,2954,2956,2960,2964,2993-2995,2999,3003,3028,3030
\ No newline at end of property
Modified: branches/fusion-mg31/lib/fusion.js
===================================================================
--- branches/fusion-mg31/lib/fusion.js	2018-03-08 14:58:57 UTC (rev 3030)
+++ branches/fusion-mg31/lib/fusion.js	2018-03-08 15:00:13 UTC (rev 3031)
@@ -1676,37 +1676,43 @@
         appDefUrl.indexOf('Session') == 0)) {
         
         var fetchAppDef = function(appDefUrl, sessionId) {
-            var xhr = new getXmlHttpRequest(); 
+            var xhr = getXmlHttpRequest(); 
             var mapAgentUrl = getAgentUrl(); 
             xhr.open("GET", mapAgentUrl + "?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ sessionId, false); 
-            xhr.send(null); 
-            var appDefXML = xhr.responseXML.documentElement; 
+            try {
+                xhr.send(null); 
+                var appDefXML = xhr.responseXML.documentElement; 
 
-            if (appDefXML) {
-                var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0]; 
-                var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0]; 
-                var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0];
-                var osmElement = appDefXML.getElementsByTagName("OpenStreetMapScript")[0];
-                var stamenElement = appDefXML.getElementsByTagName("StamenScript")[0];
+                if (appDefXML) {
+                    var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0]; 
+                    var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0]; 
+                    var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0];
+                    var osmElement = appDefXML.getElementsByTagName("OpenStreetMapScript")[0];
+                    var stamenElement = appDefXML.getElementsByTagName("StamenScript")[0];
 
-                addElement(googleElement); 
-                addElement(yahooElement); 
-                addElement(veElement);
-                addElement(osmElement);
-                addElement(stamenElement);
+                    addElement(googleElement); 
+                    addElement(yahooElement); 
+                    addElement(veElement);
+                    addElement(osmElement);
+                    addElement(stamenElement);
 
-                var bingMapKeyElement = appDefXML.getElementsByTagName("BingMapKey")[0];
-                if (bingMapKeyElement) {
-                    var bingMapKey = bingMapKeyElement.textContent;
-                    if (!bingMapKey)
-                        bingMapKey = bingMapKeyElement.text;
-                    Fusion.bingMapKey = bingMapKey;
+                    var bingMapKeyElement = appDefXML.getElementsByTagName("BingMapKey")[0];
+                    if (bingMapKeyElement) {
+                        var bingMapKey = bingMapKeyElement.textContent;
+                        if (!bingMapKey)
+                            bingMapKey = bingMapKeyElement.text;
+                        Fusion.bingMapKey = bingMapKey;
+                    }
                 }
+            } catch (e) {
+                if (xhr.statusText == "MgResourceNotFoundException") {
+                    alert("Failed to fetch Application Definition. The specified resource could not be found");
+                } //Anything else we can't do anything about as TraceKit is probably not loaded yet
             }
         };
         
         var getSiteVersion = function(sessionId) {
-            var xhr = new getXmlHttpRequest(); 
+            var xhr = getXmlHttpRequest(); 
             var mapAgentUrl = getAgentUrl(); 
             xhr.open("GET", mapAgentUrl + "?OPERATION=GETSITEVERSION&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&SESSION="+ sessionId, false); 
             xhr.send(null); 



More information about the fusion-commits mailing list