{ "id": "141434", "key": "AC-1474", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-08-07T02:59:09.000+0000", "created": "2014-12-10T23:05:10.000+0000", "labels": [ "TCSupportTriage", "android" ], "versions": [], "issuelinks": [], "assignee": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "updated": "2016-03-08T07:37:55.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "h2. Problem \r\n\r\nI've come across a nasty bug when using openPhotoGallery() where accessing the returned media.nativePath causes a NullPointException. Now, this only happens when the selected media, for some reason, appears to become a remote media (i.e. after automatic backup of Photo Gallery).\r\nEven weirder, if I use an ImageView to display the image, it is displayed correctly. Initially I hit the bug when trying to upload the selected image. I was then able to reproduce the bug with this minimal code:\r\n\r\nh2. Test case \r\n\r\n1. Create a new Default Alloy Project\r\n2. Replace the initial doClick() function, within index.js:\r\n\r\n{code:title=index.js}\r\nfunction doClick(e){\r\n\tTitanium.Media.openPhotoGallery({\r\n \tsuccess:function(event) {\r\n \t\ttry {\r\n \t\t\tTi.API.info('event.media.nativePath: ' + event.media.nativePath); \r\n \t\t}\r\n \t\tcatch(e) {\r\n \t\t\tTi.API.error(e.message);\r\n \t\t}\t\r\n Ti.API.info('event.media.file.nativePath: ' + event.media.file.nativePath); \r\n }\r\n\t});\r\n};\r\n\r\n$.index.open();\r\n\r\n{code}\r\n\r\n3. Select a picture (using Google Photos, now the default on Android L) that has been backed up to the Cloud\r\n\r\nh2. Logs \r\n\r\nOutput for a picture before it has been backed up / local picture:\r\n{code}\r\n[INFO] : event.media.nativePath: file:///storage/emulated/0/DCIM/Camera/IMG_20141210_232913.jpg\r\n[INFO] : event.media.file.nativePath: content://media/external/images/media/20559\r\n{code}\r\n\r\nOutput for a picture after it has been backed up / remote picture:\r\n{code}\r\n[ERROR] : Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference\r\n[INFO] : event.media.file.nativePath: content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh6.googleusercontent.com%2FxAiJOX8hSsSutQeA6X96og8RzpRo2PyOtWi_49FaNSMv%3Ds0-d\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "openPhotoGallery + Remote Image = NullPointerException", "creator": { "name": "felipekk", "key": "felipekk", "displayName": "Felipe Knaesel Koch", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "felipekk", "key": "felipekk", "displayName": "Felipe Knaesel Koch", "active": true, "timeZone": "Europe/Berlin" }, "environment": "TitaniumSDK 3.4.1GA\r\nAndroidSDK 16\r\nHardware Device Nexus 5 with Native Storage Encryption, running Android L", "comment": { "comments": [ { "id": "335895", "author": { "name": "felipekk", "key": "felipekk", "displayName": "Felipe Knaesel Koch", "active": true, "timeZone": "Europe/Berlin" }, "body": "I've searched through the QA and I've found this unanswered question, where the user seems to be having the same problem:\r\n\r\nhttp://developer.appcelerator.com/question/176856/nullpointerexception-when-uploading-a-file\r\n\r\nAs you can see, the cause of the problem seems to be trying to get the path of a remote image (either Picasa or backed up Google Photos).", "updateAuthor": { "name": "felipekk", "key": "felipekk", "displayName": "Felipe Knaesel Koch", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-12-10T23:06:45.000+0000", "updated": "2014-12-10T23:06:45.000+0000" }, { "id": "338698", "author": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I get the same crash while trying to resize an image with imageAsResized. I found a work around, by saving the image to the filesystem and reading it back in as a blob you are then able to use imageAsResized without a crash. Not 100% sure this is that same bug but it seems to be.", "updateAuthor": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-01-12T18:40:04.000+0000", "updated": "2015-01-12T18:40:04.000+0000" }, { "id": "341809", "author": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "That's the way to handle this: http://dimitar.me/how-to-get-picasa-images-using-the-image-picker-on-android-devices-running-any-os-version/\r\nI added something like this to titanium locally.", "updateAuthor": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2015-02-03T12:48:01.000+0000", "updated": "2015-02-03T12:48:01.000+0000" }, { "id": "347659", "author": { "name": "azago1", "key": "azago1", "displayName": "Aviram Zagorie", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi,\r\n\r\nI'm having the same issue. Any ETA on this fix or any advice on a workaround?\r\n\r\nThanks,\r\n\r\nAvi", "updateAuthor": { "name": "azago1", "key": "azago1", "displayName": "Aviram Zagorie", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-03-30T03:08:25.000+0000", "updated": "2015-03-30T03:08:25.000+0000" }, { "id": "349251", "author": { "name": "felipekk", "key": "felipekk", "displayName": "Felipe Knaesel Koch", "active": true, "timeZone": "Europe/Berlin" }, "body": "@grebulon Would you mind sharing your work around?\r\n\r\nYeah an ETA on this fix would be great since it's been four months already.", "updateAuthor": { "name": "felipekk", "key": "felipekk", "displayName": "Felipe Knaesel Koch", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-04-12T20:56:21.000+0000", "updated": "2015-04-12T20:56:21.000+0000" }, { "id": "349252", "author": { "name": "azago1", "key": "azago1", "displayName": "Aviram Zagorie", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I have a really hacky work around. It will break if Google changes the scheme for their content url.\r\n\r\n if(OS_ANDROID) {\r\n var regex = /content\\:\\/\\/com\\.google\\.android\\.apps\\.photos\\.content\\/\\d\\/(http.+)/i;\r\n \r\n var fileNativePath = event.media.file.nativePath;\r\n var match = fileNativePath.match(regex); \r\n \r\n if(match && match.length > 0) {\r\n var remoteImageUrl = decodeURIComponent(match[1]);\r\n imageView.setImage(remoteImageUrl);\r\n } else {\r\n imageView.setImage(event.media);\r\n }\r\n }", "updateAuthor": { "name": "azago1", "key": "azago1", "displayName": "Aviram Zagorie", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-12T21:19:57.000+0000", "updated": "2015-04-12T21:21:53.000+0000" }, { "id": "351129", "author": { "name": "andersdp", "key": "andersdp", "displayName": "Anders Dahl Pape", "active": true, "timeZone": "Europe/Berlin" }, "body": "@aviram Thanks! Using your work around now which works great for now.\r\n\r\nHope the bug gets fixed before the work around stops working.", "updateAuthor": { "name": "andersdp", "key": "andersdp", "displayName": "Anders Dahl Pape", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-04-29T12:09:52.000+0000", "updated": "2015-04-29T12:09:52.000+0000" }, { "id": "365659", "author": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~rtlechuga] Why was this closed as fixed?", "updateAuthor": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-10-02T13:57:44.000+0000", "updated": "2015-10-02T13:57:44.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }