{ "id": "84786", "key": "AC-2966", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2012-01-12T04:42:20.000+0000", "created": "2012-01-12T04:38:55.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2016-03-08T07:47:58.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\nThere seems to be a change in \"install\" method of \"Database\" object regarding path to Sqlite file.\r\n\r\n\r\nFrom Titanium API documentation: https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Database.install-method.html\r\n\r\n\"the path (relative to the main application Resources folder at build time) to the db to install\"\r\n\r\n\r\nIn 1.7.6 I used path without starting \"/\". From 1.8.0.1 that does not work anymore, starting \"/\" must be present and it seems to me that included file path is relative to current JS file if starting \"/\" is not present. That can be seen with test case bellow.\r\n\r\n\r\nI'm not sure is that a bug or a feature, but it should be mentioned in docs in any case. :)\r\n\r\n\r\nh2. Test case\r\n\r\n{code:lang=javascript|title=app.js}\r\nTi.include('/db/install.js');\r\n{code}\r\n\r\n{code:lang=javascript|title=db/install.js}\r\nTi.Database.install('test.sqlite', 'test_db');\r\n{code}\r\n\r\n\"test.sqlite\" is included as attachment and it has to be located in \"Resources\" directory.\r\n\r\n\r\nCompile this simple example with 1.7.6 and it will work, while it will fail with latest 1.9 (or 1.8.0.1).\r\n\r\nh2. Logs\r\n\r\n{code:lang=none|title=console}\r\n01-12 13:17:10.634: E/TiApplication(4810): (KrollRuntimeThread) [269,362] APP PROXY: ti.modules.titanium.app.AppModule@408e9fc8\r\n01-12 13:17:10.714: E/TiDatabase(4810): (KrollRuntimeThread) [78,440] Error installing database: test_db msg=Resources/db/test.sqlite\r\n01-12 13:17:10.714: E/TiDatabase(4810): java.io.FileNotFoundException: Resources/db/test.sqlite\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat android.content.res.AssetManager.openAsset(Native Method)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat android.content.res.AssetManager.open(AssetManager.java:315)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat android.content.res.AssetManager.open(AssetManager.java:289)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat org.appcelerator.titanium.io.TiResourceFile.getInputStream(TiResourceFile.java:63)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat ti.modules.titanium.database.DatabaseModule.install(DatabaseModule.java:126)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:105)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:207)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:125)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat android.os.Looper.loop(Looper.java:132)\r\n01-12 13:17:10.714: E/TiDatabase(4810): \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:102)\r\n01-12 13:17:10.784: E/TiJSError(4810): (main) [65,505] ----- Titanium Javascript Runtime Error -----\r\n01-12 13:17:10.784: E/TiJSError(4810): (main) [0,505] - In ti:/invoker.js:92,19\r\n01-12 13:17:10.784: E/TiJSError(4810): (main) [0,505] - Message: Uncaught Error: Resources/db/test.sqlite\r\n01-12 13:17:10.784: E/TiJSError(4810): (main) [0,505] - Source: \t\treturn delegate.apply(invoker.__thisObj__, args);\r\n01-12 13:17:10.814: D/dalvikvm(4810): GC_FOR_ALLOC freed 156K, 6% free 6528K/6919K, paused 22ms\r\n01-12 13:17:10.814: I/dalvikvm-heap(4810): Grow heap (frag case) to 6.972MB for 513744-byte allocation\r\n01-12 13:17:10.834: D/dalvikvm(4810): GC_FOR_ALLOC freed 4K, 6% free 7025K/7431K, paused 22ms\r\n01-12 13:17:10.864: E/V8Exception(4810): Exception occurred at ti:/invoker.js:92: Uncaught Error: Resources/db/test.sqlite\r\n{code}\r\n\r\nh2. Discussions\r\n\r\nhttp://developer.appcelerator.com/question/130001/ics-error---tiinvokerjs-uncaught-error", "attachment": [ { "id": "25025", "filename": "test.sqlite", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-01-12T04:38:55.000+0000", "size": 98304, "mimeType": "application/octet-stream" } ], "flagged": false, "summary": "Android: Database - Incompatible change in SQLite file path argument of \"install\" method between 1.7.6 and 1.9", "creator": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "* Titanium SDK version: 1.7.6 (12/20/11 13:01 158a892), Titanium SDK version: 1.9.0 (01/11/12 23:31 0ce1cf7) - v8 runtime\r\n* Android 3.1\r\n* Thinkpad tablet\r\n* Windows XP\r\n", "comment": { "comments": [ { "id": "179026", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Thanks for this, Ivan. We are actually currently working on improving the apidocs on this. See TIMOB-4202.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-12T04:42:20.000+0000", "updated": "2012-01-12T04:42:20.000+0000" }, { "id": "179029", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "OK, great. I'll put a reference to this ticket because, when calling \"install\" method, if path is not written as absolute (if it does not start with \"/\"), starting point won't be \"Resources\" directory, but directory in which JS file that calls \"install\" is located (that's not mentioned there).", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-01-12T04:53:07.000+0000", "updated": "2012-01-12T04:53:07.000+0000" }, { "id": "281033", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "DUP issue. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2013-11-24T22:30:04.000+0000", "updated": "2013-11-24T22:30:04.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }