{"action":"created","issue":{"url":"https://api.github.com/repos/square/spoon/issues/312","repository_url":"https://api.github.com/repos/square/spoon","labels_url":"https://api.github.com/repos/square/spoon/issues/312/labels{/name}","comments_url":"https://api.github.com/repos/square/spoon/issues/312/comments","events_url":"https://api.github.com/repos/square/spoon/issues/312/events","html_url":"https://github.com/square/spoon/issues/312","id":125965395,"number":312,"title":"java.lang.IllegalStateException: Couldn't match exception header.","user":{"login":"Dupleks","id":5922181,"avatar_url":"https://avatars.githubusercontent.com/u/5922181?v=3","gravatar_id":"","url":"https://api.github.com/users/Dupleks","html_url":"https://github.com/Dupleks","followers_url":"https://api.github.com/users/Dupleks/followers","following_url":"https://api.github.com/users/Dupleks/following{/other_user}","gists_url":"https://api.github.com/users/Dupleks/gists{/gist_id}","starred_url":"https://api.github.com/users/Dupleks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dupleks/subscriptions","organizations_url":"https://api.github.com/users/Dupleks/orgs","repos_url":"https://api.github.com/users/Dupleks/repos","events_url":"https://api.github.com/users/Dupleks/events{/privacy}","received_events_url":"https://api.github.com/users/Dupleks/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/square/spoon/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-01-11T15:12:05Z","updated_at":"2016-08-06T01:56:02Z","closed_at":null,"body":"Hello, I faced this issue on Genymotion Galaxy Nexus - Android 4.3 - 720x1280. \r\n```\r\n    at com.squareup.spoon.misc.StackTrace.acceptTrace(StackTrace.java:85)\r\n    at com.squareup.spoon.misc.StackTrace.from(StackTrace.java:56)\r\n    at com.squareup.spoon.DeviceTestResult$Builder.markTestAsFailed(DeviceTestResult.java:82)\r\n    at com.squareup.spoon.SpoonTestRunListener.testFailed(SpoonTestRunListener.java:51)\r\n    at com.android.ddmlib.testrunner.InstrumentationResultParser.reportResult(InstrumentationResultParser.java:461)\r\n    at com.android.ddmlib.testrunner.InstrumentationResultParser.parseStatusCode(InstrumentationResultParser.java:415)\r\n    at com.android.ddmlib.testrunner.InstrumentationResultParser.parse(InstrumentationResultParser.java:276)\r\n    at com.android.ddmlib.testrunner.InstrumentationResultParser.processNewLines(InstrumentationResultParser.java:247)\r\n    at com.android.ddmlib.MultiLineReceiver.addOutput(MultiLineReceiver.java:100)\r\n    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:522)\r\n    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:388)\r\n    at com.android.ddmlib.Device.executeShellCommand(Device.java:577)\r\n    at com.android.ddmlib.testrunner.RemoteAndroidTestRunner.run(RemoteAndroidTestRunner.java:263)\r\n    at com.squareup.spoon.SpoonDeviceRunner.run(SpoonDeviceRunner.java:229)\r\n    at com.squareup.spoon.SpoonDeviceRunner.main(SpoonDeviceRunner.java:381)\r\n```\r\nI am using spoon:spoon-gradle-plugin:1.0.3. Do you have any idea? \r\nThanks a lot. "},"comment":{"url":"https://api.github.com/repos/square/spoon/issues/comments/237999833","html_url":"https://github.com/square/spoon/issues/312#issuecomment-237999833","issue_url":"https://api.github.com/repos/square/spoon/issues/312","id":237999833,"user":{"login":"daj","id":739125,"avatar_url":"https://avatars.githubusercontent.com/u/739125?v=3","gravatar_id":"","url":"https://api.github.com/users/daj","html_url":"https://github.com/daj","followers_url":"https://api.github.com/users/daj/followers","following_url":"https://api.github.com/users/daj/following{/other_user}","gists_url":"https://api.github.com/users/daj/gists{/gist_id}","starred_url":"https://api.github.com/users/daj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daj/subscriptions","organizations_url":"https://api.github.com/users/daj/orgs","repos_url":"https://api.github.com/users/daj/repos","events_url":"https://api.github.com/users/daj/events{/privacy}","received_events_url":"https://api.github.com/users/daj/received_events","type":"User","site_admin":false},"created_at":"2016-08-06T01:56:02Z","updated_at":"2016-08-06T01:56:02Z","body":"Thanks for the pointer!  You're right, the issue is because we're manipulating the stack trace.  I wrote a unit test that reproduced the problem:\r\nhttps://github.com/daj/spoon/commit/5bb4fdf3126ca529b38b3e989ce63c2f89ff25bb\r\n\r\nOur manipulated stack trace fails to match the Spoon exception header validation in [StackTrace.java](https://github.com/square/spoon/blob/0e7361ea1c2926d3953a37a4f62357bc94dde3e2/spoon-runner/src/main/java/com/squareup/spoon/misc/StackTrace.java#L85):\r\n```\r\n  private static final Pattern HEADER = Pattern.compile(\"(?:Caused by: )?([^:]+)(?::( .*)?)?\");\r\n<snip>\r\n    String header = messageParts.removeFirst();\r\n    Matcher headerMatch = HEADER.matcher(header);\r\n    if (!headerMatch.matches()) {\r\n      throw new IllegalStateException(\"Couldn't match exception header.\");\r\n    }\r\n```\r\nIt's unfortunate that this IllegalStateException stops the rest of the Spoon test report from being generated (or it stops the test suite from running there - I forget which), but I can see the argument for failing fast.\r\n\r\nIn the short term I'll probably try to massage our custom assertions so they match the stack trace format that Spoon accepts.  Thanks again!"}}
{"actor":{"display_login":"daj"}}