title: Empty arrayList and empty string throws StringIndexOutOfBounds exception
body: <p>I am getting StringIndexOutOfBounds exception in this part of the code.<br>
  The field that captures myList is optional in the UI.This error occurs only when myList/myURL string is empty. How do I handle it?</p>
  
  <p>Can someone correct me what am I doing wrong here?</p>
  
  <pre><code>    if (myList != null) {
  
              for (int r = 0; r &lt; 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 &gt;&gt;&gt;&gt;");
      }
  </code></pre>