Opened 15 years ago
Closed 15 years ago
#1237 closed defect (fixed)
Error dialog of ajax viewer should be refined
Reported by: | christinebao | Owned by: | Christine Bao |
---|---|---|---|
Priority: | medium | Milestone: | 2.2 |
Component: | AJAX Viewer | Version: | 2.1.0 |
Severity: | major | Keywords: | |
Cc: | Bruce.Dechant@…, Jenny.He@… | External ID: | 1293596 |
Description
Report from Autodesk QA:
- Use Studio to create an ajax viewer, at least one of its layer should be selectable. Uncheck the option of "Keep connection alive".
- Open the ajax viewer in browser.
- Select one feature in the viewer.
- waiting for timeout.
- Click the ajax viewer to select another feature.
Result:
- If in IE, there is an error dialog pops up saying: "<?x".
- If in Firefox, there is an error dialog pops up saying: "No ".
Please see the attached screen shots.
Attachments (3)
Change History (9)
by , 15 years ago
Attachment: | IE_ErrorDialog.JPG added |
---|
by , 15 years ago
Attachment: | Firefox_ErrorDialog.JPG added |
---|
comment:1 by , 15 years ago
comment:2 by , 15 years ago
[Tech assessment]
This defect is caused by r4402 ajaxmappane.templ, which is introduced by ticket http://trac.osgeo.org/mapguide/ticket/1195 (Implement RFC 87 - SiteInformation enhancements)
Take IE for example, when the exception happens, function OnSelectionOverlayImageLoadedError(e) is triggered.
function OnSelectionOverlayImageLoadedError(e) { var text = this.req.responseText; var startPos = text.indexOf("<h2>"); startPos = startPos + 4; var endPos = text.indexOf("</h2>", startPos); var message = text.substring(startPos, endPos); alert(message); return false; }
In the above scenario, text is the following content:
<?xml version="1.0" encoding="UTF-8"?> <FeatureInformation> <FeatureSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd"></FeatureSet><Tooltip /> <Hyperlink /> </FeatureInformation>
As you can see, there is no <h2>...</h2> in text, so the message content parsed is meaningless. The result is message = "<?x".
Take Firefox for example, it calls function QueryFeatureInfo(geom, append, maxfeatures, which) is triggered.
function QueryFeatureInfo(geom, append, maxfeatures, which) { ... if(selRequest.responseXML) { ProcessFeatureInfo(selRequest.responseXML.documentElement, append, which); } else RequestFailed("No response"); }
Please note the last line RequestFailed("No response"). The function RequestFailed(text) is this:
function RequestFailed(text) { var startPos = text.indexOf("<h2>"); startPos = startPos + 4; var endPos = text.indexOf("</h2>", startPos); var message = text.substring(startPos, endPos); alert(message); }
There are two problems here:
- QueryFeatureInfo should pass selRequest.responseText because it contains the exception message. It should not always pass the hard coded string "No response".
- RequestFailed() should check whether the text contains <h2>...</h2>. In this case, the message is meaningless.
by , 15 years ago
Attachment: | RefineAjaxErrorMsg.patch added |
---|
comment:3 by , 15 years ago
Attach patch http://trac.osgeo.org/mapguide/attachment/ticket/1237/RefineAjaxErrorMsg.patch for fixing this.
comment:4 by , 15 years ago
Hi Bruce,
Would you please review this patch? Thank you.
I have a question about function OnSelectionOverlayImageLoadedError(e). It's used in function RequestSelectionImage(reqId, viewParams), the code is:
url = webAgent + "?OPERATION=GETDYNAMICMAPOVERLAYIMAGE&FORMAT=PNG&VERSION=2.1.0&SESSION=" + sessionId + "&MAPNAME=" + encodeComponent(mapName) + "&SEQ=" + Math.random() + "&CLIENTAGENT=" + encodeComponent(clientAgent) + "&BEHAVIOR=5&SELECTIONCOLOR=" + selectionColor; url += viewParams; document.getElementById('selOverlay').innerHTML = '<img class="mapImage" name="' + reqId + '" id="selectionImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnSelectionOverlayImageLoaded(event)" onerror="return OnSelectionOverlayImageLoadedError(event)">';
It seems that if error happens during GETDYNAMICMAPOVERLAYIMAGE request, OnSelectionOverlayImageLoadedError(e) will be triggered. However the response text is not as expceted. I use a hard coded information "No feature available." temporiraly. Is there any better way to really get the exception message?
Thanks & regards,
Christine
comment:5 by , 15 years ago
Christine,
Patch looks good. Unfortunately, given the response returned you don't have much choice but to create the temporary string.
Thanks, Bruce
comment:6 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Error message box from IE:
Error message box from Firefox: