{ "id": "82625", "key": "TIMOB-6940", "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": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-07-21T20:59:07.000+0000", "created": "2011-11-11T08:21:52.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "tbs-1.8.2" ], "versions": [ { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-07-21T20:59:07.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": "h2. Problem\r\n\r\nI write this code to clean built-in remote images cache on sd-card, it works, but if I exit app with back button or with activity.finish(), at the next restart all images in my tableview are broken (empty), like the app don't recognize that cache file is missing.\r\n\r\nI need to kill app with task killer to have all works fine again.\r\n\r\nh2. Test case\r\n\r\n{code:lang=javascript|title=app.js}\r\n// delete cache files\r\nvar dir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory); \r\nvar cache_folder = dir.nativePath.toString()+'/remote-image-cache';\r\nvar deldir = Titanium.Filesystem.getFile(cache_folder); \r\ndeldir.deleteDirectory(true);\r\n\r\n// exit app\r\nvar activity = Titanium.Android.currentActivity;\r\nactivity.finish();\r\n{code} \r\n\r\nNote that there is no issue with manually deleting (from adb shell) all files in {{/mnt/sdcard/(app folder)/remote-image-cache}}.\r\n\r\nh2. Workaround\r\n\r\nTitanium fails if dir remote-image-cache isn't found, so inserting a deldir.createDirectory(); after deldir.deleteDirectory(true); can be used as a workaround:\r\n\r\n{code:lang=javascript|title=app.js}\r\n// delete cache files\r\nvar dir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory); \r\nvar cache_folder = dir.nativePath.toString()+'/remote-image-cache';\r\nvar deldir = Titanium.Filesystem.getFile(cache_folder); \r\ndeldir.deleteDirectory(true);\r\ndeldir.createDirectory();\r\n\r\n// exit app\r\nvar activity = Titanium.Android.currentActivity;\r\nactivity.finish();\r\n{code} \r\n", "attachment": [], "flagged": false, "summary": "Android: Remote image cache does not recognize missing files after activity.finish() and restart", "creator": { "name": "mmorselli", "key": "mmorselli", "displayName": "Massimo Morselli", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mmorselli", "key": "mmorselli", "displayName": "Massimo Morselli", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "* Titanium SDK version: 1.8.0, v20111110184258-win32\r\n* Javascript Engine: Rhino\r\n* Platform & version: Android 2.3\r\n* Device Details: Android emulator and HTC Desire\r\n* Host Operating System: Windows7/64 SP1\r\n* Titanium Studio version: build: 1.0.2.201107130739 - Build date: 13 July 2011, 07:42:08", "comment": { "comments": [ { "id": "172430", "author": { "name": "mmorselli", "key": "mmorselli", "displayName": "Massimo Morselli", "active": true, "timeZone": "America/Los_Angeles" }, "body": "well, seems that Titanium fails if dir remote-image-cache isn't found, so a deldir.createDirectory(); after deldir.deleteDirectory(true); can be a workaround.", "updateAuthor": { "name": "mmorselli", "key": "mmorselli", "displayName": "Massimo Morselli", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-12T20:10:47.000+0000", "updated": "2011-11-12T20:10:47.000+0000" }, { "id": "177677", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Massimo\r\n\r\nThanks for raising this ticket. Please note my changes, to allow it to be escalated.\r\n\r\nWould you mind completing the environment field, in accordance with the [JIRA Ticket Checklist|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist]? Once this is done, I can move it to the main project.\r\n\r\nThank you", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-29T18:33:57.000+0000", "updated": "2011-12-29T18:33:57.000+0000" }, { "id": "177682", "author": { "name": "mmorselli", "key": "mmorselli", "displayName": "Massimo Morselli", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Done, sorry ;-)", "updateAuthor": { "name": "mmorselli", "key": "mmorselli", "displayName": "Massimo Morselli", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-29T18:55:52.000+0000", "updated": "2011-12-29T18:55:52.000+0000" }, { "id": "177695", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Thank you, Massimo. No need to apologise. :)\r\n\r\nDo you really think it is unreasonable for the app to behave this way? Rather than deleting the directory, have you tried deleting just its contents?\r\n\r\nAnyway, I will move this over to the main project, so we can see what our engineering team says. :)", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-30T02:39:32.000+0000", "updated": "2011-12-30T02:39:32.000+0000" }, { "id": "177696", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Massimo\r\n\r\nWould you verify whether or not this issue is still happening with the latest 1.8.0.1 release?\r\n\r\nThank you", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-30T02:42:47.000+0000", "updated": "2011-12-30T02:42:47.000+0000" }, { "id": "177786", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Massimo\r\n\r\nPlease respond my previous comment.\r\n\r\nThanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-02T14:07:54.000+0000", "updated": "2012-01-02T14:07:54.000+0000" }, { "id": "177795", "author": { "name": "mmorselli", "key": "mmorselli", "displayName": "Massimo Morselli", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Sorry, but I'm not near my PC for the next 3 days, so I can't do nothing. I will try it as soon as possible at my return", "updateAuthor": { "name": "mmorselli", "key": "mmorselli", "displayName": "Massimo Morselli", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-02T20:35:31.000+0000", "updated": "2012-01-02T20:35:31.000+0000" }, { "id": "424546", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing due to inactivity. If this issue still exists, please raise a new ticket", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-07-21T20:59:07.000+0000", "updated": "2017-07-21T20:59:07.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }