{ "id": "101152", "key": "ALOY-267", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "14177", "description": "2012 Sprint 20", "name": "2012 Sprint 20", "archived": true, "released": true, "releaseDate": "2012-10-08" }, { "id": "14176", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": false, "released": true, "releaseDate": "2012-12-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-10-01T19:51:14.000+0000", "created": "2012-09-14T07:48:18.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "notable" ], "versions": [ { "id": "14171", "description": "", "name": "2012 Sprint 19", "archived": true, "released": true, "releaseDate": "2012-09-24" } ], "issuelinks": [], "assignee": null, "updated": "2018-03-07T22:26:11.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "h2. Problem\r\n\r\nALOY-250 solved the issue of malformed XML and making it abort Alloy compilation. Unfortunately it required a hack-ish workaround to a shortcoming in the xmldom module. Specifically, xmldom only reports a message via {{console.warn}} when it encounters malformed XML. It does not abort the parsing, which results in tough-to-debug, unexpected behavior for developers. To remedy, when executing {{new DOMParser().parseFromString}} in Alloy, we override {{console.warn}} before the call to make it abort the app if encountered, and then set {{console.warn}} back to normal afterwards. here's the snippet:\r\n\r\n{code:javascript}\r\nvar warn = console.warn;\r\nconsole.warn = function(msg) {\r\n\texports.die(['Error parsing XML document', msg]);\r\n};\r\nvar doc = new DOMParser().parseFromString(string);\r\nconsole.warn = warn;\r\n{code}\r\n\r\nObviously this type of hack should ideally be avoided. it would also be nice if we could get more information other than just the tag names of the XML involved, like perhaps line numbers. In any case, this needs to be revisited and improved.\r\n\r\n* The hack alternatives\r\n** An issue has been logged for error reporting. Ideally this will be implemented by the owner, but the repository doesn't exactly see a lot of activity.\r\n** fork and modify ourselves and maintain a alloy-specific version of xmldom\r\n** Looks for other xml alternatives, like jsdom (see also, time-consuming)\r\n\r\nh2. Update (9/14/2012)\r\n\r\nMy original logged issue has not yet been commented on: https://github.com/jindw/xmldom/issues/36\r\n\r\nbut the apparently work is underway: https://github.com/jindw/xmldom/commit/eb17b3af06eae4d7d29c5debe74780e347deb0b3\r\n\r\nWill watch progress and keep an eye out for new published version to npm.", "attachment": [], "flagged": false, "summary": "Improve Malformed XML error reporting", "creator": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "221561", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Increased the priority as it turns out some of the bad xmldom error reporting, or lack thereof, can cause freezes in the alloy process. Not ending in error, but instead chewing up resources until it is manually aborted. ", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-01T15:28:57.000+0000", "updated": "2012-10-01T15:28:57.000+0000" }, { "id": "221627", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Got a few other devs to test more complex apps and all looks good with the xml parsing and new error output.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-01T19:51:14.000+0000", "updated": "2012-10-01T19:51:14.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }