{ "id": "161378", "key": "TIMOB-23562", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2016-07-15T06:50:17.000+0000", "created": "2016-06-27T16:47:43.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "file", "tempdirectory" ], "versions": [ { "id": "17707", "name": "Release 5.3.0", "archived": false, "released": true, "releaseDate": "2016-06-04" } ], "issuelinks": [ { "id": "52109", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "155117", "key": "TIMOB-20470", "fields": { "summary": "Android 6.0 (Post 5.2.0 SDK): java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)", "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" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2017-03-24T18:27:48.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": "h6.Description\r\nCan not read tempDirectory file without External storage permissions.\r\n\r\nh6.Steps to Reproduce:\r\n1. Create a classic project.\r\n2. Paste this code on app.js file.\r\n3. Run it on android 6 device.\r\n\r\nh6.Test Case\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : '#ffffff'\r\n});\r\nvar button = Ti.UI.createButton({\r\n\ttop : 10,\r\n\twidth : 200,\r\n\theight : 50,\r\n\ttitle : \"Read files\"\r\n});\r\nwin.add(button);\r\n\r\nvar f = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, 'fileter.txt');\r\nf.write('writing to the file would be enough to create it');\r\n\r\nbutton.addEventListener('click', function(e) {\r\n\talert(f.read());\r\n\r\n});\r\n\r\nwin.open();\r\n\r\n{code}\r\n{code:title=error}\r\n[ERROR] : SensorManager: uid = 10318\r\n[INFO] : SensorManager: registerListenerImpl: listener = android.view.OrientationEventListener$SensorEventListenerImpl@33dd978, sensor = {Sensor name=\"Accelerometer Sensor\", vendor=\"HTC Group Ltd.\", version=1, type=1, maxRange=19.6133, resolution=0.01, power=0.17, minDelay=10000}, delay = 200000, handler = null\r\n[ERROR] : TiFileProxy: (KrollRuntimeThread) [6877,6877] IOException encountered\r\n[ERROR] : TiFileProxy: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.a.permision/cache/_tmp/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiFileProxy: \tat libcore.io.IoBridge.open(IoBridge.java:452)\r\n[ERROR] : TiFileProxy: \tat java.io.FileOutputStream.(FileOutputStream.java:87)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.getOutputStream(TiFile.java:273)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.open(TiFile.java:336)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.write(TiFile.java:460)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiFileProxy.write(TiFileProxy.java:287)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356)\r\n[ERROR] : TiFileProxy: \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\n[ERROR] : TiFileProxy: \tat android.os.Looper.loop(Looper.java:168)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)\r\n[ERROR] : TiFileProxy: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiFileProxy: \tat libcore.io.Posix.open(Native Method)\r\n[ERROR] : TiFileProxy: \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)\r\n[ERROR] : TiFileProxy: \tat libcore.io.IoBridge.open(IoBridge.java:438)\r\n[ERROR] : TiFileProxy: \t... 13 more\r\n[ERROR] : TiBlob: (KrollRuntimeThread) [49,6926] /storage/emulated/0/Android/data/com.a.permision/cache/_tmp/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiBlob: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.a.permision/cache/_tmp/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiBlob: \tat libcore.io.IoBridge.open(IoBridge.java:452)\r\n[ERROR] : TiBlob: \tat java.io.FileInputStream.(FileInputStream.java:76)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.io.TiFile.getInputStream(TiFile.java:264)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.getInputStream(TiBlob.java:389)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:209)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.io.TiFile.read(TiFile.java:351)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiFileProxy.read(TiFileProxy.java:239)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356)\r\n[ERROR] : TiBlob: \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\n[ERROR] : TiBlob: \tat android.os.Looper.loop(Looper.java:168)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)\r\n[ERROR] : TiBlob: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiBlob: \tat libcore.io.Posix.open(Native Method)\r\n[ERROR] : TiBlob: \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)\r\n[ERROR] : TiBlob: \tat libcore.io.IoBridge.open(IoBridge.java:438)\r\n[ERROR] : TiBlob: \t... 17 more\r\n[ERROR] : TiBlob: (KrollRuntimeThread) [7,6933] /storage/emulated/0/Android/data/com.a.permision/cache/_tmp/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiBlob: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.a.permision/cache/_tmp/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiBlob: \tat libcore.io.IoBridge.open(IoBridge.java:452)\r\n[ERROR] : TiBlob: \tat java.io.FileInputStream.(FileInputStream.java:76)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.io.TiFile.getInputStream(TiFile.java:264)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.getInputStream(TiBlob.java:389)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.getBytes(TiBlob.java:324)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.getText(TiBlob.java:452)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.toString(TiBlob.java:511)\r\n[ERROR] : TiBlob: \tat ti.modules.titanium.TitaniumModule.alert(TitaniumModule.java:232)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356)\r\n[ERROR] : TiBlob: \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\n[ERROR] : TiBlob: \tat android.os.Looper.loop(Looper.java:168)\r\n[ERROR] : TiBlob: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)\r\n[ERROR] : TiBlob: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiBlob: \tat libcore.io.Posix.open(Native Method)\r\n[ERROR] : TiBlob: \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)\r\n[ERROR] : TiBlob: \tat libcore.io.IoBridge.open(IoBridge.java:438)\r\n[ERROR] : TiBlob: \t... 15 more\r\n\r\n{code}\r\n\r\n*Connected Android Devices*\r\nhtc_melsuhl\r\n State = device\r\n SDK Version = 6.0.1 (android-23)\r\n ABIs = armeabi-v7a, armeabi,\r\n\r\n\r\nThanks", "attachment": [ { "id": "59779", "filename": "First Click Event.jpg", "author": { "name": "nmishra", "key": "nmishra", "displayName": "Neeraj Mishra", "active": true, "timeZone": "America/Phoenix" }, "created": "2016-07-13T00:19:09.000+0000", "size": 982613, "mimeType": "image/jpeg" }, { "id": "59778", "filename": "Second Click Event.jpg", "author": { "name": "nmishra", "key": "nmishra", "displayName": "Neeraj Mishra", "active": true, "timeZone": "America/Phoenix" }, "created": "2016-07-13T00:19:09.000+0000", "size": 1043269, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "Android 6.0: reading to tempDirectory fails without External storage permissions", "creator": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": " Ti SDK: 5.3.0.GA,\r\n CLI: 5.3.0\r\n Studio: 4.6.0\r\n Node: 4.4.4\r\n Android : htc_melsuhl (v6.0.1)\r\n\r\n ", "closedSprints": [ { "id": 678, "state": "closed", "name": "2016 Sprint 14 SDK", "startDate": "2016-07-02T00:25:57.921Z", "endDate": "2016-07-16T00:25:00.000Z", "completeDate": "2016-07-18T03:18:29.729Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "389347", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-06-29T02:26:32.000+0000", "updated": "2016-06-29T02:36:12.000+0000" }, { "id": "389352", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-06-29T02:36:59.000+0000", "updated": "2016-06-29T02:36:59.000+0000" }, { "id": "389476", "author": { "name": "arohini", "key": "arohini", "displayName": "Ajith Rohini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~Ricardo][~sliang], Can one of you guys please look into this and update ? ", "updateAuthor": { "name": "arohini", "key": "arohini", "displayName": "Ajith Rohini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-29T22:21:42.000+0000", "updated": "2016-06-29T22:21:42.000+0000" }, { "id": "390592", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Looks like there is a bug that is happening.\r\n\r\nIt first reads the writes the file. It works fine. But after that, the file gets removed... Perhaps it is being in the tempDirectory and it was being emptied.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-07-13T10:57:46.000+0000", "updated": "2016-07-13T10:57:46.000+0000" }, { "id": "390647", "author": { "name": "nmishra", "key": "nmishra", "displayName": "Neeraj Mishra", "active": true, "timeZone": "America/Phoenix" }, "body": "Hi [~cng]/[~msamah],\r\n\r\nCould you please provide an ETA on this?\r\n\r\nThanks", "updateAuthor": { "name": "nmishra", "key": "nmishra", "displayName": "Neeraj Mishra", "active": true, "timeZone": "America/Phoenix" }, "created": "2016-07-13T23:39:12.000+0000", "updated": "2016-07-13T23:39:12.000+0000" }, { "id": "390680", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-07-14T05:18:58.000+0000", "updated": "2016-07-14T05:18:58.000+0000" }, { "id": "390778", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Will say that the example in this ticket is not the best example to use tempDirectory.\r\nRelated links:\r\n[https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem-property-tempDirectory]\r\n[https://github.com/appcelerator/titanium_mobile/blob/23c9e3fb93694950d33a8b4b79fbb2129ff9001b/android/runtime/common/src/java/org/appcelerator/kroll/util/TiTempFileHelper.java#L24-L28]\r\n\r\nThe temp files are cleared at the start, when restarted and when it is deemed necessary. In this example, the file is created before the window opens. After the window opens, the file is cleared out as it is temporary.\r\n\r\nInstead if you were to use this:\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : '#ffffff'\r\n});\r\nvar button = Ti.UI.createButton({\r\n\ttop : 10,\r\n\twidth : 200,\r\n\theight : 50,\r\n\ttitle : \"Read files\"\r\n});\r\nwin.add(button);\r\n\r\nvar button2 = Ti.UI.createButton({\r\n\ttop : 100,\r\n\twidth : 200,\r\n\theight : 50,\r\n\ttitle : \"Create file\"\r\n});\r\nwin.add(button2);\r\n \r\n\r\n \r\nbutton2.addEventListener('click', function(e) {\r\n\tvar f = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, 'fileter.txt');\r\n\tf.write('writing to the file would be enough to create it');\r\n \r\n});\r\nbutton.addEventListener('click', function(e) {\r\n\tvar ss = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, 'fileter.txt');\r\n\talert(ss.read() + ' - '+ Ti.Filesystem.tempDirectory);\r\n \r\n});\r\n \r\nwin.open();\r\n{code}\r\nThe file will stay there till the app restarts. It is a tempDirectory, thus it's only temporary.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-07-15T06:49:54.000+0000", "updated": "2016-07-15T06:49:54.000+0000" }, { "id": "390779", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Will be resolving this issue as it's behaving as expected.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-07-15T06:50:08.000+0000", "updated": "2016-07-15T06:50:08.000+0000" }, { "id": "415678", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate with reference to the linked issues.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T18:27:48.000+0000", "updated": "2017-03-24T18:27:48.000+0000" } ], "maxResults": 21, "total": 21, "startAt": 0 } } }