ebourg      2004/06/21 06:49:24

  Modified:    configuration/src/java/org/apache/commons/configuration
                        AbstractConfiguration.java
               configuration/src/test/org/apache/commons/configuration
                        TestBaseConfiguration.java
  Log:
  renamed the processString(String) method to split(String)
  
  Revision  Changes    Path
  1.13      +13 -13    
jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java
  
  Index: AbstractConfiguration.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AbstractConfiguration.java        21 Jun 2004 12:37:40 -0000      1.12
  +++ AbstractConfiguration.java        21 Jun 2004 13:49:24 -0000      1.13
  @@ -71,14 +71,16 @@
       {
           if (token instanceof String)
           {
  -            for(Iterator it = processString((String) token).iterator(); 
it.hasNext();)
  +            Iterator it = split((String) token).iterator();
  +            while (it.hasNext())
               {
                   addPropertyDirect(key, it.next());
               }
           }
           else if (token instanceof Collection)
           {
  -            for (Iterator it = ((Collection) token).iterator(); it.hasNext();)
  +            Iterator it = ((Collection) token).iterator();
  +            while (it.hasNext())
               {
                   addProperty(key, it.next());
               }
  @@ -219,18 +221,17 @@
       }
   
       /**
  -     * Returns a List of Strings built from the supplied
  -     * String. Splits up CSV lists. If no commas are in the
  -     * String, simply returns a List with the String as its
  -     * first element
  +     * Returns a List of Strings built from the supplied String. Splits up CSV
  +     * lists. If no commas are in the String, simply returns a List with the
  +     * String as its first element.
        *
        * @param token The String to tokenize
        *
        * @return A List of Strings
        */
  -    protected List processString(String token)
  +    protected List split(String token)
       {
  -        List retList = new ArrayList(INITIAL_LIST_SIZE);
  +        List list = new ArrayList(INITIAL_LIST_SIZE);
   
           if (token.indexOf(DELIMITER) > 0)
           {
  @@ -238,13 +239,12 @@
   
               while (tokenizer.hasMoreTokens())
               {
  -                String value = tokenizer.nextToken();
  -                retList.add(value);
  +                list.add(tokenizer.nextToken());
               }
           }
           else
           {
  -            retList.add(token);
  +            list.add(token);
           }
   
           //
  @@ -252,7 +252,7 @@
           // we also keep it in the Container. So the
           // Keys are added to the store in the sequence that
           // is given in the properties
  -        return retList;
  +        return list;
       }
   
       /**
  
  
  
  1.13      +4 -4      
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestBaseConfiguration.java
  
  Index: TestBaseConfiguration.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestBaseConfiguration.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestBaseConfiguration.java        21 Jun 2004 09:51:41 -0000      1.12
  +++ TestBaseConfiguration.java        21 Jun 2004 13:49:24 -0000      1.13
  @@ -481,16 +481,16 @@
                fail("IllegalStateException should have been thrown for looped 
property references");
        }
   
  -    public void testProcessString()
  +    public void testSplit()
       {
           String s1 = "abc,xyz";
  -        List tokens = config.processString(s1);
  +        List tokens = config.split(s1);
           assertEquals("number of tokens in '" + s1 + "'", 2, tokens.size());
           assertEquals("1st token for '" + s1 + "'", "abc", tokens.get(0));
           assertEquals("2nd token for '" + s1 + "'", "xyz", tokens.get(1));
   
           String s2 = "abc\\,xyz";
  -        tokens = config.processString(s2);
  +        tokens = config.split(s2);
           assertEquals("number of tokens in '" + s2 + "'", 1, tokens.size());
           assertEquals("1st token for '" + s2 + "'", "abc,xyz", tokens.get(0));
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to