morgand 2003/01/25 18:02:09 Modified: jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt BundleTag.java FormatDateTag.java MessageTag.java ParamTag.java SetBundleTag.java SetLocaleTag.java SetTimeZoneTag.java TimeZoneTag.java Log: converted fmt from Exception to JellyTagException Revision Changes Path 1.2 +7 -7 jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/BundleTag.java Index: BundleTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/BundleTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BundleTag.java 16 Jan 2003 16:21:46 -0000 1.1 +++ BundleTag.java 26 Jan 2003 02:02:08 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header$ - * $Revision$ - * $Date$ + * /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/BundleTag.java,v 1.1 2003/01/16 16:21:46 jstrachan Exp + * 1.1 + * 2003/01/16 16:21:46 * * ==================================================================== * @@ -57,12 +57,12 @@ * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * - * $Id$ + * BundleTag.java,v 1.1 2003/01/16 16:21:46 jstrachan Exp */ package org.apache.commons.jelly.tags.fmt; import org.apache.commons.jelly.JellyContext; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.expression.Expression; @@ -76,7 +76,7 @@ * tag in JSTL. * * @author <a href="mailto:[EMAIL PROTECTED]">Willie Vu</a> - * @version $Revision$ + * @version 1.1 * * @task decide how to implement setResponseLocale */ @@ -131,7 +131,7 @@ * Evaluates this tag after all the tags properties have been initialized. * */ - public void doTag(XMLOutput output) throws Exception { + public void doTag(XMLOutput output) throws JellyTagException { Object basenameInput = null; if (this.basename != null) { basenameInput = this.basename.evaluate(context); 1.2 +20 -13 jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/FormatDateTag.java Index: FormatDateTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/FormatDateTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FormatDateTag.java 18 Jan 2003 06:35:27 -0000 1.1 +++ FormatDateTag.java 26 Jan 2003 02:02:08 -0000 1.2 @@ -61,11 +61,14 @@ */ package org.apache.commons.jelly.tags.fmt; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.Tag; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.expression.Expression; + +import org.xml.sax.SAXException; + import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -131,10 +134,10 @@ * Evaluates this tag after all the tags properties have been initialized. * */ - public void doTag(XMLOutput output) throws Exception { + public void doTag(XMLOutput output) throws JellyTagException { if (scope != null && var == null) { - throw new JellyException( + throw new JellyTagException( "If 'scope' is specified, 'var' must be defined for this tag" ); } @@ -214,7 +217,7 @@ } else if (etimeZone instanceof TimeZone) { tz = (TimeZone) etimeZone; } else { - throw new JellyException("Bad time zone"); + throw new JellyTagException("Bad time zone"); } } else { tz = TimeZoneTag.getTimeZone(context, this); @@ -237,8 +240,12 @@ } } else { - // write the formatted - output.write(formatted); + try { + // write the formatted + output.write(formatted); + } catch (SAXException e) { + throw new JellyTagException("could not write formatted text",e); + } } } @@ -309,7 +316,7 @@ //********************************************************************* // Private utility methods - private DateFormat createFormatter(Locale loc) throws JellyException { + private DateFormat createFormatter(Locale loc) throws JellyTagException { DateFormat formatter = null; if ((etype == null) || DATE.equalsIgnoreCase(etype)) { @@ -326,7 +333,7 @@ getStyle(etimeStyle, "FORMAT_DATE_INVALID_TIME_STYLE"), loc); } else { - throw new JellyException("Date format invalue"); + throw new JellyTagException("Date format invalue"); } return formatter; @@ -344,7 +351,7 @@ * @throws JellyException if the given style is invalid */ public static int getStyle(String style, String errCode) - throws JellyException { + throws JellyTagException { int ret = DateFormat.DEFAULT; if (style != null) { @@ -359,7 +366,7 @@ } else if (FULL.equalsIgnoreCase(style)) { ret = DateFormat.FULL; } else { - throw new JellyException("Invalid style " + errCode); + throw new JellyTagException("Invalid style " + errCode); } } 1.3 +17 -6 jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/MessageTag.java Index: MessageTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/MessageTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MessageTag.java 18 Jan 2003 06:22:47 -0000 1.2 +++ MessageTag.java 26 Jan 2003 02:02:08 -0000 1.3 @@ -61,11 +61,14 @@ */ package org.apache.commons.jelly.tags.fmt; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.Tag; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.expression.Expression; + +import org.xml.sax.SAXException; + import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -107,7 +110,7 @@ params.add(arg); } - public void doTag(XMLOutput output) throws Exception { + public void doTag(XMLOutput output) throws JellyTagException { Object keyInput = null; if (this.key != null) { keyInput = this.key.evaluate(context); @@ -118,8 +121,12 @@ } if ((keyInput == null) || keyInput.equals("")) { - output.write("??????"); - return; + try { + output.write("??????"); + } catch (SAXException e) { + throw new JellyTagException(e); + } + return; } Object bundleInput = null; @@ -182,7 +189,7 @@ context.setVariable(var, scope, message); } else { - throw new JellyException( "If 'scope' is specified, 'var' must be defined for this tag" ); + throw new JellyTagException( "If 'scope' is specified, 'var' must be defined for this tag" ); } } else { @@ -191,7 +198,11 @@ } else { // write the message - output.write(message); + try { + output.write(message); + } catch (SAXException e) { + throw new JellyTagException(e); + } } } } 1.2 +8 -8 jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/ParamTag.java Index: ParamTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/ParamTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ParamTag.java 16 Jan 2003 16:21:46 -0000 1.1 +++ ParamTag.java 26 Jan 2003 02:02:08 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header$ - * $Revision$ - * $Date$ + * /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/ParamTag.java,v 1.1 2003/01/16 16:21:46 jstrachan Exp + * 1.1 + * 2003/01/16 16:21:46 * * ==================================================================== * @@ -57,11 +57,11 @@ * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * - * $Id$ + * ParamTag.java,v 1.1 2003/01/16 16:21:46 jstrachan Exp */ package org.apache.commons.jelly.tags.fmt; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.Tag; import org.apache.commons.jelly.TagSupport; @@ -71,7 +71,7 @@ * Support for tag handlers for <param>, the parameter setting * tag in JSTL. * @author <a href="mailto:[EMAIL PROTECTED]">Willie Vu</a> - * @version $Revision$ + * @version 1.1 * * @task handle body content trimming */ @@ -88,14 +88,14 @@ * Evaluates this tag after all the tags properties have been initialized. * */ - public void doTag(XMLOutput output) throws Exception { + public void doTag(XMLOutput output) throws JellyTagException { MessageTag parent = null; Tag t = findAncestorWithClass(this, MessageTag.class); if (t != null) { parent = (MessageTag) t; } else { // must be nested inside a <fmt:message> action. - throw new JellyException("must be nested inside a <fmt:message> action."); + throw new JellyTagException("must be nested inside a <fmt:message> action."); } Object valueInput = null; 1.2 +7 -6 jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/SetBundleTag.java Index: SetBundleTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/SetBundleTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SetBundleTag.java 18 Jan 2003 06:35:27 -0000 1.1 +++ SetBundleTag.java 26 Jan 2003 02:02:08 -0000 1.2 @@ -61,6 +61,7 @@ */ package org.apache.commons.jelly.tags.fmt; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.expression.Expression; @@ -89,7 +90,7 @@ * Evaluates this tag after all the tags properties have been initialized. * */ - public void doTag(XMLOutput output) throws Exception { + public void doTag(XMLOutput output) throws JellyTagException { Object basenameInput = null; if (this.basename != null) { basenameInput = this.basename.evaluate(context); 1.3 +3 -3 jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/SetLocaleTag.java Index: SetLocaleTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/SetLocaleTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SetLocaleTag.java 18 Jan 2003 06:25:15 -0000 1.2 +++ SetLocaleTag.java 26 Jan 2003 02:02:08 -0000 1.3 @@ -62,7 +62,7 @@ package org.apache.commons.jelly.tags.fmt; import org.apache.commons.jelly.JellyContext; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.Tag; import org.apache.commons.jelly.TagSupport; @@ -73,7 +73,7 @@ * Support for tag handlers for <setLocale>, the locale setting * tag in JSTL. * @author <a href="mailto:[EMAIL PROTECTED]">Willie Vu</a> - * @version $Revision$ + * @version 1.2 * * @task decide how to implement setResponseLocale */ @@ -96,7 +96,7 @@ * Evaluates this tag after all the tags properties have been initialized. * */ - public void doTag(XMLOutput output) throws Exception { + public void doTag(XMLOutput output) throws JellyTagException { Locale locale = null; Object valueInput = null; 1.2 +5 -5 jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/SetTimeZoneTag.java Index: SetTimeZoneTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/SetTimeZoneTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SetTimeZoneTag.java 18 Jan 2003 06:35:27 -0000 1.1 +++ SetTimeZoneTag.java 26 Jan 2003 02:02:08 -0000 1.2 @@ -61,7 +61,7 @@ */ package org.apache.commons.jelly.tags.fmt; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.Tag; import org.apache.commons.jelly.TagSupport; @@ -91,7 +91,7 @@ * Evaluates this tag after all the tags properties have been initialized. * */ - public void doTag(XMLOutput output) throws Exception { + public void doTag(XMLOutput output) throws JellyTagException { TimeZone timeZone = null; Object valueInput = null; 1.2 +5 -5 jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/TimeZoneTag.java Index: TimeZoneTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/TimeZoneTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TimeZoneTag.java 18 Jan 2003 06:35:27 -0000 1.1 +++ TimeZoneTag.java 26 Jan 2003 02:02:08 -0000 1.2 @@ -62,7 +62,7 @@ package org.apache.commons.jelly.tags.fmt; import org.apache.commons.jelly.JellyContext; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.Tag; import org.apache.commons.jelly.TagSupport; @@ -109,7 +109,7 @@ * Evaluates this tag after all the tags properties have been initialized. * */ - public void doTag(XMLOutput output) throws Exception { + public void doTag(XMLOutput output) throws JellyTagException { Object valueInput = null; if (this.value != null) { valueInput = this.value.evaluate(context);
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>