{"action":"closed","issue":{"url":"https://api.github.com/repos/snowplow/snowplow-android-tracker/issues/143","labels_url":"https://api.github.com/repos/snowplow/snowplow-android-tracker/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/snowplow/snowplow-android-tracker/issues/143/comments","events_url":"https://api.github.com/repos/snowplow/snowplow-android-tracker/issues/143/events","html_url":"https://github.com/snowplow/snowplow-android-tracker/issues/143","id":96051966,"number":143,"title":"Core: fix issue with Events sharing one context object.","user":{"login":"jbeemster","id":7984544,"avatar_url":"https://avatars.githubusercontent.com/u/7984544?v=3","gravatar_id":"","url":"https://api.github.com/users/jbeemster","html_url":"https://github.com/jbeemster","followers_url":"https://api.github.com/users/jbeemster/followers","following_url":"https://api.github.com/users/jbeemster/following{/other_user}","gists_url":"https://api.github.com/users/jbeemster/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeemster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeemster/subscriptions","organizations_url":"https://api.github.com/users/jbeemster/orgs","repos_url":"https://api.github.com/users/jbeemster/repos","events_url":"https://api.github.com/users/jbeemster/events{/privacy}","received_events_url":"https://api.github.com/users/jbeemster/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/snowplow/snowplow-android-tracker/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"jbeemster","id":7984544,"avatar_url":"https://avatars.githubusercontent.com/u/7984544?v=3","gravatar_id":"","url":"https://api.github.com/users/jbeemster","html_url":"https://github.com/jbeemster","followers_url":"https://api.github.com/users/jbeemster/followers","following_url":"https://api.github.com/users/jbeemster/following{/other_user}","gists_url":"https://api.github.com/users/jbeemster/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeemster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeemster/subscriptions","organizations_url":"https://api.github.com/users/jbeemster/orgs","repos_url":"https://api.github.com/users/jbeemster/repos","events_url":"https://api.github.com/users/jbeemster/events{/privacy}","received_events_url":"https://api.github.com/users/jbeemster/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/snowplow/snowplow-android-tracker/milestones/8","html_url":"https://github.com/snowplow/snowplow-android-tracker/milestones/Version%200.5.0","labels_url":"https://api.github.com/repos/snowplow/snowplow-android-tracker/milestones/8/labels","id":943860,"number":8,"title":"Version 0.5.0","description":"","creator":{"login":"alexanderdean","id":200511,"avatar_url":"https://avatars.githubusercontent.com/u/200511?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderdean","html_url":"https://github.com/alexanderdean","followers_url":"https://api.github.com/users/alexanderdean/followers","following_url":"https://api.github.com/users/alexanderdean/following{/other_user}","gists_url":"https://api.github.com/users/alexanderdean/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderdean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderdean/subscriptions","organizations_url":"https://api.github.com/users/alexanderdean/orgs","repos_url":"https://api.github.com/users/alexanderdean/repos","events_url":"https://api.github.com/users/alexanderdean/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderdean/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":26,"state":"open","created_at":"2015-01-20T16:59:09Z","updated_at":"2015-07-28T14:08:50Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-07-20T12:17:17Z","updated_at":"2015-07-28T14:08:49Z","closed_at":"2015-07-28T14:08:49Z","body":"The Event builder is returning a single pointer to a context object, so Ecommerce Items end up sharing one context to the effect that if you process one item and update the context, this is reflected in the next item and so on.  To fix this the Event class must pass a `new ArrayList<>(the context)` each time it is fetched so we do not end up with one context in memory.\r\n\r\nAs you can see contexts have been added multiple times:\r\n\r\n```json\r\n\"{\r\n    \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/contexts\\\\/jsonschema\\\\/1-0-1\\\",\r\n    \\\"data\\\": [\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/client_session\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"storageMechanism\\\": \\\"SQLITE\\\",\r\n                \\\"sessionIndex\\\": 48,\r\n                \\\"sessionId\\\": \\\"255403fc-6c76-4661-a9ee-bfc0961b5ac3\\\",\r\n                \\\"userId\\\": \\\"b8cfca3a-6156-4b96-8518-de94d4fa88de\\\",\r\n                \\\"previousSessionId\\\": \\\"6ad87afa-b774-442a-a80c-b44157f94097\\\"\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/geolocation_context\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"bearing\\\": 0,\r\n                \\\"altitude\\\": 0,\r\n                \\\"latitude\\\": 47.3235597,\r\n                \\\"speed\\\": 0,\r\n                \\\"latitudeLongitudeAccuracy\\\": 20,\r\n                \\\"longitude\\\": 5.0383196\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/mobile_context\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"osVersion\\\": \\\"5.0.2\\\",\r\n                \\\"deviceModel\\\": \\\"A0001\\\",\r\n                \\\"androidIdfa\\\": \\\"fc3ca7a9-82c9-4961-a93c-282fb7da9954\\\",\r\n                \\\"deviceManufacturer\\\": \\\"OnePlus\\\",\r\n                \\\"osType\\\": \\\"android\\\",\r\n                \\\"carrier\\\": \\\"Free\\\"\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/client_session\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"storageMechanism\\\": \\\"SQLITE\\\",\r\n                \\\"sessionIndex\\\": 48,\r\n                \\\"sessionId\\\": \\\"255403fc-6c76-4661-a9ee-bfc0961b5ac3\\\",\r\n                \\\"userId\\\": \\\"b8cfca3a-6156-4b96-8518-de94d4fa88de\\\",\r\n                \\\"previousSessionId\\\": \\\"6ad87afa-b774-442a-a80c-b44157f94097\\\"\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/geolocation_context\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"bearing\\\": 0,\r\n                \\\"altitude\\\": 0,\r\n                \\\"latitude\\\": 47.3235597,\r\n                \\\"speed\\\": 0,\r\n                \\\"latitudeLongitudeAccuracy\\\": 20,\r\n                \\\"longitude\\\": 5.0383196\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/mobile_context\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"osVersion\\\": \\\"5.0.2\\\",\r\n                \\\"deviceModel\\\": \\\"A0001\\\",\r\n                \\\"androidIdfa\\\": \\\"fc3ca7a9-82c9-4961-a93c-282fb7da9954\\\",\r\n                \\\"deviceManufacturer\\\": \\\"OnePlus\\\",\r\n                \\\"osType\\\": \\\"android\\\",\r\n                \\\"carrier\\\": \\\"Free\\\"\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/client_session\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"storageMechanism\\\": \\\"SQLITE\\\",\r\n                \\\"sessionIndex\\\": 48,\r\n                \\\"sessionId\\\": \\\"255403fc-6c76-4661-a9ee-bfc0961b5ac3\\\",\r\n                \\\"userId\\\": \\\"b8cfca3a-6156-4b96-8518-de94d4fa88de\\\",\r\n                \\\"previousSessionId\\\": \\\"6ad87afa-b774-442a-a80c-b44157f94097\\\"\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/geolocation_context\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"bearing\\\": 0,\r\n                \\\"altitude\\\": 0,\r\n                \\\"latitude\\\": 47.3235597,\r\n                \\\"speed\\\": 0,\r\n                \\\"latitudeLongitudeAccuracy\\\": 20,\r\n                \\\"longitude\\\": 5.0383196\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/mobile_context\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"osVersion\\\": \\\"5.0.2\\\",\r\n                \\\"deviceModel\\\": \\\"A0001\\\",\r\n                \\\"androidIdfa\\\": \\\"fc3ca7a9-82c9-4961-a93c-282fb7da9954\\\",\r\n                \\\"deviceManufacturer\\\": \\\"OnePlus\\\",\r\n                \\\"osType\\\": \\\"android\\\",\r\n                \\\"carrier\\\": \\\"Free\\\"\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/client_session\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"storageMechanism\\\": \\\"SQLITE\\\",\r\n                \\\"sessionIndex\\\": 48,\r\n                \\\"sessionId\\\": \\\"255403fc-6c76-4661-a9ee-bfc0961b5ac3\\\",\r\n                \\\"userId\\\": \\\"b8cfca3a-6156-4b96-8518-de94d4fa88de\\\",\r\n                \\\"previousSessionId\\\": \\\"6ad87afa-b774-442a-a80c-b44157f94097\\\"\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/geolocation_context\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"bearing\\\": 0,\r\n                \\\"altitude\\\": 0,\r\n                \\\"latitude\\\": 47.3235597,\r\n                \\\"speed\\\": 0,\r\n                \\\"latitudeLongitudeAccuracy\\\": 20,\r\n                \\\"longitude\\\": 5.0383196\r\n            }\r\n        },\r\n        {\r\n            \\\"schema\\\": \\\"iglu: com.snowplowanalytics.snowplow\\\\/mobile_context\\\\/jsonschema\\\\/1-0-0\\\",\r\n            \\\"data\\\": {\r\n                \\\"osVersion\\\": \\\"5.0.2\\\",\r\n                \\\"deviceModel\\\": \\\"A0001\\\",\r\n                \\\"androidIdfa\\\": \\\"fc3ca7a9-82c9-4961-a93c-282fb7da9954\\\",\r\n                \\\"deviceManufacturer\\\": \\\"OnePlus\\\",\r\n                \\\"osType\\\": \\\"android\\\",\r\n                \\\"carrier\\\": \\\"Free\\\"\r\n            }\r\n        }\r\n    ]\r\n}\"\r\n```"}}