Project: titanium
Issue TIMOB-8439: Android: Unable to get any results when pulling events by date range
h6.Issue Exception is thrown as Android is unable to get any results when pulling events by date range h6.Tested on sdk-version: 2.1.0.v20120329000337 h6.Runtime engines Same thing happens with V8 and Rhino. h6.Device Galaxy Tab 7 Plus model GT-P6210 Android version 3.2 Kernel 2.6.36-P6210UEKJC-CL567728 se.infra@SEI-20 #3 h6.Repro sequence {code} // this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#000'); var win = Titanium.UI.createWindow({ title:'Calendar', backgroundColor:'#fff' }); win.open(); var startDate = new Date(); startDate.setFullYear(startDate.getFullYear()-1,0,1); Ti.API.info('startDate: '+startDate); var endDate = new Date(); endDate.setFullYear(endDate.getFullYear()+1,0,1); Ti.API.info('endDate: '+endDate); function showCalendars(calendars) { for (var i = 0; i < calendars.length; i++) { Ti.API.info(calendars[i].name); Ti.API.info(JSON.stringify(calendars[i])); } } Ti.API.info('ALL CALENDARS:'); showCalendars(Ti.Android.Calendar.allCalendars); Ti.API.info('SELECTABLE CALENDARS:'); showCalendars(Ti.Android.Calendar.selectableCalendars); var out = []; Ti.API.info('TRY TO GET EVENTS IN ALL CALENDARS:'); var calendars = Ti.Android.Calendar.allCalendars Ti.API.info(JSON.stringify(calendars)); for (var i=0; i < calendars.length; i++) { Ti.API.info(JSON.stringify(calendars[i])); try { var cal_events = calendars[i].getEventsBetweenDates(startDate,endDate); for (var j=0; j < cal_events.length; j++) { out.push(cal_events[j]); }; } catch(err) { Ti.API.error("ERROR "+err); } }; Ti.API.info('TRY TO GET EVENTS IN SELECTABLE CALENDARS:'); var calendars = Ti.Android.Calendar.selectableCalendars Ti.API.info(JSON.stringify(calendars)); for (var i=0; i < calendars.length; i++) { Ti.API.info(JSON.stringify(calendars[i])); try { var cal_events = calendars[i].getEventsBetweenDates(startDate,endDate); for (var j=0; j < cal_events.length; j++) { out.push(cal_events[j]); }; } catch(err) { Ti.API.error("ERROR "+err); } }; Ti.API.info('ALL THE EVENTS:'); Ti.API.info(JSON.stringify(out)); {code} h6.Console output {code} 03-30 10:49:38.935: I/TiApplication(23751): (main) [98,98] Titanium 2.1.0 (2012/03/29 00:04 ac3852d) 03-30 10:49:38.945: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:38.955: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:38.960: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:38.975: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:38.995: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.010: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.025: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.035: D/dalvikvm(23751): GC_CONCURRENT freed 281K, 6% free 6505K/6919K, paused 1ms+1ms 03-30 10:49:39.040: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.055: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.075: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.080: D/dalvikvm(23751): Trying to load lib /data/data/info.rborn.calendar/lib/libstlport_shared.so 0x4079b9e0 03-30 10:49:39.080: I/TiApplication(23751): (main) [146,244] Titanium Javascript runtime: v8 03-30 10:49:39.080: D/dalvikvm(23751): Added shared lib /data/data/info.rborn.calendar/lib/libstlport_shared.so 0x4079b9e0 03-30 10:49:39.080: D/dalvikvm(23751): No JNI_OnLoad found in /data/data/info.rborn.calendar/lib/libstlport_shared.so 0x4079b9e0, skipping init 03-30 10:49:39.080: D/dalvikvm(23751): Trying to load lib /data/data/info.rborn.calendar/lib/libkroll-v8.so 0x4079b9e0 03-30 10:49:39.090: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.090: I/TiRootActivity(23751): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null 03-30 10:49:39.095: D/dalvikvm(23751): Added shared lib /data/data/info.rborn.calendar/lib/libkroll-v8.so 0x4079b9e0 03-30 10:49:39.105: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.120: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.140: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.140: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.140: I/LiveWallpaper(2895): Engine.onVisibilityChanged() - false 03-30 10:49:39.140: I/SurfaceFlinger(2698): id=1870 Removed com.android.launcher/com.android.launcher2.Launcher idx=2 Map Size=3 03-30 10:49:39.150: I/SurfaceFlinger(2698): id=1870 Removed com.android.launcher/com.android.launcher2.Launcher idx=-2 Map Size=3 03-30 10:49:39.390: E/TiApplication(23751): (KrollRuntimeThread) [298,298] APP PROXY: ti.modules.titanium.app.AppModule@407b5cd0 03-30 10:49:39.485: I/TiAPI(23751): startDate: Sat Jan 01 2011 10:49:39 GMT+0100 (CET) 03-30 10:49:39.485: I/TiAPI(23751): endDate: Tue Jan 01 2013 10:49:39 GMT+0100 (CET) 03-30 10:49:39.485: I/TiAPI(23751): ALL CALENDARS: 03-30 10:49:39.495: I/TiAPI(23751): My calendar 03-30 10:49:39.495: I/TiAPI(23751): {"hidden":false,"id":"1","selected":true,"name":"My calendar"} 03-30 10:49:39.495: I/TiAPI(23751): dan.tamas.tst@gmail.com 03-30 10:49:39.495: I/TiAPI(23751): {"hidden":false,"id":"2","selected":true,"name":"dan.tamas.tst@gmail.com"} 03-30 10:49:39.495: I/TiAPI(23751): dan tamas 03-30 10:49:39.500: I/TiAPI(23751): {"hidden":false,"id":"3","selected":true,"name":"dan tamas"} 03-30 10:49:39.500: I/TiAPI(23751): test 1 03-30 10:49:39.500: I/TiAPI(23751): {"hidden":false,"id":"4","selected":true,"name":"test 1"} 03-30 10:49:39.500: I/TiAPI(23751): test 1 03-30 10:49:39.500: I/TiAPI(23751): {"hidden":false,"id":"5","selected":true,"name":"test 1"} 03-30 10:49:39.500: I/TiAPI(23751): test 2 03-30 10:49:39.500: I/TiAPI(23751): {"hidden":false,"id":"6","selected":true,"name":"test 2"} 03-30 10:49:39.500: I/TiAPI(23751): SELECTABLE CALENDARS: 03-30 10:49:39.505: I/TiAPI(23751): My calendar 03-30 10:49:39.505: I/TiAPI(23751): {"hidden":false,"id":"1","selected":true,"name":"My calendar"} 03-30 10:49:39.505: I/TiAPI(23751): dan.tamas.tst@gmail.com 03-30 10:49:39.505: I/TiAPI(23751): {"hidden":false,"id":"2","selected":true,"name":"dan.tamas.tst@gmail.com"} 03-30 10:49:39.505: I/TiAPI(23751): dan tamas 03-30 10:49:39.505: I/TiAPI(23751): {"hidden":false,"id":"3","selected":true,"name":"dan tamas"} 03-30 10:49:39.505: I/TiAPI(23751): test 1 03-30 10:49:39.505: I/TiAPI(23751): {"hidden":false,"id":"4","selected":true,"name":"test 1"} 03-30 10:49:39.505: I/TiAPI(23751): test 1 03-30 10:49:39.505: I/TiAPI(23751): {"hidden":false,"id":"5","selected":true,"name":"test 1"} 03-30 10:49:39.505: I/TiAPI(23751): test 2 03-30 10:49:39.505: I/TiAPI(23751): {"hidden":false,"id":"6","selected":true,"name":"test 2"} 03-30 10:49:39.505: I/TiAPI(23751): TRY TO GET EVENTS IN ALL CALENDARS: 03-30 10:49:39.515: I/TiAPI(23751): [{"hidden":false,"id":"1","selected":true,"name":"My calendar"},{"hidden":false,"id":"2","selected":true,"name":"dan.tamas.tst@gmail.com"},{"hidden":false,"id":"3","selected":true,"name":"dan tamas"},{"hidden":false,"id":"4","selected":true,"name":"test 1"},{"hidden":false,"id":"5","selected":true,"name":"test 1"},{"hidden":false,"id":"6","selected":true,"name":"test 2"}] 03-30 10:49:39.515: I/TiAPI(23751): {"hidden":false,"id":"1","selected":true,"name":"My calendar"} 03-30 10:49:39.520: W/TiEvent(23751): (KrollRuntimeThread) [132,430] unable to get any results when pulling events by date range 03-30 10:49:39.520: I/TiAPI(23751): {"hidden":false,"id":"2","selected":true,"name":"dan.tamas.tst@gmail.com"} 03-30 10:49:39.525: W/TiEvent(23751): (KrollRuntimeThread) [4,434] unable to get any results when pulling events by date range 03-30 10:49:39.525: I/TiAPI(23751): {"hidden":false,"id":"3","selected":true,"name":"dan tamas"} 03-30 10:49:39.525: W/TiEvent(23751): (KrollRuntimeThread) [2,436] unable to get any results when pulling events by date range 03-30 10:49:39.525: I/TiAPI(23751): {"hidden":false,"id":"4","selected":true,"name":"test 1"} 03-30 10:49:39.530: W/TiEvent(23751): (KrollRuntimeThread) [3,439] unable to get any results when pulling events by date range 03-30 10:49:39.530: I/TiAPI(23751): {"hidden":false,"id":"5","selected":true,"name":"test 1"} 03-30 10:49:39.530: W/TiEvent(23751): (KrollRuntimeThread) [3,442] unable to get any results when pulling events by date range 03-30 10:49:39.535: I/TiAPI(23751): {"hidden":false,"id":"6","selected":true,"name":"test 2"} 03-30 10:49:39.535: W/TiEvent(23751): (KrollRuntimeThread) [3,445] unable to get any results when pulling events by date range 03-30 10:49:39.535: I/TiAPI(23751): TRY TO GET EVENTS IN SELECTABLE CALENDARS: 03-30 10:49:39.540: I/TiAPI(23751): [{"hidden":false,"id":"1","selected":true,"name":"My calendar"},{"hidden":false,"id":"2","selected":true,"name":"dan.tamas.tst@gmail.com"},{"hidden":false,"id":"3","selected":true,"name":"dan tamas"},{"hidden":false,"id":"4","selected":true,"name":"test 1"},{"hidden":false,"id":"5","selected":true,"name":"test 1"},{"hidden":false,"id":"6","selected":true,"name":"test 2"}] 03-30 10:49:39.540: I/TiAPI(23751): {"hidden":false,"id":"1","selected":true,"name":"My calendar"} 03-30 10:49:39.545: W/TiEvent(23751): (KrollRuntimeThread) [8,453] unable to get any results when pulling events by date range 03-30 10:49:39.545: I/TiAPI(23751): {"hidden":false,"id":"2","selected":true,"name":"dan.tamas.tst@gmail.com"} 03-30 10:49:39.545: W/TiEvent(23751): (KrollRuntimeThread) [3,456] unable to get any results when pulling events by date range 03-30 10:49:39.545: I/TiAPI(23751): {"hidden":false,"id":"3","selected":true,"name":"dan tamas"} 03-30 10:49:39.550: W/TiEvent(23751): (KrollRuntimeThread) [3,459] unable to get any results when pulling events by date range 03-30 10:49:39.550: I/TiAPI(23751): {"hidden":false,"id":"4","selected":true,"name":"test 1"} 03-30 10:49:39.550: W/TiEvent(23751): (KrollRuntimeThread) [3,462] unable to get any results when pulling events by date range 03-30 10:49:39.550: I/TiAPI(23751): {"hidden":false,"id":"5","selected":true,"name":"test 1"} 03-30 10:49:39.555: W/TiEvent(23751): (KrollRuntimeThread) [3,465] unable to get any results when pulling events by date range 03-30 10:49:39.555: I/TiAPI(23751): {"hidden":false,"id":"6","selected":true,"name":"test 2"} 03-30 10:49:39.560: W/TiEvent(23751): (KrollRuntimeThread) [2,467] unable to get any results when pulling events by date range 03-30 10:49:39.560: I/TiAPI(23751): ALL THE EVENTS: 03-30 10:49:39.560: I/TiAPI(23751): [] 03-30 10:49:39.590: D/dalvikvm(23751): GC_FOR_ALLOC freed 246K, 6% free 6610K/6983K, paused 13ms 03-30 10:49:39.590: I/dalvikvm-heap(23751): Grow heap (frag case) to 7.996MB for 1536016-byte allocation 03-30 10:49:39.620: D/dalvikvm(23751): GC_FOR_ALLOC freed <1K, 5% free 8109K/8519K, paused 12ms 03-30 10:49:39.620: W/CursorWrapperInner(23751): Cursor finalized without prior close() 03-30 10:49:39.645: W/CursorWrapperInner(23751): Cursor finalized without prior close() 03-30 10:49:39.645: D/dalvikvm(23751): GC_CONCURRENT freed 1K, 5% free 8108K/8519K, paused 1ms+1ms 03-30 10:49:39.645: W/CursorWrapperInner(23751): Cursor finalized without prior close() 03-30 10:49:39.645: W/CursorWrapperInner(23751): Cursor finalized without prior close() 03-30 10:49:39.670: D/dalvikvm(23751): GC_FOR_ALLOC freed 14K, 5% free 8094K/8519K, paused 12ms 03-30 10:49:39.670: I/dalvikvm-heap(23751): Grow heap (frag case) to 8.630MB for 682256-byte allocation 03-30 10:49:39.690: D/dalvikvm(23751): GC_FOR_ALLOC freed 0K, 6% free 8760K/9223K, paused 12ms 03-30 10:49:39.725: D/dalvikvm(23751): GC_CONCURRENT freed 0K, 6% free 8760K/9223K, paused 1ms+1ms 03-30 10:49:39.730: I/TiRootActivity(23751): (main) [0,0] checkpoint, on root activity resume. activity = info.rborn.calendar.CalendartestActivity@407f22c8 03-30 10:49:39.735: D/WindowManager(2827): addWindowToListInOrder() : current mSkipWidgetFocus='true' 03-30 10:49:39.740: I/SurfaceFlinger(2698): id=1872(1) createSurface 0x40514 for pid 23751 (1x1),2 flag=0, info.rborn.calendar/info.rborn.calendar.CalendartestActivity 03-30 10:49:39.745: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.750: I/WindowManager(2827): Putting input method here! 03-30 10:49:39.750: D/WindowManager(2827): w.mAttrs.token=ActivityRecord{40decca0 info.rborn.calendar/.CalendartestActivity} 03-30 10:49:39.750: D/WindowManager(2827): w.mToken=AppWindowToken{41ae2ef8 token=ActivityRecord{40decca0 info.rborn.calendar/.CalendartestActivity}} 03-30 10:49:39.750: D/WindowManager(2827): Desired input method target: Window{40ba9a60 info.rborn.calendar/info.rborn.calendar.CalendartestActivity paused=false} 03-30 10:49:39.750: D/WindowManager(2827): Current focus: Window{40ba9a60 info.rborn.calendar/info.rborn.calendar.CalendartestActivity paused=false} 03-30 10:49:39.750: D/WindowManager(2827): Last focus: Window{40ba9a60 info.rborn.calendar/info.rborn.calendar.CalendartestActivity paused=false} 03-30 10:49:39.750: D/WindowManager(2827): IM target client: com.android.internal.view.IInputMethodClient$Stub$Proxy@41040b20 03-30 10:49:39.750: D/WindowManager(2827): IM target client binder: android.os.BinderProxy@41066c90 03-30 10:49:39.750: D/WindowManager(2827): Requesting client binder: android.os.BinderProxy@41066c90 03-30 10:49:39.750: D/CLIPBOARD(4466): Hide Clipboard dialog at Starting input: finished by someone else... ! 03-30 10:49:39.750: W/CPUclock(2827): mDVFSUpperLock.release() 03-30 10:49:39.750: D/CLIPBOARD(2827): Hide Clipboard dialog inside hideSoftInput() ! 03-30 10:49:39.750: D/CLIPBOARD(2827): Hide Clipboard dialog inside windowGainedFocus() ! 03-30 10:49:39.750: D/WindowManager(2827): token=AppWindowToken{41ae2ef8 token=ActivityRecord{40decca0 info.rborn.calendar/.CalendartestActivity}} 03-30 10:49:39.750: I/WindowManager(2827): Placing input method @10 03-30 10:49:39.765: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.765: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.765: I/ActivityManager(2827): Displayed info.rborn.calendar/.CalendartestActivity: +1s156ms 03-30 10:49:39.765: D/CLIPBOARD(23751): Hide Clipboard dialog at Starting input: finished by someone else... ! 03-30 10:49:39.770: D/KeyguardViewMediator(2827): setHidden false 03-30 10:49:39.770: D/TabletStatusBar(2886): lights on {code}
Story points: 2