httplite: more consise implementation of String.split() by Yann Diorcet.  See FELIX-3287

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1221756 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/httplite/minimum/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java b/httplite/minimum/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java
index 190e1e7..a1c9d9a 100644
--- a/httplite/minimum/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java
+++ b/httplite/minimum/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java
@@ -1151,47 +1151,17 @@
      */
     private static String[] splitString( String instr, char separator )
     {
-        if ( instr == null )
+		if ( instr == null )
         {
             throw new IllegalArgumentException( "Input string must not be null." );
         }
 
-        if ( instr.length() == 0 )
+	    StringTokenizer tokenizer = new StringTokenizer(instr, Character.toString(separator));
+        int length = tokenizer.countTokens();
+		String[] str_array = new String[length];
+        for ( int i = 0; i < length; i++ )
         {
-            return ( new String[0] );
-        }
-
-        List tokens = new ArrayList();
-        String token;
-        int index_a = 0;
-        int index_b = 0;
-
-        while ( true )
-        {
-            index_b = instr.indexOf( separator, index_a );
-            if ( index_b == -1 )
-            {
-                token = instr.substring( index_a );
-
-                if ( token.length() > 0 )
-                {
-                    tokens.add( token );
-                }
-
-                break;
-            }
-            token = instr.substring( index_a, index_b );
-
-            if ( token.length() >= 0 )
-            {
-                tokens.add( token );
-            }
-            index_a = index_b + 1;
-        }
-        String[] str_array = new String[tokens.size()];
-        for ( int i = 0; i < str_array.length; i++ )
-        {
-            str_array[i] = ( String ) ( tokens.get( i ) );
+            str_array[i] = tokenizer.nextToken();
         }
         return str_array;
     }