morgand     2003/01/25 15:20:17

  Modified:    jelly/jelly-tags/betwixt/src/java/org/apache/commons/jelly/tags/betwixt
                        IntrospectorTag.java ParseTag.java
  Log:
  converted betwixt taglib from Exception to JellyTagException
  
  Revision  Changes    Path
  1.5       +4 -1      
jakarta-commons-sandbox/jelly/jelly-tags/betwixt/src/java/org/apache/commons/jelly/tags/betwixt/IntrospectorTag.java
  
  Index: IntrospectorTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/betwixt/src/java/org/apache/commons/jelly/tags/betwixt/IntrospectorTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IntrospectorTag.java      11 Dec 2002 12:41:00 -0000      1.4
  +++ IntrospectorTag.java      25 Jan 2003 23:20:17 -0000      1.5
  @@ -64,11 +64,14 @@
   import org.apache.commons.beanutils.ConversionException;
   import org.apache.commons.beanutils.ConvertUtils;
   import org.apache.commons.beanutils.Converter;
  +
   import org.apache.commons.betwixt.XMLIntrospector;
   import org.apache.commons.betwixt.strategy.CapitalizeNameMapper;
   import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper;
   import org.apache.commons.betwixt.strategy.HyphenatedNameMapper;
   import org.apache.commons.betwixt.strategy.NameMapper;
  +
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.MissingAttributeException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
  @@ -121,7 +124,7 @@
   
       // Tag interface
       //-------------------------------------------------------------------------     
               
  -    public void doTag(final XMLOutput output) throws Exception {
  +    public void doTag(final XMLOutput output) throws MissingAttributeException, 
JellyTagException {
   
           if ( var == null ) {
               throw new MissingAttributeException( "var" );
  
  
  
  1.4       +27 -11    
jakarta-commons-sandbox/jelly/jelly-tags/betwixt/src/java/org/apache/commons/jelly/tags/betwixt/ParseTag.java
  
  Index: ParseTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/betwixt/src/java/org/apache/commons/jelly/tags/betwixt/ParseTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ParseTag.java     30 Oct 2002 19:16:31 -0000      1.3
  +++ ParseTag.java     25 Jan 2003 23:20:17 -0000      1.4
  @@ -61,12 +61,14 @@
    */
   package org.apache.commons.jelly.tags.betwixt;
   
  +import java.beans.IntrospectionException;
  +import java.io.IOException;
   import java.net.URL;
   
   import org.apache.commons.betwixt.XMLIntrospector;
   import org.apache.commons.betwixt.io.BeanReader;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.MissingAttributeException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
  @@ -74,6 +76,8 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  +import org.xml.sax.SAXException;
  +
   /** 
    * Parses some XML specified via the given URI (which can be relative or an 
absolute URL) and outputs the
    * parsed object. Typically this tag is customized by setting the introspector 
attribute or nesting a child
  @@ -104,7 +108,7 @@
   
       // Tag interface
       //-------------------------------------------------------------------------     
               
  -    public void doTag(final XMLOutput output) throws Exception {
  +    public void doTag(final XMLOutput output) throws MissingAttributeException, 
JellyTagException {
           if ( var == null ) {
               throw new MissingAttributeException( "var" );
           }
  @@ -119,25 +123,37 @@
               theClass = getClassLoader().loadClass( rootClass );
           }
           catch (Exception e) {
  -            throw new JellyException( "Could not load class called: " + rootClass, 
e );
  +            throw new JellyTagException( "Could not load class called: " + 
rootClass, e );
           }
           
           if ( theClass == null ) {
  -            throw new JellyException( "Could not load class called: " + rootClass );
  -        }        
  -        if ( path != null ) {
  -            reader.registerBeanClass( path, theClass );
  +            throw new JellyTagException( "Could not load class called: " + 
rootClass );
  +        }
  +
  +        try {       
  +            if ( path != null ) {
  +                reader.registerBeanClass( path, theClass );
  +            }
  +            else {
  +                reader.registerBeanClass( theClass );
  +            }
           }
  -        else {
  -            reader.registerBeanClass( theClass );
  +        catch (IntrospectionException e) {
  +            throw new JellyTagException(e);
           }
           
           Object value = null;
           if ( uri != null ) {
               invokeBody(output);
           
  -            URL url = context.getResource( uri );
  -            value = reader.parse( url.toString() );
  +            try {
  +                URL url = context.getResource( uri );
  +                value = reader.parse( url.toString() );
  +            } catch (IOException e) {
  +                throw new JellyTagException(e);
  +            } catch (SAXException e) {
  +                throw new JellyTagException(e);
  +            }
           }
           else {
   
  
  
  

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

Reply via email to