{"id":252,"date":"2011-01-31T18:07:01","date_gmt":"2011-01-31T16:07:01","guid":{"rendered":"http:\/\/www.bestcoder.net\/?p=252"},"modified":"2012-10-14T13:45:38","modified_gmt":"2012-10-14T13:45:38","slug":"exception-during-retrieving-of-todo-due-property-value-indexoutofboundsexception","status":"publish","type":"post","link":"http:\/\/www.bestcoder.net\/?p=252","title":{"rendered":"Exception during Retrieving of ToDo.DUE Property Value (IndexOutOfBoundsException)"},"content":{"rendered":"<p><!--:en-->If you get IndexOutOfBoundsException during retrieving of ToDo.DUE property value, check before it has a value.<\/p>\n<p><strong>Wrong : <\/strong><\/p>\n<p>lngEnd = _SourceContext.getDate(BlackBerryToDo.DUE, 0);<\/p>\n<p><strong>Correct :<\/strong><\/p>\n<div id=\"_mcePaste\">if (todo.countValues(BlackBerryToDo.DUE) &gt; 0)<\/div>\n<div id=\"_mcePaste\">{<\/div>\n<div id=\"_mcePaste\">lngEnd = todo.getDate(BlackBerryToDo.DUE, 0);<\/div>\n<div id=\"_mcePaste\">}<\/div>\n<div>This is because if ToDo has no Due date (I mean, selected &#8216; <strong>None<\/strong> &#8216; value), you can take\u00a0IndexOutOfBoundsException error. Check before it has a value using countValues (&#8230;) &gt; 0<\/div>\n<div>I spent lots of time to solve this exception \ud83d\ude42<\/div>\n<div><\/div>\n<div>&#8212;&#8211;<\/div>\n<p><!--:--><!--:tr--><\/p>\n<div>\n<p>ToDo (Task) ile ilgili uygulama geli\u015ftirirken\u00a0ToDo.DUE\u00a0bilgisini alman\u0131z gerekirse e\u011fer, direkt olarak getDate(ToDo.DUE, 0) ile koda ba\u015flamay\u0131n. \u00c7\u00fcnk\u00fc bu durum\u00a0IndexOutOfBoundsException hatas\u0131 olu\u015fturuyor. Bu exception \u0131n \u00e7\u0131kma sebebi de ToDo da<strong> Due : None<\/strong> se\u00e7ilmi\u015f olmas\u0131. E\u011fer <strong>By Date <\/strong>se\u00e7ilir ve bir tarih belirtlenirse\u00a0<strong>IndexOutOfBoundsException <\/strong>hatas\u0131 al\u0131nm\u0131yor.<\/p>\n<p>Dolay\u0131s\u0131 ile kodumuzu a\u015fa\u011f\u0131daki hatal\u0131 \/ do\u011fru durumunu g\u00f6z \u00f6n\u00fcne alarak yazmakta fayda var. Due : None se\u00e7ili iken alanda de\u011fer olmuyor, Due : By Date se\u00e7ili iken de\u011fer oluyor.<\/p>\n<p><strong>Hatal\u0131 : <\/strong><\/p>\n<p>lngEnd = _SourceContext.getDate(BlackBerryToDo.DUE, 0);<\/p>\n<p><strong>Do\u011fru :<\/strong><\/p>\n<div id=\"_mcePaste\">if (todo.countValues(BlackBerryToDo.DUE) &gt; 0)<\/div>\n<div id=\"_mcePaste\">{<\/div>\n<div id=\"_mcePaste\">lngEnd = todo.getDate(BlackBerryToDo.DUE, 0);<\/div>\n<div id=\"_mcePaste\">}<\/div>\n<\/div>\n<div><\/div>\n<div>Olduk\u00e7a zaman\u0131m\u0131 yedi bu sinir Exception hatas\u0131 \ud83d\ude42<\/div>\n<p><!--:--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you get IndexOutOfBoundsException during retrieving of ToDo.DUE property value, check before it has a value. Wrong : lngEnd = _SourceContext.getDate(BlackBerryToDo.DUE, 0); Correct : if (todo.countValues(BlackBerryToDo.DUE) &gt; 0) { lngEnd = todo.getDate(BlackBerryToDo.DUE, 0); } This is because if ToDo has no Due date (I mean, selected &#8216; None &#8216; value), you can take\u00a0IndexOutOfBoundsException error. Check &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-252","post","type-post","status-publish","format-standard","hentry","category-blackberry","category-development","entry"],"_links":{"self":[{"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/posts\/252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=252"}],"version-history":[{"count":4,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/posts\/252\/revisions"}],"predecessor-version":[{"id":590,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/posts\/252\/revisions\/590"}],"wp:attachment":[{"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=252"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}