{ "id": "145937", "key": "TIMOB-18887", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16723", "description": "Windows Platform Support, ListView updates, Vector overlays in maps", "name": "Release 4.1.0", "archived": false, "released": true, "releaseDate": "2015-07-08" }, { "id": "16878", "description": "Release 4.0.1", "name": "Release 4.0.1", "archived": false, "released": true, "releaseDate": "2017-02-06" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-05-20T22:15:43.000+0000", "created": "2015-03-19T14:23:17.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android-5" ], "versions": [], "issuelinks": [ { "id": "48178", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "140610", "key": "TIMOB-18888", "fields": { "summary": "Android Lollipop problem cache with MediaPlayer", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2015-06-23T20:16:35.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "I was getting occasional crashes in my titanium module when downloading files using HttpUrlConnection on a Lollipop device. Tracing this to okhttp (the http client used in android 5), I posted a bug report (see: https://code.google.com/p/android/issues/detail?id=160522)\r\n\r\nThere is a bug in okhttp where they don't handle null pointer correctly, which is returned from TiCacheResponse.getHeaders() or its null key's value, but the fact is that it shouldn't return null in the first place. This all comes from the way the cached header's multimap assumes that the status is in the null key at position 0 (see: http://developer.android.com/reference/java/net/URLConnection.html#getHeaderFields%28%29)\r\n\r\nFor a full explanation of the cause see: https://code.google.com/p/android/issues/detail?id=160522#c5\r\n\r\nPartial stack dump of the problem:\r\n{quote}\r\n Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference\r\n java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference\r\n at com.android.okhttp.internal.http.StatusLine.(StatusLine.java:24)\r\n at com.android.okhttp.Response$Builder.statusLine(Response.java:419)\r\n at com.android.okhttp.internal.http.JavaApiConverter.createOkResponse(JavaApiConverter.java:116)\r\n at com.android.okhttp.internal.http.ResponseCacheAdapter.get(ResponseCacheAdapter.java:53)\r\n at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:269)\r\n at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)\r\n at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)\r\n at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)\r\n at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)\r\n at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)\r\n{quote}", "attachment": [], "flagged": false, "summary": "Android: Wrong implementation of TiResponseCache may cause occasional crashes in Lollipop", "creator": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "subtasks": [], "reporter": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "environment": "Titanium 3.5.1, Android 5.x", "closedSprints": [ { "id": 407, "state": "closed", "name": "2015 Sprint 11 SDK", "startDate": "2015-05-23T00:00:08.253Z", "endDate": "2015-06-06T00:00:00.000Z", "completeDate": "2015-06-08T16:18:16.381Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "346902", "author": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "More discussion of this issue here:\r\nhttps://github.com/square/okhttp/issues/1523\r\n\r\nAs for TiResponseCache, the problem starts at makeLowerCaseHeaders() where the implementation just throws away the null key-pair, instead of encoding it (say to a \"null=xxx\" string in the cache file).", "updateAuthor": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2015-03-22T07:55:18.000+0000", "updated": "2015-03-22T07:55:18.000+0000" }, { "id": "349306", "author": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "My fix is here:\r\n\r\nhttps://www.dropbox.com/s/z814rg68p8qz7ew/TiResponseCache.java?dl=0\r\n\r\nLook for hopflow comments in the code", "updateAuthor": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2015-04-13T12:40:26.000+0000", "updated": "2015-04-13T12:40:26.000+0000" }, { "id": "349943", "author": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Please resolve this issue soon probably with @grebulon's fix, before more devices get upgraded to Android Lollipop where the effects of this bug are more visible.", "updateAuthor": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2015-04-17T10:30:53.000+0000", "updated": "2015-04-17T10:30:53.000+0000" }, { "id": "352025", "author": { "name": "pravipravi", "key": "pravipravi", "displayName": "Praveen Kodakkad", "active": true, "timeZone": "America/Adak" }, "body": "Please resolve this issue ASAP.", "updateAuthor": { "name": "pravipravi", "key": "pravipravi", "displayName": "Praveen Kodakkad", "active": true, "timeZone": "America/Adak" }, "created": "2015-05-08T13:17:09.000+0000", "updated": "2015-05-08T13:17:09.000+0000" }, { "id": "352158", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~buddyguards] Thank you for the fix. Is it possible to submit it as a pull request? We can't accept it otherwise.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-05-11T16:06:22.000+0000", "updated": "2015-05-11T16:06:22.000+0000" }, { "id": "352238", "author": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "Ingo, my fix is a quick hack so that users can take it and quickly build it into titanium. It should be taken as a basis for a cleaner implementation.", "updateAuthor": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2015-05-12T06:45:50.000+0000", "updated": "2015-05-12T06:45:50.000+0000" }, { "id": "352555", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~buddyguards] Thank you for the fix. Your fix seems pretty straightforward, so I put together a PR for it: https://github.com/appcelerator/titanium_mobile/pull/6850. \r\nTest code:\r\n{code}\r\nvar vidWin = Titanium.UI.createWindow({\r\n title : 'Video View Demo',\r\n backgroundColor : '#fff'\r\n});\r\n \r\nvar videoPlayer = Titanium.Media.createVideoPlayer({\r\n top : 2,\r\n autoplay : true,\r\n backgroundColor : 'blue',\r\n height : 300,\r\n width : 300,\r\n mediaControlStyle : Titanium.Media.VIDEO_CONTROL_DEFAULT,\r\n scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT\r\n});\r\n \r\nvideoPlayer.url = 'http://techslides.com/demos/sample-videos/small.mp4';\r\nvidWin.add(videoPlayer);\r\nvidWin.open();\r\n{code}\r\n\r\n1. Run app, wait until video is finished (autoplay)\r\n2. Hit back button (close the app)\r\n3. Run app again, make sure video played properly\r\n", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-05-14T18:46:45.000+0000", "updated": "2015-05-14T21:08:39.000+0000" }, { "id": "353169", "author": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Can't this fix be put in the next immediate release rather than 4.1.0?", "updateAuthor": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2015-05-21T04:22:35.000+0000", "updated": "2015-05-21T04:22:35.000+0000" }, { "id": "353171", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I have marked it as such.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-05-21T05:05:14.000+0000", "updated": "2015-05-21T05:05:14.000+0000" }, { "id": "353260", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "4.0.X backport: https://github.com/appcelerator/titanium_mobile/pull/6868", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-05-21T20:49:55.000+0000", "updated": "2015-05-21T20:49:55.000+0000" }, { "id": "353925", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix by running the test case above.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.0.1.201505282200\r\nTi SDK : 4.0.1.v20150529150210, 4.1.0.v20150529013634\r\nCLI : 4.0.0\r\nAlloy : 1.6.0\r\nMAC Yosemite : 10.10.3\r\nAppc npm : 4.0.0\r\nAppc CLI : 4.0.1-rc\r\nNode: v0.10.37\r\nNexus 5 - Android 5.1.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-05-29T23:04:42.000+0000", "updated": "2015-05-29T23:04:42.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }