{ "id": "117011", "key": "TIMOB-14502", "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": "15547", "description": "2013 Sprint 14", "name": "2013 Sprint 14", "archived": true, "released": true, "releaseDate": "2013-07-15" }, { "id": "15548", "description": "2013 Sprint 14 API", "name": "2013 Sprint 14 API", "archived": true, "released": true, "releaseDate": "2013-07-15" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-07-12T22:43:22.000+0000", "created": "2013-07-09T20:34:02.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "module_androidmapv2", "qe-3.1.2", "qe-testadded" ], "versions": [], "issuelinks": [], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-02-26T19:00:05.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": "h5. Description:\r\nUsing our test app, I encountered a null pointer exception when using the removeAnnotations() method.\r\n\r\nI was unable to find an injection point, but tested my version 2.1.0 (might have been version 2.1.1 and overwrote 2.1.0 due to previous bug)\r\n\r\nh5. Sample code:\r\nUse this excerpt or module sample code\r\n{code}\r\n// Modified QE version of module sample code.\r\nvar MapModule = require('ti.map');\r\n\r\n\r\nvar win = Ti.UI.createWindow({backgroundColor:'black'});\r\nvar table = Ti.UI.createTableView();\r\nvar tableData = [];\r\n\r\nvar multiMapRow = Ti.UI.createTableViewRow({title: 'Multi Map'});\r\ntableData.push(multiMapRow);\r\nmultiMapRow.addEventListener('click', function(e) {\r\n multiMapTest();\r\n});\r\n\r\n\r\nvar annotationRow = Ti.UI.createTableViewRow({title:'Annotation Test'});\r\ntableData.push(annotationRow);\r\nannotationRow.addEventListener('click', function(e) {\r\n annotationTest();\r\n});\r\n\r\ntable.setData(tableData);\r\nwin.add(table);\r\nwin.open();\r\n\r\n/************************************************************************************/\r\n/************************************************************************************/\r\n\t\t\t\t\t\t\t\t\t//ANNOTATIONS\r\n/************************************************************************************/\r\nfunction annotationTest() {\r\nvar win = Ti.UI.createWindow({fullscreen: false});\r\nvar anno = MapModule.createAnnotation({latitude: -33.87365, image: 'map_pin.png', longitude: 151.20689, title: \"Sydney\", subtitle: \"Sydney is quite chill\", draggable: true});\r\nvar anno2 = MapModule.createAnnotation({latitude: -33.86365, pincolor: MapModule.ANNOTATION_BLUE, longitude: 151.21689, title: \"Anno2\", subtitle: \"Blue Draggable\", draggable: true});\r\nvar anno3 = MapModule.createAnnotation({latitude: -33.85365, longitude: 151.20689, title: \"Anno3\", subtitle: \"Not Draggable\", draggable: false});\r\nvar anno4 = MapModule.createAnnotation({latitude: -33.86365, longitude: 151.22689, title: \"Anno4\", subtitle: \"Draggable\", draggable: true});\r\n\r\nTi.API.info (\"====> Latitude should be: -33.87365 and is: \" + anno.latitude);\r\nTi.API.info (\"====> Longitude should be: 151.20689 and is: \" + anno.longitude);\r\nTi.API.info (\"====> Title should be Sydney and is: \" + anno.title);\r\nTi.API.info (\"====> Draggable should be true and is: \" + anno.draggable);\r\nTi.API.info (\"====> Draggable should be true and is: \" + anno.draggable);\r\n\r\nvar map = MapModule.createView({\r\n\tuserLocation: true,\r\n\tmapType: MapModule.NORMAL_TYPE,\r\n\tanimate: true,\r\n\tannotations: [anno, anno2, anno4],\r\n\tregion: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 }, //Sydney\r\n\ttop: '30%'\r\n});\r\nTi.API.info(\"====> userLocation: \" + map.userLocation);\r\nwin.add(map);\r\n\r\nvar button = Ti.UI.createButton({top: 0, left: 0, title: \"Go Mt. View\"});\r\nbutton.addEventListener('click', function(e) {\r\n\tmap.region = {latitude: 37.3689, longitude: -122.0353, latitudeDelta: 0.1, longitudeDelta: 0.1 }; //Mountain View\r\n});\r\n\r\nvar button2 = Ti.UI.createButton({top: '10%', title: \"add anno3\"});\r\nbutton2.addEventListener('click', function(e) {\r\n\tmap.addAnnotation(anno3);\r\n});\r\n\r\nvar button3 = Ti.UI.createButton({top: 0, title: \"rm anno3\"});\r\nbutton3.addEventListener('click', function(e) {\r\n\tmap.removeAnnotation(anno3);\r\n});\r\n\r\nvar button4 = Ti.UI.createButton({top: '20%', title: \"rm all\"});\r\nbutton4.addEventListener('click', function(e) {\r\n\tmap.removeAllAnnotations();\r\n});\r\n\r\nvar button5 = Ti.UI.createButton({top: '10%', left: 0, title: \"remove annos\"});\r\nbutton5.addEventListener('click', function(e) {\r\n\tTi.API.info(anno.getTitle());\r\n\tmap.removeAnnotations([\"Sydney\", anno2]);\r\n});\r\n\r\nvar button6 = Ti.UI.createButton({top: 0, right: 0, title: \"select anno2\"});\r\nbutton6.addEventListener('click', function(e) {\r\n\tmap.selectAnnotation(anno2);\r\n});\r\n\r\nvar button7 = Ti.UI.createButton({top: '10%', right: 0, title: \"desel anno2\"});\r\nbutton7.addEventListener('click', function(e) {\r\n\tmap.deselectAnnotation(anno2);\r\n});\r\n\r\nvar button8 = Ti.UI.createButton({top: '20%', right: 0, title: \"modify anno2\"});\r\nbutton8.addEventListener('click', function(e) {\r\n\tanno2.title = \"Hello\";\r\n\tanno2.subtitle = \"Hi there.\";\r\n\tanno2.longitude = 151.27689;\r\n});\r\n\r\nvar button9 = Ti.UI.createButton({top: '20%', left: 0, title: \"Add all\"});\r\nbutton9.addEventListener('click', function(e) {\r\n\t// this is currently broken TIMOB-12837\r\n\t//map.addAnnotations([anno, anno2, anno3, anno4]);\r\n});\r\n\r\nwin.add(button);\r\nwin.add(button2);\r\nwin.add(button3);\r\nwin.add(button4);\r\nwin.add(button5);\r\nwin.add(button6);\r\nwin.add(button7);\r\nwin.add(button8);\r\nwin.add(button9);\r\nwin.open();\r\n}\r\n\r\n{code}\r\n\r\n\r\nh5. Steps to reproduce:\r\n1) Create app with google map key in tiapp, be sure to include module.\r\n2) Run the app on device\r\n3) On the annotation test page, click \"remove annos\" button\r\n\r\nh5. Result:\r\nNull pointer exception as so:\r\n{code}\r\nE/TiApplication(11583): (main) [26120,26120] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.1.1,2013/06/15 16:10,f7592c1\r\nE/TiApplication(11583): java.lang.NullPointerException\r\nE/TiApplication(11583): \tat ti.map.TiUIMapView.findMarkerByTitle(TiUIMapView.java:304)\r\nE/TiApplication(11583): \tat ti.map.ViewProxy.isAnnotationValid(ViewProxy.java:242)\r\nE/TiApplication(11583): \tat ti.map.ViewProxy.removeAnnotation(ViewProxy.java:252)\r\nE/TiApplication(11583): \tat ti.map.ViewProxy.handleRemoveAnnotations(ViewProxy.java:275)\r\nE/TiApplication(11583): \tat ti.map.ViewProxy.handleMessage(ViewProxy.java:100)\r\nE/TiApplication(11583): \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\nE/TiApplication(11583): \tat android.os.Looper.loop(Looper.java:137)\r\nE/TiApplication(11583): \tat android.app.ActivityThread.main(ActivityThread.java:4898)\r\nE/TiApplication(11583): \tat java.lang.reflect.Method.invokeNative(Native Method)\r\nE/TiApplication(11583): \tat java.lang.reflect.Method.invoke(Method.java:511)\r\nE/TiApplication(11583): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)\r\nE/TiApplication(11583): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)\r\nE/TiApplication(11583): \tat dalvik.system.NativeStart.main(Native Method)\r\nI/AudioMixer( 1973): setParameter(TRACK, FORMAT, 0x1)\r\nE/AudioMixer( 1973): MOON > checkSEC_PCM ++ 1\r\nI/AudioHardwareTinyALSA( 1973): AudioStreamOutALSA::write setDevice\r\nD/AudioHardwareTinyALSA( 1973): OutALSA::setDevice: mode = 0, newDevice=0x2, currentDevice=0x2 ,force= 0\r\nD/AudioHardwareTinyALSA( 1973): OutALSA::setDevice: mDevice 0x2, newDevice = 0x2\r\nD/AudioHardwareTinyALSA( 1973): setOutputVolume\r\nD/TinyUCM ( 1973): setModifier Normal, en=1\r\nI/AudioHardwareTinyALSA( 1973): OutALSA::setDevice: mHandle NULL mode[0], Device[00000002] \r\nI/AudioHardwareTinyALSA( 1973): Open: mDefaults->direction=0 device=0\r\nD/AudioHardwareTinyALSA( 1973): Channel: 2, Samplerate: 44100, Format: 0, Peroid Size: 1024, Period Count: 4\r\nD/AudioHardwareTinyALSA( 1973): setPcmInterface: Stream=0x1, iSamplerate=16000++\r\nD/AudioHardwareTinyALSA( 1973): setPcmInterface--\r\nE/AndroidRuntime(11583): FATAL EXCEPTION: main\r\nE/AndroidRuntime(11583): java.lang.NullPointerException\r\nE/AndroidRuntime(11583): \tat ti.map.TiUIMapView.findMarkerByTitle(TiUIMapView.java:304)\r\nE/AndroidRuntime(11583): \tat ti.map.ViewProxy.isAnnotationValid(ViewProxy.java:242)\r\nE/AndroidRuntime(11583): \tat ti.map.ViewProxy.removeAnnotation(ViewProxy.java:252)\r\nE/AndroidRuntime(11583): \tat ti.map.ViewProxy.handleRemoveAnnotations(ViewProxy.java:275)\r\nE/AndroidRuntime(11583): \tat ti.map.ViewProxy.handleMessage(ViewProxy.java:100)\r\nE/AndroidRuntime(11583): \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\nE/AndroidRuntime(11583): \tat android.os.Looper.loop(Looper.java:137)\r\nE/AndroidRuntime(11583): \tat android.app.ActivityThread.main(ActivityThread.java:4898)\r\nE/AndroidRuntime(11583): \tat java.lang.reflect.Method.invokeNative(Native Method)\r\nE/AndroidRuntime(11583): \tat java.lang.reflect.Method.invoke(Method.java:511)\r\nE/AndroidRuntime(11583): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)\r\nE/AndroidRuntime(11583): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)\r\nE/AndroidRuntime(11583): \tat dalvik.system.NativeStart.main(Native Method)\r\nE/android.os.Debug( 2387): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error\r\nI/dumpstate(11943): begin\r\n{code}\r\n\r\nh5. Expected Result:\r\nAll annotations on screen removed", "attachment": [], "flagged": false, "summary": "Android: Maps v2: NPE when using removeAnnotations()", "creator": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac OS 10.8.4\r\nSafari: 6.0.4\r\nXcode 4.6.2\r\nCLI: 3.1.1\r\nAlloy: 1.1.3\r\nTitanium Studio, build: 3.1.1.201306112235\r\nTitanium SDK version 3.1.2.v20130708163051", "comment": { "comments": [ { "id": "261242", "author": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I went through the test case and Mapv2 application. Tried multiple scenarios and able to replicate this issue.\n\nPlease find below the details about this issue -\n\nScenario 1: Passing the array of Annotation reference to removeAnnotations()\nmap.removeAnnotations([anno,anno4]); // It works perfectly fine\nand annotations are removed from MapVIew.\n\nScenario 2: Passing the array of Annotation Title to removeAnnotations()\n\nmap.removeAnnotations([\"Sydney\",anno4]); // It throws null pointer exception.\njava.lang.NullPointerException at ti.map.TiUIMapView.findMarkerByTitle(TiUIMapView.java:304)\n\nScenario 3: Passing the array of Annotation Title using getTitle() method to removeAnnotations()\nvar anno = MapModule.createAnnotation({latitude: -33.87365, image: 'map_pin.png', longitude: 151.20689, title: \"Sydney\", subtitle: \"Sydney is quite chill\", draggable: true});\n\nmap.removeAnnotations([anno.getTitle(),anno4]); // It throws error as\n\nE/MapViewProxy(1600): (main) [8707,8707] Unsupported argument type for removeAnnotation\n\nThis issue has introduced on 3rd April with pull request 95.\nhttps://github.com/appcelerator/titanium_modules/pull/95/\n\nDevice : Google Nexus Phone , Android version : 4.0.4\nSDK : 3.1.1.GA\nAppcelerator Studio, build: 3.1.1.201306131423\nOS : MAC OSX 10.7.5\nMap Module: 2.1.0", "updateAuthor": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-07-10T11:21:19.000+0000", "updated": "2013-07-10T11:21:19.000+0000" }, { "id": "261693", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/titanium_modules/pull/122", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-07-12T22:42:59.000+0000", "updated": "2013-07-12T22:42:59.000+0000" }, { "id": "280426", "author": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.We do not get any NPE when using removeAnnotations().\r\nClosing.\r\n\r\nEnvironment:\r\nAppcel Studio : 3.2.0.201311200357\r\nTi SDK : 3.2.0.v20131119142443\r\nMac OSX : 10.8.5\r\nAlloy : 1.3.0\r\nCLI - 3.2.0-alpha\r\nDevice: Samsung Galaxy S4 running android 4.2.2", "updateAuthor": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-20T23:21:08.000+0000", "updated": "2013-11-20T23:21:08.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }