jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From felip...@apache.org
Subject cvs commit: jakarta-taglibs/string/src/org/apache/taglibs/string/util Metaphone.java
Date Tue, 09 Mar 2004 00:54:45 GMT
felipeal    2004/03/08 16:54:45

  Modified:    string/src/org/apache/taglibs/string
                        CapitalizeAllWordsTag.java CapitalizeTag.java
                        CenterTag.java ChopNewlineTag.java EscapeTag.java
                        GetChompTag.java GetPrechompTag.java
                        LeftPadTag.java LeftTag.java LengthTag.java
                        MidTag.java NestedStringTag.java OverlayTag.java
                        PrechompTag.java RandomStringTag.java
                        RepeatTag.java ReplaceTag.java
                        ReverseDelimitedStringTag.java RightPadTag.java
                        RightTag.java StringTagSupport.java
                        SubstringTag.java TruncateNicelyTag.java
                        UncapitalizeTag.java WordWrapTag.java
               string/src/org/apache/taglibs/string/util Metaphone.java
  Log:
  replaced deprecated Commons Lang 2.0 methods (see bug 27324)
  
  Revision  Changes    Path
  1.6       +3 -2      jakarta-taglibs/string/src/org/apache/taglibs/string/CapitalizeAllWordsTag.java
  
  Index: CapitalizeAllWordsTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/CapitalizeAllWordsTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CapitalizeAllWordsTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ CapitalizeAllWordsTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -15,7 +15,8 @@
    */
   package org.apache.taglibs.string;
   
  -import org.apache.commons.lang.StringUtils;
  +import org.apache.commons.lang.WordUtils;
  +
   import javax.servlet.jsp.JspException;
   
   /**
  @@ -33,7 +34,7 @@
   
   
       public String changeString(String text) throws JspException {
  -        return StringUtils.capitaliseAllWords(text);
  +    	return WordUtils.capitalize( text );
       }
   
       public void initAttributes() {
  
  
  
  1.6       +2 -2      jakarta-taglibs/string/src/org/apache/taglibs/string/CapitalizeTag.java
  
  Index: CapitalizeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/CapitalizeTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CapitalizeTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ CapitalizeTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -15,7 +15,7 @@
    */
   package org.apache.taglibs.string;
   
  -import org.apache.commons.lang.StringUtils;
  +import org.apache.commons.lang.WordUtils;
   import javax.servlet.jsp.JspException;
   
   /**
  @@ -32,7 +32,7 @@
   
   
       public String changeString(String text) throws JspException {
  -        return StringUtils.capitalise(text);
  +		return WordUtils.capitalize( text );
       }
   
       public void initAttributes() {
  
  
  
  1.8       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/CenterTag.java
  
  Index: CenterTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/CenterTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CenterTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ CenterTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Center the body String in a larger String of size width.
  
  
  
  1.6       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/ChopNewlineTag.java
  
  Index: ChopNewlineTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/ChopNewlineTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChopNewlineTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ ChopNewlineTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -32,7 +32,7 @@
   
   
       public String changeString(String text) throws JspException {
  -        return StringUtils.chopNewline(text);
  +        return StringUtils.chomp(text);
       }
   
       public void initAttributes() {
  
  
  
  1.6       +2 -2      jakarta-taglibs/string/src/org/apache/taglibs/string/EscapeTag.java
  
  Index: EscapeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/EscapeTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EscapeTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ EscapeTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -15,7 +15,7 @@
    */
   package org.apache.taglibs.string;
   
  -import org.apache.commons.lang.StringUtils;
  +import org.apache.commons.lang.StringEscapeUtils;
   import javax.servlet.jsp.JspException;
   
   /**
  @@ -33,7 +33,7 @@
   
   
       public String changeString(String text) throws JspException {
  -        return StringUtils.escape(text);
  +    	return StringEscapeUtils.escapeJava( text );
       }
   
       public void initAttributes() {
  
  
  
  1.8       +1 -3      jakarta-taglibs/string/src/org/apache/taglibs/string/GetChompTag.java
  
  Index: GetChompTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/GetChompTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- GetChompTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ GetChompTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -57,10 +57,8 @@
           this.delimiter = delimiter;
       }
   
  -
  -
       public String changeString(String text) throws JspException {
  -        return StringUtils.getChomp(text, delimiter);
  +        return StringUtils.substringAfterLast(text, delimiter);
       }
   
       public void initAttributes() {
  
  
  
  1.8       +1 -3      jakarta-taglibs/string/src/org/apache/taglibs/string/GetPrechompTag.java
  
  Index: GetPrechompTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/GetPrechompTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- GetPrechompTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ GetPrechompTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -57,10 +57,8 @@
           this.delimiter = delimiter;
       }
   
  -
  -
       public String changeString(String text) throws JspException {
  -        return StringUtils.getPrechomp(text, delimiter);
  +        return StringUtils.substringBefore(text, delimiter);
       }
   
       public void initAttributes() {
  
  
  
  1.8       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/LeftPadTag.java
  
  Index: LeftPadTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/LeftPadTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LeftPadTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ LeftPadTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Left pad a string with a particular delimiter to a 
  
  
  
  1.6       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/LeftTag.java
  
  Index: LeftTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/LeftTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LeftTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ LeftTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Gets the leftmost 'n' characters from a string.
  
  
  
  1.4       +0 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/LengthTag.java
  
  Index: LengthTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/LengthTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LengthTag.java	6 Mar 2004 06:58:48 -0000	1.3
  +++ LengthTag.java	9 Mar 2004 00:54:45 -0000	1.4
  @@ -15,7 +15,6 @@
    */
   package org.apache.taglibs.string;
   
  -import org.apache.commons.lang.StringUtils;
   import javax.servlet.jsp.JspException;
   
   /**
  
  
  
  1.6       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/MidTag.java
  
  Index: MidTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/MidTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MidTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ MidTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Gets 'n' characters from the inside of a string.
  
  
  
  1.8       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/NestedStringTag.java
  
  Index: NestedStringTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/NestedStringTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- NestedStringTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ NestedStringTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -87,7 +87,7 @@
           if(close == null) {
               close = open;
           }
  -        return StringUtils.getNestedString(text, open, close);
  +		return StringUtils.substringBetween(text, open, close);
       }
   
       public void initAttributes() {
  
  
  
  1.8       +2 -2      jakarta-taglibs/string/src/org/apache/taglibs/string/OverlayTag.java
  
  Index: OverlayTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/OverlayTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- OverlayTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ OverlayTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Overlay a String on top of another String. The length 
  @@ -110,7 +110,7 @@
   
   
       public String changeString(String text) throws JspException {
  -        return StringUtils.overlayString(text, with, NumberUtils.stringToInt(start), NumberUtils.stringToInt(end));
  +        return StringUtils.overlay(text, with, NumberUtils.stringToInt(start), NumberUtils.stringToInt(end));
       }
   
       public void initAttributes() {
  
  
  
  1.8       +1 -3      jakarta-taglibs/string/src/org/apache/taglibs/string/PrechompTag.java
  
  Index: PrechompTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/PrechompTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PrechompTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ PrechompTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -60,13 +60,11 @@
   
   
       public String changeString(String text) throws JspException {
  -        return StringUtils.prechomp(text, delimiter);
  +		return StringUtils.substringAfter(text, delimiter);    	
       }
   
       public void initAttributes() {
  -
           this.delimiter = "\n";
  -
       }
   
   
  
  
  
  1.8       +92 -48    jakarta-taglibs/string/src/org/apache/taglibs/string/RandomStringTag.java
  
  Index: RandomStringTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/RandomStringTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RandomStringTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ RandomStringTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -15,22 +15,24 @@
    */
   package org.apache.taglibs.string;
   
  -import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.RandomStringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.StringUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
  -// TODO: Decide if set should be a CharSet.
  +import javax.servlet.jsp.JspException;
   
  +
  +// TODO: Decide if set should be a CharSet.
   /// Note: There is a lot of tied logic between this class and 
   ///       the RandomStringUtils random methods. Understand how all the 
   ///       overloading works in RandomStringUtils before tackling this 
   ///       class.
   
   /**
  - * Create a random string. It can create an ascii string, 
  - * a numeric string, an alphanumeric string, and a unicode 
  - * string. The size of the string may be specified, as can a 
  - * start and end character. Lastly, a set of characters to use 
  + * Create a random string. It can create an ascii string,
  + * a numeric string, an alphanumeric string, and a unicode
  + * string. The size of the string may be specified, as can a
  + * start and end character. Lastly, a set of characters to use
    * may be passed in.
    *
    * <dl>
  @@ -51,16 +53,14 @@
    *            Default value is to unicode.
    * </dd>
    * </dl>
  - * 
  + *
    * @author bayard@generationjava.com
    */
   public class RandomStringTag extends StringTagSupport {
  -
  -    static public String NUMERIC      = "numeric";
  +    static public String NUMERIC = "numeric";
       static public String ALPHANUMERIC = "alphanumeric";
  -    static public String ALPHABET     = "alphabet";
  -    static public String UNICODE      = "unicode";
  -
  +    static public String ALPHABET = "alphabet";
  +    static public String UNICODE = "unicode";
       private String count;
       private String start;
       private String end;
  @@ -88,7 +88,6 @@
           this.count = count;
       }
   
  -
       /**
        * Get the start property
        *
  @@ -107,7 +106,6 @@
           this.start = start;
       }
   
  -
       /**
        * Get the end property
        *
  @@ -126,7 +124,6 @@
           this.end = end;
       }
   
  -
       /**
        * Get the type property
        *
  @@ -146,63 +143,110 @@
       }
   
       public String changeString(String text) throws JspException {
  -        int st = 0;
  -        int ed = 0;
  -        int ct = 0;
  +        int st = 0; // real start
  +        int ed = 0; // real end
  +        int ct = 0; // real count
           boolean letters = false;
           boolean numbers = false;
   
           letters = ALPHABET.equals(type);
           numbers = NUMERIC.equals(type);
  -        if(ALPHANUMERIC.equals(type)) {
  +
  +        if (ALPHANUMERIC.equals(type)) {
               letters = true;
               numbers = true;
           }
   
           char[] setChrs = null;
  -        if( (text != null) && !text.equals("") ) {
  +
  +        if (!StringUtils.isBlank(text)) {
               setChrs = text.toCharArray();
           }
  -        
  -        try {
  -            if(NumberUtils.isNumber(start)) {
  -                st = NumberUtils.createNumber(start).intValue();
  -            } else {
  -                st = (int)start.charAt(0);
  +
  +        if (!StringUtils.isEmpty(start)) {
  +            try {
  +                if (NumberUtils.isNumber(start)) {
  +                    st = NumberUtils.createNumber(start).intValue();
  +                } else {
  +                    st = (int) start.charAt(0);
  +                }
  +            } catch (NumberFormatException nfe) {
  +            } catch (NullPointerException npe) { // easiest way to code it
               }
  -        } catch(NumberFormatException nfe) {
  -        } catch(NullPointerException npe) {   // easiest way to code it
           }
  -        try {
  -            if(NumberUtils.isNumber(end)) {
  -                ed = NumberUtils.createNumber(end).intValue();
  -            } else {
  -                ed = (int)end.charAt(0);
  +
  +        if (!StringUtils.isEmpty(end)) {
  +            try {
  +                if (NumberUtils.isNumber(end)) {
  +                    ed = NumberUtils.createNumber(end).intValue();
  +                } else {
  +                    ed = (int) end.charAt(0);
  +                }
  +            } catch (NumberFormatException nfe) {
  +                nfe.printStackTrace();
  +            } catch (NullPointerException npe) { // easiest way to code it
  +                npe.printStackTrace();
               }
  -        } catch(NumberFormatException nfe) {
  -        } catch(NullPointerException npe) {   // easiest way to code it
           }
   
  -        // if a set of chars is passed in, and no end has been 
  -        // passed in, then make the end be the end of the set
  -        if( (setChrs != null) && (ed == 0) ) {
  -            ed = setChrs.length - 1;
  -        }
  +        // if a set of chars is passed in, we need to be very cautions with its boundaries
  +        // NOTE: these checkings should be done by RandomStringUtils
  +		if ( (setChrs != null) ) {
  +			if ( st > setChrs.length-1 ) {
  +				st =0;
  +			}
  +			if ( ed == 0 || ed > setChrs.length-1 ) {
  +				ed = setChrs.length-1;
  +			}
   
  +        }
  +        
           try {
               ct = NumberUtils.createNumber(count).intValue();
  -        } catch(NumberFormatException nfe) {
  -        } catch(NullPointerException npe) {   // easiest way to code it
  -        }
  -        return RandomStringUtils.random(ct, st, ed, letters, numbers, setChrs);
  +        } catch (NumberFormatException nfe) {
  +            nfe.printStackTrace();
  +        } catch (NullPointerException npe) { // easiest way to code it
  +            npe.printStackTrace();
  +        }
  +
  +		String randomString = null;
  +		try {
  +	        randomString = RandomStringUtils.random(ct, st, ed, letters, numbers, setChrs);
  +		} catch ( Exception exc ) {
  +			// in the worst case scenario, be nice and return a random String....
  +			if ( letters && numbers ) {
  +				randomString = RandomStringUtils.randomAlphanumeric( ct );
  +			} else if ( letters ) {
  +				randomString = RandomStringUtils.randomNumeric( ct );
  +			} else if ( numbers ) {
  +				randomString = RandomStringUtils.randomNumeric( ct );
  +			} else {
  +				randomString = RandomStringUtils.random( ct );
  +			}
  +			StringBuffer msg = new StringBuffer();
  +			msg.append( "Exception on RandomStringTag: " + exc  );
  +			msg.append("\nCT: " + ct);
  +			msg.append("\nST: " + st);
  +			msg.append("\nED: " + ed);
  +			msg.append("\nletters: " + letters);
  +			msg.append("\nnumbers: " + numbers);
  +			msg.append("\nset: " + (setChrs == null ? "null" : ""+setChrs.length + " characters")
);
  +			msg.append("\nreturning " + randomString );
  +			System.err.println( msg.toString());
  +		}
  +		
  +		// TODO: RandomString is not working if body is set...
  +		/*
  +		System.err.println(">>>" + randomString + "<<<" );
  +		*/		
  +		return randomString;
       }
   
       public void initAttributes() {
           this.count = null;
           this.start = null;
  -        this.end   = null;
  -        this.type  = UNICODE;
  +        this.end = null;
  +        this.type = UNICODE;
       }
  -
   
   }
  
  
  
  1.8       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/RepeatTag.java
  
  Index: RepeatTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/RepeatTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RepeatTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ RepeatTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Repeat a string a particular number of times.
  
  
  
  1.11      +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/ReplaceTag.java
  
  Index: ReplaceTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/ReplaceTag.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ReplaceTag.java	6 Mar 2004 06:58:48 -0000	1.10
  +++ ReplaceTag.java	9 Mar 2004 00:54:45 -0000	1.11
  @@ -16,7 +16,7 @@
   package org.apache.taglibs.string;
   
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   import javax.servlet.jsp.JspException;
   
   /**
  
  
  
  1.8       +5 -5      jakarta-taglibs/string/src/org/apache/taglibs/string/ReverseDelimitedStringTag.java
  
  Index: ReverseDelimitedStringTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/ReverseDelimitedStringTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ReverseDelimitedStringTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ ReverseDelimitedStringTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -34,7 +34,7 @@
    */
   public class ReverseDelimitedStringTag extends StringTagSupport {
   
  -    private String delimiter;
  +    private char delimiter;
   
       public ReverseDelimitedStringTag() {
           super();
  @@ -45,7 +45,7 @@
        *
        * @return String property
        */
  -    public String getDelimiter() {
  +    public char getDelimiter() {
           return this.delimiter;
       }
   
  @@ -54,19 +54,19 @@
        *
        * @param delimiter String property
        */
  -    public void setDelimiter(String delimiter) {
  +    public void setDelimiter(char delimiter) {
           this.delimiter = delimiter;
       }
   
   
   
       public String changeString(String text) throws JspException {
  -        return StringUtils.reverseDelimitedString(text, delimiter);
  +        return StringUtils.reverseDelimited(text, delimiter);
       }
   
       public void initAttributes() {
   
  -        this.delimiter = ".";
  +        this.delimiter = '.';
   
       }
   
  
  
  
  1.8       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/RightPadTag.java
  
  Index: RightPadTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/RightPadTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RightPadTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ RightPadTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Right pad a string with a particular delimiter to a 
  
  
  
  1.6       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/RightTag.java
  
  Index: RightTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/RightTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RightTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ RightTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Gets the rightmost 'n' characters from a string.
  
  
  
  1.11      +18 -5     jakarta-taglibs/string/src/org/apache/taglibs/string/StringTagSupport.java
  
  Index: StringTagSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/StringTagSupport.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StringTagSupport.java	6 Mar 2004 06:58:48 -0000	1.10
  +++ StringTagSupport.java	9 Mar 2004 00:54:45 -0000	1.11
  @@ -65,7 +65,7 @@
       public void setVar(String var) {
           this.var = var;
       }
  -
  +       
       /**
        * Handles the manipulation of the String tag,
        * evaluating the body of the tag. The evaluation 
  @@ -73,10 +73,15 @@
        */
       public int doEndTag() throws JspException {
   
  -        if( (bodyContent == null) ) {
  -            return EVAL_PAGE;
  -        }
  -
  +	/*
  +	 *  Although most of the tags that extends must have a body, some don't, like RandomStringTag
  +	 *  So I'm removing the code below...
  +     */
  +		 
  +//       if( (bodyContent == null) && (!canBeEmpty()) ) {
  + //           return EVAL_PAGE;
  + //      }
  + 
           String text = "";
           if(bodyContent != null) {
               StringWriter body = new StringWriter();
  @@ -89,6 +94,14 @@
           }
           
           text = changeString(text);
  +        
  +        // TODO: RandomString is not working if body is set...
  +        /*
  +        System.err.println("...."+text+"....");
  +        if ( text  != null  ) {
  +        	System.out.println( "length = " + text.length());
  +        }
  +        */
           
           if(this.var == null) {
               JspWriter writer = pageContext.getOut();
  
  
  
  1.10      +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/SubstringTag.java
  
  Index: SubstringTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/SubstringTag.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SubstringTag.java	6 Mar 2004 06:58:48 -0000	1.9
  +++ SubstringTag.java	9 Mar 2004 00:54:45 -0000	1.10
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Get a specified substring from a larger String based 
  
  
  
  1.6       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/TruncateNicelyTag.java
  
  Index: TruncateNicelyTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/TruncateNicelyTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TruncateNicelyTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ TruncateNicelyTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.taglibs.string.util.StringW;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * A more intelligent substring.  It attempts to cut off a string after
  
  
  
  1.6       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/UncapitalizeTag.java
  
  Index: UncapitalizeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/UncapitalizeTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UncapitalizeTag.java	6 Mar 2004 06:58:48 -0000	1.5
  +++ UncapitalizeTag.java	9 Mar 2004 00:54:45 -0000	1.6
  @@ -31,7 +31,7 @@
   
   
       public String changeString(String text) throws JspException {
  -        return StringUtils.uncapitalise(text);
  +        return StringUtils.uncapitalize(text);
       }
   
       public void initAttributes() {
  
  
  
  1.8       +1 -1      jakarta-taglibs/string/src/org/apache/taglibs/string/WordWrapTag.java
  
  Index: WordWrapTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/WordWrapTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WordWrapTag.java	6 Mar 2004 06:58:48 -0000	1.7
  +++ WordWrapTag.java	9 Mar 2004 00:54:45 -0000	1.8
  @@ -17,7 +17,7 @@
   
   import javax.servlet.jsp.JspException;
   import org.apache.taglibs.string.util.StringW;
  -import org.apache.commons.lang.NumberUtils;
  +import org.apache.commons.lang.math.NumberUtils;
   
   /**
    * Word-wrap a String. This involves formatting a long 
  
  
  
  1.4       +0 -27     jakarta-taglibs/string/src/org/apache/taglibs/string/util/Metaphone.java
  
  Index: Metaphone.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/util/Metaphone.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Metaphone.java	6 Mar 2004 06:58:49 -0000	1.3
  +++ Metaphone.java	9 Mar 2004 00:54:45 -0000	1.4
  @@ -16,33 +16,6 @@
   //package com.bga.wbrogden.metaphone;
   package org.apache.taglibs.string.util;
   
  -/*                                                     Metaphone.java
  - * A class to generate phonetic code and keep lists of objects
  - *  retrievable by a phonetic code.
  - * reference: Computer Language of Dec. 1990, p 39
  - *  "Hanging on the Metaphone" by Lawrence Philips
  - *
  - * This Java implementation, William B. Brogden. December, 1997
  - *
  - * @author wbrogden@bga.com 
  - */
  -
  -/*
  - * List functionality removed: 2001-06-21 bayard@generationjava.com
  - */
  -
  -/* 
  - * Notes:
  - * The static method metaPhone converts an input String into a code.
  - *   All input is converted to upper case.
  - *   Limitations: Input format is expected to be a single ASCII word
  - *   with only characters in the A - Z range, no punctuation or numbers.
  - *
  - */
  -
  -import java.util.* ;
  -import java.io.* ;
  -
   public class Metaphone extends Object {
   
       static String vowels = "AEIOU" ;
  
  
  

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


Mime
View raw message