[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglibs-dev
Subject:    cvs commit: jakarta-taglibs/regexp/src/org/apache/taglibs/regexp SplitTag.java
From:       glenn () apache ! org
Date:       2002-02-23 19:31:57
[Download RAW message or body]

glenn       02/02/23 11:31:57

  Modified:    regexp/src/org/apache/taglibs/regexp SplitTag.java
  Log:
  Update use of perl split, previous split method has been deprecated
  
  Revision  Changes    Path
  1.4       +14 -13    \
jakarta-taglibs/regexp/src/org/apache/taglibs/regexp/SplitTag.java  
  Index: SplitTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/regexp/src/org/apache/taglibs/regexp/SplitTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SplitTag.java	2 Jul 2001 02:06:45 -0000	1.3
  +++ SplitTag.java	23 Feb 2002 19:31:57 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-taglibs/regexp/src/org/apache/taglibs/regexp/SplitTag.java,v \
                1.3 2001/07/02 02:06:45 glenn Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/07/02 02:06:45 $
  + * $Header: /home/cvs/jakarta-taglibs/regexp/src/org/apache/taglibs/regexp/SplitTag.java,v \
1.4 2002/02/23 19:31:57 glenn Exp $  + * $Revision: 1.4 $
  + * $Date: 2002/02/23 19:31:57 $
    *
    * ====================================================================
    *
  @@ -61,7 +61,8 @@
   
   package org.apache.taglibs.regexp;
   
  -import java.util.*;
  +import java.util.ArrayList;
  +import java.util.Iterator;
   import org.apache.oro.text.*;
   import org.apache.oro.text.perl.*;
   import org.apache.oro.text.regex.*;
  @@ -131,7 +132,7 @@
       private String regexpid = null;
       private String textid = null;
       private int limit = -1;
  -    private Enumeration split = null;
  +    private Iterator values = null;
       private String value = null;
   
       /**
  @@ -157,18 +158,18 @@
                       regexpid);
   	    spliton = rd.getRegexp();
   	}
  -	Vector vector = null;
  +	ArrayList split = new ArrayList();
   	if( limit > -1 ) {
  -	    vector = perl.split(spliton,td.getText(),limit);
  +	    perl.split(split,spliton,td.getText(),limit);
   	} else {
  -	    vector = perl.split(spliton,td.getText());
  +	    perl.split(split,spliton,td.getText());
   	}
  -	split = vector.elements();
  -	if( !split.hasMoreElements() ) {
  +        values = split.iterator();
  +	if( !values.hasNext() ) {
   	    return SKIP_BODY;
   	}
   
  -	value = (String)split.nextElement();
  +	value = (String)values.next();
   	pageContext.setAttribute(id,this,PageContext.PAGE_SCOPE);
   
   	return EVAL_BODY_TAG;
  @@ -181,10 +182,10 @@
        */
       public final int doAfterBody() throws JspException
       {
  -	if( !split.hasMoreElements() ) {
  +	if( !values.hasNext() ) {
   	    return SKIP_BODY;
   	}
  -	value = (String)split.nextElement();
  +	value = (String)values.next();
   	return EVAL_BODY_TAG;
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic