My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 7: StringIndexOutOfBounds in joinWithString
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by dobesv, Sep 11, 2009
This function throws a StringIndexOutOfBounds if the words collection is 
empty ...

class SimpleNamingContext ... {
...

     public static String joinWithString(String seperator, Collection<?> 
words) {
         String ret = "";
         for (Object s: words) {
             ret+=s.toString()+seperator;
         }
         return ret.substring(0, ret.length()-seperator.length());
     }

Sign in to add a comment

Hosted by Google Code