{"action":"created","issue":{"url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/issues/1440","repository_url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx","labels_url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/issues/1440/labels{/name}","comments_url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/issues/1440/comments","events_url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/issues/1440/events","html_url":"https://github.com/SonarOpenCommunity/sonar-cxx/issues/1440","id":308036561,"number":1440,"title":"Handle multiple \"stack\" nodes for errors in Valgrind XML report files","user":{"login":"jhoussay","id":37700528,"avatar_url":"https://avatars3.githubusercontent.com/u/37700528?v=4","gravatar_id":"","url":"https://api.github.com/users/jhoussay","html_url":"https://github.com/jhoussay","followers_url":"https://api.github.com/users/jhoussay/followers","following_url":"https://api.github.com/users/jhoussay/following{/other_user}","gists_url":"https://api.github.com/users/jhoussay/gists{/gist_id}","starred_url":"https://api.github.com/users/jhoussay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhoussay/subscriptions","organizations_url":"https://api.github.com/users/jhoussay/orgs","repos_url":"https://api.github.com/users/jhoussay/repos","events_url":"https://api.github.com/users/jhoussay/events{/privacy}","received_events_url":"https://api.github.com/users/jhoussay/received_events","type":"User","site_admin":false},"labels":[{"id":15973035,"url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":{"login":"guwirth","id":6077367,"avatar_url":"https://avatars0.githubusercontent.com/u/6077367?v=4","gravatar_id":"","url":"https://api.github.com/users/guwirth","html_url":"https://github.com/guwirth","followers_url":"https://api.github.com/users/guwirth/followers","following_url":"https://api.github.com/users/guwirth/following{/other_user}","gists_url":"https://api.github.com/users/guwirth/gists{/gist_id}","starred_url":"https://api.github.com/users/guwirth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guwirth/subscriptions","organizations_url":"https://api.github.com/users/guwirth/orgs","repos_url":"https://api.github.com/users/guwirth/repos","events_url":"https://api.github.com/users/guwirth/events{/privacy}","received_events_url":"https://api.github.com/users/guwirth/received_events","type":"User","site_admin":false},"assignees":[{"login":"guwirth","id":6077367,"avatar_url":"https://avatars0.githubusercontent.com/u/6077367?v=4","gravatar_id":"","url":"https://api.github.com/users/guwirth","html_url":"https://github.com/guwirth","followers_url":"https://api.github.com/users/guwirth/followers","following_url":"https://api.github.com/users/guwirth/following{/other_user}","gists_url":"https://api.github.com/users/guwirth/gists{/gist_id}","starred_url":"https://api.github.com/users/guwirth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guwirth/subscriptions","organizations_url":"https://api.github.com/users/guwirth/orgs","repos_url":"https://api.github.com/users/guwirth/repos","events_url":"https://api.github.com/users/guwirth/events{/privacy}","received_events_url":"https://api.github.com/users/guwirth/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/milestones/11","html_url":"https://github.com/SonarOpenCommunity/sonar-cxx/milestone/11","labels_url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/milestones/11/labels","id":2922209,"number":11,"title":"1.0","description":"","creator":{"login":"guwirth","id":6077367,"avatar_url":"https://avatars0.githubusercontent.com/u/6077367?v=4","gravatar_id":"","url":"https://api.github.com/users/guwirth","html_url":"https://github.com/guwirth","followers_url":"https://api.github.com/users/guwirth/followers","following_url":"https://api.github.com/users/guwirth/following{/other_user}","gists_url":"https://api.github.com/users/guwirth/gists{/gist_id}","starred_url":"https://api.github.com/users/guwirth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guwirth/subscriptions","organizations_url":"https://api.github.com/users/guwirth/orgs","repos_url":"https://api.github.com/users/guwirth/repos","events_url":"https://api.github.com/users/guwirth/events{/privacy}","received_events_url":"https://api.github.com/users/guwirth/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":37,"state":"open","created_at":"2017-11-19T07:55:13Z","updated_at":"2018-04-20T05:35:47Z","due_on":"2018-02-28T08:00:00Z","closed_at":null},"comments":8,"created_at":"2018-03-23T13:50:35Z","updated_at":"2018-04-20T05:35:47Z","closed_at":"2018-04-20T05:35:46Z","author_association":"NONE","body":"Hi,\r\n\r\nFor some Valgrind errors (such as \"InvalidWrite\"), the corresponding XML node contains two distinct \"stack\" nodes, one corresponding to the allocation stack and the other one corresponding to the memory misuse stack.\r\n\r\nUnfortunately, sonar cxx only presents the content of one \"stack'\" node found in the \"error\" node. In my case, this is pretty annoying as the stack available in Sonar is the allocation stack and does not allow easy identication of the memory misuse.\r\n\r\nIt seems to come from the `parseErrorTag `method in [ValgrindReportParser.java](https://github.com/SonarOpenCommunity/sonar-cxx/blob/master/cxx-sensors/src/main/java/org/sonar/cxx/sensors/valgrind/ValgrindReportParser.java). When multiple \"stack\" nodes are contained in the \"error\" node, only the last one is kept:\r\n```java\r\nString kind = null;\r\nString text = null;\r\nValgrindStack stack = null;\r\nwhile (child.getNext() != null) {\r\n   String tagName = child.getLocalName();\r\n    if (\"kind\".equalsIgnoreCase(tagName)) {\r\n      kind = child.getElemStringValue();\r\n    } else if (\"xwhat\".equalsIgnoreCase(tagName)) {\r\n      text = child.childElementCursor(\"text\").advance().getElemStringValue();\r\n    } else if (\"what\".equalsIgnoreCase(tagName)) {\r\n      text = child.getElemStringValue();\r\n    } else if (\"stack\".equalsIgnoreCase(tagName)) {\r\n      stack = parseStackTag(child);\r\n    }\r\n}\r\n\r\n[...]\r\n\r\nreturn new ValgrindError(kind, text, stack);\r\n```\r\n\r\nHandling multliple stacks at this point would require to do so in [ValgrindError.java](https://github.com/SonarOpenCommunity/sonar-cxx/blob/master/cxx-sensors/src/main/java/org/sonar/cxx/sensors/valgrind/ValgrindError.java) as well and modify the `getLastOwnFrame` method in order to provide the \"best\" stack origin...\r\n\r\nJulien"},"comment":{"url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/issues/comments/382982820","html_url":"https://github.com/SonarOpenCommunity/sonar-cxx/issues/1440#issuecomment-382982820","issue_url":"https://api.github.com/repos/SonarOpenCommunity/sonar-cxx/issues/1440","id":382982820,"user":{"login":"guwirth","id":6077367,"avatar_url":"https://avatars0.githubusercontent.com/u/6077367?v=4","gravatar_id":"","url":"https://api.github.com/users/guwirth","html_url":"https://github.com/guwirth","followers_url":"https://api.github.com/users/guwirth/followers","following_url":"https://api.github.com/users/guwirth/following{/other_user}","gists_url":"https://api.github.com/users/guwirth/gists{/gist_id}","starred_url":"https://api.github.com/users/guwirth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guwirth/subscriptions","organizations_url":"https://api.github.com/users/guwirth/orgs","repos_url":"https://api.github.com/users/guwirth/repos","events_url":"https://api.github.com/users/guwirth/events{/privacy}","received_events_url":"https://api.github.com/users/guwirth/received_events","type":"User","site_admin":false},"created_at":"2018-04-20T05:35:46Z","updated_at":"2018-04-20T05:35:46Z","author_association":"COLLABORATOR","body":"solved with #1461"}}
{"actor":{"display_login":"guwirth"}}