Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed null reference in WMSGetFeatureInfo on Internet Explorer 11 #1384

Merged

Conversation

mdalbertsonjr
Copy link
Contributor

I ran into a small issue with the WMSGetFeatureInfo today. If I set the infoFormat option to 'application/json', then I end up with a null reference exception in format.read on Internet Explorer 11. I thought that it might be better to have the handleResponse method check the content type of the response (and the type in infoFormat) to determine if the response is 'application/json'. In the case that the response is 'application/json', parse the responseText using OpenLayers.Format.GeoJSON.

I have added this logic to the handleResponse method, and added an appropriate test case to the test harness. Also, this is only my second contribution to an open source project, and my first pull request on GitHub, so any constructive criticism would be greatly appreciated.

…ontent-type

of the response is 'application/json'. In the case that JSON is returned, the
features array is constructed by parsing doc with OpenLayers.Format.GeoJSON.
This prevents a null reference issue when asking for feature information from
GeoServer on Internet Explorer 11.
@@ -517,8 +526,9 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
{url: url, features: features}
);
} else {
this._features = (this._features || []).concat(features);
this._features = (this._features || []).concat(features);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix whitespace here.

@ahocevar
Copy link
Member

Looks good. Please address the two minor comments.

Do we have a CLA from you? If not, please submit one so we can merge this. See https://github.com/openlayers/cla.

@mdalbertsonjr
Copy link
Contributor Author

Sorry for the late response. I finally got a CCLA signed by my boss. The list should have received an email from my boss, Scott Eckersall, with the CCLA.

@ahocevar
Copy link
Member

ahocevar commented Sep 6, 2014

CCLA received. Thanks!

ahocevar added a commit that referenced this pull request Sep 6, 2014
…uashed

Fixed null reference in WMSGetFeatureInfo on Internet Explorer 11
@ahocevar ahocevar merged commit b85c45f into openlayers:master Sep 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants