i getting stringindexoutofbounds exception in part of code.
field captures mylist optional in ui.this error occurs when mylist/myurl string empty. how handle it?
can correct me doing wrong here?
if (mylist != null) { (int r = 0; r < mylist.size(); r++) { myurl = myurl + mylist.tostring() + ","; } myurl = myurl.substring(0, myrssurl.length() - 1); myurl = myurl.replace("[", "").replace("]", ""); } else { rsslist.clear(); rssurl=null; system.out.println("inside else >>>>"); }
if length 0, myurl = myurl.substring(0, myrssurl.length() - 1); evaluate myurl = myurl.substring(0,-1); getting out of bounds error.
to fix, should check if arraylist.isempty() or if length 0.
Comments
Post a Comment