morgand     2003/01/23 21:54:37

  Modified:    jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing
                        TableModelColumnTag.java
               jelly/src/java/org/apache/commons/jelly DynaTag.java
                        DynaTagSupport.java JellyContext.java
               jelly/src/java/org/apache/commons/jelly/tags/core
                        UseListTag.java
  Log:
  converting Exceptions to JellyExceptions
  
  Revision  Changes    Path
  1.4       +1 -1      
jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TableModelColumnTag.java
  
  Index: TableModelColumnTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TableModelColumnTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TableModelColumnTag.java  11 Dec 2002 12:40:57 -0000      1.3
  +++ TableModelColumnTag.java  24 Jan 2003 05:54:37 -0000      1.4
  @@ -78,7 +78,7 @@
           return (ExpressionTableColumn) getBean();
       }    
           
  -    public Class getAttributeType(String name) throws Exception {
  +    public Class getAttributeType(String name) throws JellyException {
           if (name.equals("value")) {
               return Expression.class;
           }
  
  
  
  1.7       +7 -7      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/DynaTag.java
  
  Index: DynaTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/DynaTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DynaTag.java      30 Oct 2002 19:16:26 -0000      1.6
  +++ DynaTag.java      24 Jan 2003 05:54:37 -0000      1.7
  @@ -81,7 +81,7 @@
   
       /** Sets an attribute value of this tag before the tag is invoked
        */
  -    public void setAttribute(String name, Object value) throws Exception;
  +    public void setAttribute(String name, Object value) throws JellyException;
   
       /**
        * @return the type of the given attribute. By default just return
  @@ -89,5 +89,5 @@
        * If this method returns Expression.class then the expression will not
        * be evaluated and just passed in as the attribute value.
        */
  -    public Class getAttributeType(String name) throws Exception;
  +    public Class getAttributeType(String name) throws JellyException;
   }
  
  
  
  1.3       +1 -1      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/DynaTagSupport.java
  
  Index: DynaTagSupport.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/DynaTagSupport.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DynaTagSupport.java       30 Oct 2002 19:16:26 -0000      1.2
  +++ DynaTagSupport.java       24 Jan 2003 05:54:37 -0000      1.3
  @@ -77,7 +77,7 @@
        * @return the type of the given attribute. By default just return
        * Object.class if this is not known.
        */
  -    public Class getAttributeType(String name) throws Exception {
  +    public Class getAttributeType(String name) throws JellyException {
           return Object.class;
       }
   }
  
  
  
  1.40      +62 -17    
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java
  
  Index: JellyContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- JellyContext.java 11 Jan 2003 10:12:11 -0000      1.39
  +++ JellyContext.java 24 Jan 2003 05:54:37 -0000      1.40
  @@ -63,6 +63,7 @@
   
   import java.io.File;
   import java.io.InputStream;
  +import java.io.IOException;
   import java.net.MalformedURLException;
   import java.net.URL;
   import java.util.Hashtable;
  @@ -73,6 +74,8 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  +import org.xml.sax.SAXException;
  +
   /** <p><code>JellyContext</code> represents the Jelly context.</p>
     *
     * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  @@ -210,7 +213,7 @@
               try {
                   answer = System.getProperty(name);
               }
  -            catch (Throwable t) {
  +            catch (SecurityException e) {
                   // ignore security exceptions
               }
           }
  @@ -451,14 +454,22 @@
        * Attempts to parse the script from the given uri using the 
        * {@link #getResource} method then returns the compiled script.
        */
  -    public Script compileScript(String uri) throws Exception {
  +    public Script compileScript(String uri) throws JellyException {
           XMLParser parser = new XMLParser();
           parser.setContext(this);
           InputStream in = getResourceAsStream(uri);
           if (in == null) {
               throw new JellyException("Could not find Jelly script: " + uri);
           }
  -        Script script = parser.parse(in);
  +        Script script = null;
  +        try {
  +            script = parser.parse(in);
  +        } catch (IOException e) {
  +            throw new JellyException("Could not parse Jelly script",e);
  +        } catch (SAXException e) {
  +            throw new JellyException("Could not parse Jelly script",e);
  +        }
  +        
           return script.compile();
       }
   
  @@ -466,10 +477,19 @@
        * Attempts to parse the script from the given URL using the 
        * {@link #getResource} method then returns the compiled script.
        */
  -    public Script compileScript(URL url) throws Exception {
  +    public Script compileScript(URL url) throws JellyException {
           XMLParser parser = getXMLParser();
           parser.setContext(this);
  -        Script script = parser.parse(url.toString());
  +        
  +        Script script = null;
  +        try {
  +            script = parser.parse(url.toString());
  +        } catch (IOException e) {
  +            throw new JellyException("Could not parse Jelly script",e);
  +        } catch (SAXException e) {
  +            throw new JellyException("Could not parse Jelly script",e);
  +        }
  +        
           return script.compile();
       }
   
  @@ -491,9 +511,13 @@
        * 
        * @return the new child context that was used to run the script
        */
  -    public JellyContext runScript(File file, XMLOutput output) throws Exception {
  -        return runScript(file.toURL(), output, JellyContext.DEFAULT_EXPORT,
  -            JellyContext.DEFAULT_INHERIT);
  +    public JellyContext runScript(File file, XMLOutput output) throws 
JellyException {
  +        try {
  +            return runScript(file.toURL(), output, JellyContext.DEFAULT_EXPORT,
  +                JellyContext.DEFAULT_INHERIT);
  +        } catch (MalformedURLException e) {
  +            throw new JellyException(e.toString());
  +        }
       }
   
       /** 
  @@ -501,7 +525,7 @@
        * 
        * @return the new child context that was used to run the script
        */
  -    public JellyContext runScript(URL url, XMLOutput output) throws Exception {
  +    public JellyContext runScript(URL url, XMLOutput output) throws JellyException {
           return runScript(url, output, JellyContext.DEFAULT_EXPORT,
               JellyContext.DEFAULT_INHERIT);
       }
  @@ -512,8 +536,14 @@
        * 
        * @return the new child context that was used to run the script
        */
  -    public JellyContext runScript(String uri, XMLOutput output) throws Exception {
  -        URL url = getResource(uri);
  +    public JellyContext runScript(String uri, XMLOutput output) throws 
JellyException {
  +        URL url = null;
  +        try {
  +            url = getResource(uri);
  +        } catch (MalformedURLException e) {
  +            throw new JellyException(e.toString());
  +        }
  +        
           if (url == null) {
               throw new JellyException("Could not find Jelly script: " + url);
           }
  @@ -528,8 +558,14 @@
        * @return the new child context that was used to run the script
        */
       public JellyContext runScript(String uri, XMLOutput output,
  -                          boolean export, boolean inherit) throws Exception {
  -        URL url = getResource(uri);
  +                          boolean export, boolean inherit) throws JellyException {
  +        URL url = null;
  +        try {
  +            url = getResource(uri);
  +        } catch (MalformedURLException e) {
  +            throw new JellyException(e.toString());
  +        }
  +        
           if (url == null) {
               throw new JellyException("Could not find Jelly script: " + url);
           }
  @@ -543,8 +579,12 @@
        * @return the new child context that was used to run the script
        */
       public JellyContext runScript(File file, XMLOutput output,
  -                          boolean export, boolean inherit) throws Exception {
  -        return runScript(file.toURL(), output, export, inherit);
  +                          boolean export, boolean inherit) throws JellyException {
  +        try {
  +            return runScript(file.toURL(), output, export, inherit);
  +        } catch (MalformedURLException e) {
  +            throw new JellyException(e.toString());
  +        }
       }
   
       /** 
  @@ -553,10 +593,15 @@
        * @return the new child context that was used to run the script
        */
       public JellyContext runScript(URL url, XMLOutput output,
  -                          boolean export, boolean inherit) throws Exception {
  +                          boolean export, boolean inherit) throws JellyException {
           Script script = compileScript(url);
           
  -        URL newJellyContextURL = getJellyContextURL(url);
  +        URL newJellyContextURL = null;
  +        try {
  +            newJellyContextURL = getJellyContextURL(url);
  +        } catch (MalformedURLException e) {
  +            throw new JellyException(e.toString());
  +        }
           
           JellyContext newJellyContext = new JellyContext(this, newJellyContextURL);
           newJellyContext.setExport( export );
  
  
  
  1.5       +2 -1      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseListTag.java
  
  Index: UseListTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseListTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UseListTag.java   30 Oct 2002 19:16:20 -0000      1.4
  +++ UseListTag.java   24 Jan 2003 05:54:37 -0000      1.5
  @@ -61,6 +61,7 @@
   import java.util.List;
   import java.util.Map;
   
  +import org.apache.commons.jelly.JellyException;
   import org.apache.commons.jelly.expression.Expression;
   import org.apache.commons.jelly.impl.CollectionTag;
   
  @@ -94,7 +95,7 @@
       
       // DynaTag interface
       //-------------------------------------------------------------------------     
               
  -    public Class getAttributeType(String name) throws Exception {
  +    public Class getAttributeType(String name) throws JellyException {
           if (name.equals("items")) {
               return Expression.class;
           }
  
  
  

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

Reply via email to