jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gl...@apache.org
Subject cvs commit: jakarta-taglibs/datetime/src/org/apache/taglibs/datetime FormatTag.java
Date Thu, 26 Apr 2001 01:55:53 GMT
glenn       01/04/25 18:55:52

  Modified:    datetime/src/org/apache/taglibs/datetime FormatTag.java
  Log:
  Ignore whitespace in tag body
  
  Revision  Changes    Path
  1.3       +17 -4     jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/FormatTag.java
  
  Index: FormatTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/FormatTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FormatTag.java	2000/11/06 01:19:07	1.2
  +++ FormatTag.java	2001/04/26 01:55:49	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/FormatTag.java,v
1.2 2000/11/06 01:19:07 glenn Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/11/06 01:19:07 $
  + * $Header: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/FormatTag.java,v
1.3 2001/04/26 01:55:49 glenn Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/04/26 01:55:49 $
    *
    * ====================================================================
    *
  @@ -142,7 +142,20 @@
   	String s = body.getString();  
   	// Clear the body since we will output only the formatted date
   	body.clearBody();
  -	long time = Long.valueOf(s).longValue();
  +	StringTokenizer st = new StringTokenizer(s,"\r\n\t\f ");
  +	String val = s;
  +	while( st.hasMoreTokens() ) {
  +	    val = st.nextToken();
  +	    if( val != null && val.length() > 0 )
  +		break;
  +	}
  +	long time;
  +	try {
  +	    time = Long.valueOf(val).longValue();
  +	} catch(NumberFormatException nfe) {
  +	    date_formatted = "Invalid Date";
  +	    return SKIP_BODY;
  +	}
   	Date date = new Date(time);
   	SimpleDateFormat sdf;
   	// Get the default pattern if none defined
  
  
  

Mime
View raw message