> Yes, I think the format should behave gracefully on such cases. IIRC
> with the patch I committed for WFS the format doesn't throw an
> exception or ouput an error message, it just silently returns no
> features. But I agree it may make sense to warn the caller by raising
> an exception or something.
Here's a very basic patch that at least prevents hanging. I don't know
what to look for in terms of error to trigger a more meaningful message
such as "truncated xml".
Cheers,
Yves
Index: lib/externals/openlayers-trunk/lib/OpenLayers/Format/WMSGetFeatureInfo.js
===================================================================
--- lib/externals/openlayers-trunk/lib/OpenLayers/Format/WMSGetFeatureInfo.js (révision 9936)
+++ lib/externals/openlayers-trunk/lib/OpenLayers/Format/WMSGetFeatureInfo.js (copie de travail)
@@ -184,31 +184,41 @@
getSiblingNodesByTagCriteria: function(node, criteria){
var nodes = [];
var children, tagName, n, matchNodes, child;
- if (node && node.hasChildNodes()) {
- children = node.childNodes;
- n = children.length;
+ try
+ {
+ if (node && node.hasChildNodes()) {
+ children = node.childNodes;
+ n = children.length;
- for(var k=0; k<n; k++){
- child = children[k];
- while (child && child.nodeType != 1) {
- child = child.nextSibling;
- k++;
- }
- tagName = (child ? child.nodeName : '');
- if (tagName.length > 0 && tagName.indexOf(criteria) > -1) {
- nodes.push(child);
- } else {
- matchNodes = this.getSiblingNodesByTagCriteria(
- child, criteria);
+ for(var k=0; k<n; k++){
+ child = children[k];
+ while (child && child.nodeType != 1) {
+ child = child.nextSibling;
+ k++;
+ }
+ tagName = (child ? child.nodeName : '');
+ if (tagName.length > 0 && tagName.indexOf(criteria) > -1) {
+ nodes.push(child);
+ } else {
+ matchNodes = this.getSiblingNodesByTagCriteria(
+ child, criteria);
- if(matchNodes.length > 0){
- (nodes.length == 0) ?
- nodes = matchNodes : nodes.push(matchNodes);
+ if(matchNodes.length > 0){
+ (nodes.length == 0) ?
+ nodes = matchNodes : nodes.push(matchNodes);
+ }
}
}
+
}
-
}
+ catch(err)
+ {
+ txt="There was an error on this page.\n\n";
+ txt+="Error description: " + err.description + "\n\n";
+ txt+="Click OK to continue.\n\n";
+ alert(txt);
+ }
return nodes;
},
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users