Ticket #1237 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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:
1. Use Studio to create an ajax viewer, at least one of its layer should be selectable. Uncheck the option of "Keep connection alive".
2. Open the ajax viewer in browser.
3. Select one feature in the viewer.
4. waiting for timeout.
5. Click the ajax viewer to select another feature.

Result:
1. If in IE, there is an error dialog pops up saying: "<?x".
2. If in Firefox, there is an error dialog pops up saying: "No ".
Please see the attached screen shots.

Attachments

IE_ErrorDialog.JPG Download (5.7 KB) - added by christinebao 3 years ago.
Firefox_ErrorDialog.JPG Download (7.7 KB) - added by christinebao 3 years ago.
RefineAjaxErrorMsg.patch Download (2.2 KB) - added by christinebao 3 years ago.

Change History

Changed 3 years ago by christinebao

Changed 3 years ago by christinebao

Changed 3 years ago by christinebao

Error message box from IE:

Error message box from Firefox:

Changed 3 years ago by christinebao

[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:
1. QueryFeatureInfo? should pass selRequest.responseText because it contains the exception message. It should not always pass the hard coded string "No response".
2. RequestFailed?() should check whether the text contains <h2>...</h2>. In this case, the message is meaningless.

Changed 3 years ago by christinebao

Changed 3 years ago by christinebao

Changed 3 years ago by christinebao

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

Changed 3 years ago by brucedechant

Christine,

Patch looks good. Unfortunately, given the response returned you don't have much choice but to create the temporary string.

Thanks, Bruce

Changed 3 years ago by christinebao

  • status changed from new to closed
  • resolution set to fixed

Submit r4518 to sandbox/adsk/2.2gp.

Submit r4519 to trunk/MgDev.

Note: See TracTickets for help on using tickets.