WMTSLayer bug

3904
7
06-08-2015 06:38 AM
JoelBennett
MVP Regular Contributor

A bug in the WMTSLayer constructor prevents any instances of this class from being created.  In the constructor, the call to _parseResourceInfo occurs before the _formatDictionary property is instantiated.  However, the call to _parseResourceInfo includes a read of the _formatDictionary property, which, being undefined at the time, results in an unhandled exception.

Noticed in version 3.13.

If you have a locally hosted copy of the API, you can fix this yourself by moving the instantiation of _formatDictionary higher up in the constructor.

0 Kudos
7 Replies
JoelBennett
MVP Regular Contributor

This is still a problem in 3.15, although the scope has probably never been as wide as I initially reported (i.e. "any instances").  The problem only manifests if supplying "resourceInfo" to the constructor, and the "serviceMode" is "RESTful" (which is the default value if not specified).

The fix is nonetheless the same...the instantiation of _formatDictionary should be moved higher up in the constructor...it could even be the first line if desired.

This is because the call stack of the constructor can reach the _getTileUrlTemplate function (by way of _parseResourceInfo), where the _formatDictionary is referenced, which in turn throws an error about using an undefined reference.

0 Kudos
JoelBennett
MVP Regular Contributor

ESRI did not fix this bug in version 3.16 of the ArcGIS API for JavaScript.

0 Kudos
JoelBennett
MVP Regular Contributor

ESRI did not fix this bug in version 3.17 of the ArcGIS API for JavaScript.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Joel,

Have you actually contacted esri tech support and logged a bug? GeoNet is not an official channel for reporting bugs.

0 Kudos
JoelBennett
MVP Regular Contributor

Robert -

I understand that.  In the spirit of reusability, please see a similar conversation here.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Well bottom line is if you do not report these bugs you find through official channels then they will likely never be fixed.

0 Kudos
JoelBennett
MVP Regular Contributor

For posterity, this was fixed in 3.29. The "What's new in Version 3.29" page also reads:

NIM098119: It is now possible to consume a Web Map Tile Service (WMTS) layer with resource info object on RESTful service mode.

0 Kudos