You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Tom Klaasen (TeleRelay)" <to...@telerelay.com> on 2001/11/16 13:11:55 UTC

RE: Exception handling --- suggestion for improvements ---- (e.g., templatetag masks original exception) correction in sample code

Tomcat 4 implements the servlet2.3 spec, although I'm not sure the spec
itself is final already.

And Tomcat 4 runs fine on jdk1.3, so I don't suppose they (and thus the
spec) use the jdk1.4 features. 

tomK


> -----Original Message-----
> From: MMHohman@thoughtworks.com [mailto:MMHohman@thoughtworks.com] 
> Sent: vrijdag 16 november 2001 12:26
> To: Struts Developers List
> Subject: RE: Exception handling --- suggestion for 
> improvements ---- (e.g., templatetag masks original 
> exception) correction in sample code
> 
> 
> 
> Ahh, oops.
> 
> Or, use the servlet 2.3 API when it comes out (anyone know if 
> that API uses
> the new Java 1.4 feature?).
> 
> M
> 
> 
> 
>                                                               
>                                                               
>                      
>                     "Tom Klaasen                              
>                                                               
>                      
>                     (TeleRelay)"            To:     "Struts 
> Developers List" <st...@jakarta.apache.org>              
>                        
>                     <tom.klaasen@tele       cc:               
>                                                               
>                      
>                     relay.com>              Subject:     RE: 
> Exception handling --- suggestion for improvements ---- 
> (e.g., template tag masks   
>                                              original 
> exception) correction in sample code                          
>                              
>                     11/16/2001 03:33                          
>                                                               
>                      
>                     PM                                        
>                                                               
>                      
>                     Please respond to                         
>                                                               
>                      
>                     "Struts                                   
>                                                               
>                      
>                     Developers List"                          
>                                                               
>                      
>                                                               
>                                                               
>                      
>                                                               
>                                                               
>                      
> 
> 
> 
> 
> OK, my mistake, this seems to be valid only for servlet 2.3 spec, not
> 2.2. Servlet 2.2 has no such feature whatsoever.
> 
> For my defense, I can say that Sun should use the @since tag 
> more often
> ;)
> 
> tomK
> 
> 
> > -----Original Message-----
> > From: Tom Klaasen (TeleRelay)
> > Sent: vrijdag 16 november 2001 9:49
> > To: Struts Developers List
> > Subject: RE: Exception handling --- suggestion for
> > improvements ---- (e.g., template tag masks original
> > exception) correction in sample code
> >
> >
> > Maybe I'll have to disappoint you about constructing a new Exception
> > class.
> > Did you have a look at
> > http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/js
> > p/JspExcep
> > tion.html#JspException(java.lang.String,%20java.lang.Throwable
> > ) ? Looks
> > to me this does _exactly_ what you're trying to do.
> >
> > However, I agree that Struts should not call new
> > JspException(e.getMessage()), but new JspException("Some intelligent
> > message", e); instead. This leaves the decision of what to 
> display to
> > the programmer.
> >
> > tomK
> >
> >
> >
> > > -----Original Message-----
> > > From: Rick Hightower [mailto:rick@eblox.com]
> > > Sent: vrijdag 16 november 2001 9:24
> > > To: Struts Developers List
> > > Subject: Exception handling --- suggestion for improvements
> > > ---- (e.g., template tag masks original exception) correction
> > > in sample code
> > >
> > >
> > >
> > > We have been using struts for a good while. We really dig the
> > > framework,
> > > but...
> > >
> > > Often times the struts tags catch the original exception (e.g.,
> > > ClassCastException), and then throw a JspException; thus, 
> losing the
> > > original stack trace. This hides\masks the original
> > > exception. Hiding the
> > > orginal stack trace makes it harder to debug the problem.
> > >
> > > I wrote a JSPWrapperException that preserves the orginal
> > > stack trace for
> > > debugging.
> > > JSPWrapperException extends JspWrapper; however, like
> > > ServletException, it
> > > captures the original stack trace and displays it for
> > > debugging, i.e., the
> > > JSPWrapperException prints out the original stack trace of
> > > the original
> > > exception. This is a real boon for debugging.
> > >
> > > I modified 50 or so files in our copy of the struts code 
> base (a 1.0
> > > derivative with some bug fixes and extra error handing) to use the
> > > JSPWrapperException instead of the JspException.
> > >
> > > It cost about an hour to make the changes, but I feel it will
> > > save us hours
> > > of debugging in the future.
> > >
> > > There is an ant build file with struts so making the changes
> > > and creating
> > > struts.jar was easy.
> > >
> > >
> > >
> > > I search the struts code base for code like this.... 
> (example code)
> > >
> > > try{
> > > }
> > > catch(XYZException e){
> > >        throw new JspException(e.getMessage());
> > > }
> > >
> > > to code that looks like this
> > > try{
> > > }
> > > catch(XYZException e){
> > >        throw new JspWrapperException(e, e.getMessage());
> > > }
> > >
> > >
> > > BTW Here is the code for JspWrapperException....
> > >
> > > Enjoy.....
> > >
> > > /*
> > >  * JspWrapperException.java
> > >  *
> > >  * Created on November 15, 2001, 11:14 PM
> > >  */
> > >
> > > package org.apache.struts.util;
> > > import javax.servlet.jsp.JspException;
> > >
> > > /**
> > >  *
> > >  * @author  rick
> > >  */
> > > public class JspWrapperException extends JspException  {
> > >
> > >         Exception e;
> > >
> > >     /**
> > >      * @param     Exception e
> > >      * @param     String message
> > >      */
> > >     public JspWrapperException(Exception e, String message) {
> > >         super(message);
> > >         this.e = e;
> > >     }
> > >
> > >     /**
> > >      */
> > >     public void printStackTrace () {
> > >         super.printStackTrace();
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         if (e != null) {
> > >             System.err.println("--------------- extended Exception
> > > nest ----------- ");
> > >             e.printStackTrace();
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @param ps
> > >      */
> > >     public void printStackTrace (java.io.PrintStream ps) {
> > >         super.printStackTrace(ps);
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         if (e != null) {
> > >             ps.println("--------------- extended Exception
> > > nest -----------
> > > ");
> > >             e.printStackTrace(ps);
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @param pw
> > >      */
> > >     public void printStackTrace (java.io.PrintWriter pw) {
> > >         super.printStackTrace(pw);
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >             //
> > >             //Nested exception
> > >         if (e != null) {
> > >             pw.println("--------------- extended Exception
> > > nest -----------
> > > ");
> > >             e.printStackTrace(pw);
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @return
> > >      */
> > >     public String getMessage () {
> > >         StringBuffer message = new StringBuffer(150);
> > >         message.append(super.getMessage());
> > >
> > >             //
> > >             //add Line separator
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         message.append(sep);
> > >
> > >             //
> > >             //Add the nested exception
> > >         if (e != null) {
> > >             message.append(e.getMessage());
> > >             //char = props["line.separator"]
> > >         }
> > >         return  message.toString();
> > >     }
> > > }
> > >
> > >
> > >
> > > Rick Hightower
> > > Director of Development
> > > eBlox, Inc.
> > >
> > > Check out our new website!
> > > www.eblox.com
> > >
> > > Contact Info:
> > > eBlox Tucson
> > > phone: 520-615-9345 x103
> > > fax: 520-529-5774
> > >
> > > Rick's stuff:
> > > http://www.eblox.com/people_detail.php?id=52
> > > http://www.geocities.com/rick_m_hightower/
> > > http://www.brainbench.com/transcript.jsp?pid=2351036
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > > additional commands,
> > > e-mail: <ma...@jakarta.apache.org>
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > > additional commands,
> > > e-mail: <ma...@jakarta.apache.org>
> > >
> > >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > For
> > additional commands,
> > e-mail: <ma...@jakarta.apache.org>
> >
> >
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-dev-> unsubscribe@jakarta.apache.org
> >
> For 
> additional commands, 
> e-mail: <mailto:struts-dev-help@jakarta.apache.org
> >
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Exception handling --- suggestion for improvements ---- (e.g., templatetag masks original exception) correction in sample code

Posted by Rick Hightower <ri...@eblox.com>.
Not having the @since reallly threw me off for a second when you sent that
note.
I had to go check the older API.


Rick Hightower
Director of Development
eBlox, Inc.

Check out our new website!
www.eblox.com

Contact Info:
eBlox Tucson
phone: 520-615-9345 x103
fax: 520-529-5774

Rick's stuff:
http://www.eblox.com/people_detail.php?id=52
http://www.geocities.com/rick_m_hightower/
http://www.brainbench.com/transcript.jsp?pid=2351036


-----Original Message-----
From: Tom Klaasen (TeleRelay) [mailto:tom.klaasen@telerelay.com]
Sent: Friday, November 16, 2001 5:12 AM
To: Struts Developers List
Subject: RE: Exception handling --- suggestion for improvements ----
(e.g., templatetag masks original exception) correction in sample code


Tomcat 4 implements the servlet2.3 spec, although I'm not sure the spec
itself is final already.

And Tomcat 4 runs fine on jdk1.3, so I don't suppose they (and thus the
spec) use the jdk1.4 features.

tomK


> -----Original Message-----
> From: MMHohman@thoughtworks.com [mailto:MMHohman@thoughtworks.com]
> Sent: vrijdag 16 november 2001 12:26
> To: Struts Developers List
> Subject: RE: Exception handling --- suggestion for
> improvements ---- (e.g., templatetag masks original
> exception) correction in sample code
>
>
>
> Ahh, oops.
>
> Or, use the servlet 2.3 API when it comes out (anyone know if
> that API uses
> the new Java 1.4 feature?).
>
> M
>
>
>
>
>
>
>                     "Tom Klaasen
>
>
>                     (TeleRelay)"            To:     "Struts
> Developers List" <st...@jakarta.apache.org>
>
>                     <tom.klaasen@tele       cc:
>
>
>                     relay.com>              Subject:     RE:
> Exception handling --- suggestion for improvements ----
> (e.g., template tag masks
>                                              original
> exception) correction in sample code
>
>                     11/16/2001 03:33
>
>
>                     PM
>
>
>                     Please respond to
>
>
>                     "Struts
>
>
>                     Developers List"
>
>
>
>
>
>
>
>
>
>
>
>
> OK, my mistake, this seems to be valid only for servlet 2.3 spec, not
> 2.2. Servlet 2.2 has no such feature whatsoever.
>
> For my defense, I can say that Sun should use the @since tag
> more often
> ;)
>
> tomK
>
>
> > -----Original Message-----
> > From: Tom Klaasen (TeleRelay)
> > Sent: vrijdag 16 november 2001 9:49
> > To: Struts Developers List
> > Subject: RE: Exception handling --- suggestion for
> > improvements ---- (e.g., template tag masks original
> > exception) correction in sample code
> >
> >
> > Maybe I'll have to disappoint you about constructing a new Exception
> > class.
> > Did you have a look at
> > http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/js
> > p/JspExcep
> > tion.html#JspException(java.lang.String,%20java.lang.Throwable
> > ) ? Looks
> > to me this does _exactly_ what you're trying to do.
> >
> > However, I agree that Struts should not call new
> > JspException(e.getMessage()), but new JspException("Some intelligent
> > message", e); instead. This leaves the decision of what to
> display to
> > the programmer.
> >
> > tomK
> >
> >
> >
> > > -----Original Message-----
> > > From: Rick Hightower [mailto:rick@eblox.com]
> > > Sent: vrijdag 16 november 2001 9:24
> > > To: Struts Developers List
> > > Subject: Exception handling --- suggestion for improvements
> > > ---- (e.g., template tag masks original exception) correction
> > > in sample code
> > >
> > >
> > >
> > > We have been using struts for a good while. We really dig the
> > > framework,
> > > but...
> > >
> > > Often times the struts tags catch the original exception (e.g.,
> > > ClassCastException), and then throw a JspException; thus,
> losing the
> > > original stack trace. This hides\masks the original
> > > exception. Hiding the
> > > orginal stack trace makes it harder to debug the problem.
> > >
> > > I wrote a JSPWrapperException that preserves the orginal
> > > stack trace for
> > > debugging.
> > > JSPWrapperException extends JspWrapper; however, like
> > > ServletException, it
> > > captures the original stack trace and displays it for
> > > debugging, i.e., the
> > > JSPWrapperException prints out the original stack trace of
> > > the original
> > > exception. This is a real boon for debugging.
> > >
> > > I modified 50 or so files in our copy of the struts code
> base (a 1.0
> > > derivative with some bug fixes and extra error handing) to use the
> > > JSPWrapperException instead of the JspException.
> > >
> > > It cost about an hour to make the changes, but I feel it will
> > > save us hours
> > > of debugging in the future.
> > >
> > > There is an ant build file with struts so making the changes
> > > and creating
> > > struts.jar was easy.
> > >
> > >
> > >
> > > I search the struts code base for code like this....
> (example code)
> > >
> > > try{
> > > }
> > > catch(XYZException e){
> > >        throw new JspException(e.getMessage());
> > > }
> > >
> > > to code that looks like this
> > > try{
> > > }
> > > catch(XYZException e){
> > >        throw new JspWrapperException(e, e.getMessage());
> > > }
> > >
> > >
> > > BTW Here is the code for JspWrapperException....
> > >
> > > Enjoy.....
> > >
> > > /*
> > >  * JspWrapperException.java
> > >  *
> > >  * Created on November 15, 2001, 11:14 PM
> > >  */
> > >
> > > package org.apache.struts.util;
> > > import javax.servlet.jsp.JspException;
> > >
> > > /**
> > >  *
> > >  * @author  rick
> > >  */
> > > public class JspWrapperException extends JspException  {
> > >
> > >         Exception e;
> > >
> > >     /**
> > >      * @param     Exception e
> > >      * @param     String message
> > >      */
> > >     public JspWrapperException(Exception e, String message) {
> > >         super(message);
> > >         this.e = e;
> > >     }
> > >
> > >     /**
> > >      */
> > >     public void printStackTrace () {
> > >         super.printStackTrace();
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         if (e != null) {
> > >             System.err.println("--------------- extended Exception
> > > nest ----------- ");
> > >             e.printStackTrace();
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @param ps
> > >      */
> > >     public void printStackTrace (java.io.PrintStream ps) {
> > >         super.printStackTrace(ps);
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         if (e != null) {
> > >             ps.println("--------------- extended Exception
> > > nest -----------
> > > ");
> > >             e.printStackTrace(ps);
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @param pw
> > >      */
> > >     public void printStackTrace (java.io.PrintWriter pw) {
> > >         super.printStackTrace(pw);
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >             //
> > >             //Nested exception
> > >         if (e != null) {
> > >             pw.println("--------------- extended Exception
> > > nest -----------
> > > ");
> > >             e.printStackTrace(pw);
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @return
> > >      */
> > >     public String getMessage () {
> > >         StringBuffer message = new StringBuffer(150);
> > >         message.append(super.getMessage());
> > >
> > >             //
> > >             //add Line separator
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         message.append(sep);
> > >
> > >             //
> > >             //Add the nested exception
> > >         if (e != null) {
> > >             message.append(e.getMessage());
> > >             //char = props["line.separator"]
> > >         }
> > >         return  message.toString();
> > >     }
> > > }
> > >
> > >
> > >
> > > Rick Hightower
> > > Director of Development
> > > eBlox, Inc.
> > >
> > > Check out our new website!
> > > www.eblox.com
> > >
> > > Contact Info:
> > > eBlox Tucson
> > > phone: 520-615-9345 x103
> > > fax: 520-529-5774
> > >
> > > Rick's stuff:
> > > http://www.eblox.com/people_detail.php?id=52
> > > http://www.geocities.com/rick_m_hightower/
> > > http://www.brainbench.com/transcript.jsp?pid=2351036
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > > additional commands,
> > > e-mail: <ma...@jakarta.apache.org>
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > > additional commands,
> > > e-mail: <ma...@jakarta.apache.org>
> > >
> > >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > For
> > additional commands,
> > e-mail: <ma...@jakarta.apache.org>
> >
> >
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-dev-> unsubscribe@jakarta.apache.org
> >
> For
> additional commands,
> e-mail: <mailto:struts-dev-help@jakarta.apache.org
> >
>
>
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> For
> additional commands,
> e-mail: <ma...@jakarta.apache.org>
>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Exception handling --- suggestion for improvements ---- (e.g., templatetag masks original exception) correction in sample code

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Nov 2001, Tom Klaasen (TeleRelay) wrote:

> Date: Fri, 16 Nov 2001 13:11:55 +0100
> From: "Tom Klaasen (TeleRelay)" <to...@telerelay.com>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: Struts Developers List <st...@jakarta.apache.org>
> Subject: RE: Exception handling --- suggestion for improvements ---- (e.g.,
>      templatetag masks original exception) correction in sample code
>
> Tomcat 4 implements the servlet2.3 spec, although I'm not sure the spec
> itself is final already.
>

It is (and JSP 1.2 and all the rest of J2EE 1.3), as of October 17.

> And Tomcat 4 runs fine on jdk1.3, so I don't suppose they (and thus the
> spec) use the jdk1.4 features.
>

Or 1.3 features either ... Tomcat 4 will run on JDK 1.2.2.

> tomK
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Exception handling --- suggestion for improvements ---- (e.g., templatetag masks original exception) correction in sample code

Posted by Nicholas Lesiecki <ni...@eblox.com>.
Agreed, Tomcat and Resin (our current App server of choice) both implement
Servlet 2.3. However, can we make Struts incompatible with 2.2? Probably
not... So it makes sense to keep a custom JSPWrapper exception in the
meantime. I would dearly like to see this change implemented in the Struts
1.0.1 release as having the original stack trace (especially when using
BeanUtils or other reflection based functionality) speeds debugging by a
factor of 2 or so.

Cheers,

nick

-----Original Message-----
From: Tom Klaasen (TeleRelay) [mailto:tom.klaasen@telerelay.com]
Sent: Friday, November 16, 2001 5:12 AM
To: Struts Developers List
Subject: RE: Exception handling --- suggestion for improvements ----
(e.g., templatetag masks original exception) correction in sample code


Tomcat 4 implements the servlet2.3 spec, although I'm not sure the spec
itself is final already.

And Tomcat 4 runs fine on jdk1.3, so I don't suppose they (and thus the
spec) use the jdk1.4 features.

tomK


> -----Original Message-----
> From: MMHohman@thoughtworks.com [mailto:MMHohman@thoughtworks.com]
> Sent: vrijdag 16 november 2001 12:26
> To: Struts Developers List
> Subject: RE: Exception handling --- suggestion for
> improvements ---- (e.g., templatetag masks original
> exception) correction in sample code
>
>
>
> Ahh, oops.
>
> Or, use the servlet 2.3 API when it comes out (anyone know if
> that API uses
> the new Java 1.4 feature?).
>
> M
>
>
>
>
>
>
>                     "Tom Klaasen
>
>
>                     (TeleRelay)"            To:     "Struts
> Developers List" <st...@jakarta.apache.org>
>
>                     <tom.klaasen@tele       cc:
>
>
>                     relay.com>              Subject:     RE:
> Exception handling --- suggestion for improvements ----
> (e.g., template tag masks
>                                              original
> exception) correction in sample code
>
>                     11/16/2001 03:33
>
>
>                     PM
>
>
>                     Please respond to
>
>
>                     "Struts
>
>
>                     Developers List"
>
>
>
>
>
>
>
>
>
>
>
>
> OK, my mistake, this seems to be valid only for servlet 2.3 spec, not
> 2.2. Servlet 2.2 has no such feature whatsoever.
>
> For my defense, I can say that Sun should use the @since tag
> more often
> ;)
>
> tomK
>
>
> > -----Original Message-----
> > From: Tom Klaasen (TeleRelay)
> > Sent: vrijdag 16 november 2001 9:49
> > To: Struts Developers List
> > Subject: RE: Exception handling --- suggestion for
> > improvements ---- (e.g., template tag masks original
> > exception) correction in sample code
> >
> >
> > Maybe I'll have to disappoint you about constructing a new Exception
> > class.
> > Did you have a look at
> > http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/js
> > p/JspExcep
> > tion.html#JspException(java.lang.String,%20java.lang.Throwable
> > ) ? Looks
> > to me this does _exactly_ what you're trying to do.
> >
> > However, I agree that Struts should not call new
> > JspException(e.getMessage()), but new JspException("Some intelligent
> > message", e); instead. This leaves the decision of what to
> display to
> > the programmer.
> >
> > tomK
> >
> >
> >
> > > -----Original Message-----
> > > From: Rick Hightower [mailto:rick@eblox.com]
> > > Sent: vrijdag 16 november 2001 9:24
> > > To: Struts Developers List
> > > Subject: Exception handling --- suggestion for improvements
> > > ---- (e.g., template tag masks original exception) correction
> > > in sample code
> > >
> > >
> > >
> > > We have been using struts for a good while. We really dig the
> > > framework,
> > > but...
> > >
> > > Often times the struts tags catch the original exception (e.g.,
> > > ClassCastException), and then throw a JspException; thus,
> losing the
> > > original stack trace. This hides\masks the original
> > > exception. Hiding the
> > > orginal stack trace makes it harder to debug the problem.
> > >
> > > I wrote a JSPWrapperException that preserves the orginal
> > > stack trace for
> > > debugging.
> > > JSPWrapperException extends JspWrapper; however, like
> > > ServletException, it
> > > captures the original stack trace and displays it for
> > > debugging, i.e., the
> > > JSPWrapperException prints out the original stack trace of
> > > the original
> > > exception. This is a real boon for debugging.
> > >
> > > I modified 50 or so files in our copy of the struts code
> base (a 1.0
> > > derivative with some bug fixes and extra error handing) to use the
> > > JSPWrapperException instead of the JspException.
> > >
> > > It cost about an hour to make the changes, but I feel it will
> > > save us hours
> > > of debugging in the future.
> > >
> > > There is an ant build file with struts so making the changes
> > > and creating
> > > struts.jar was easy.
> > >
> > >
> > >
> > > I search the struts code base for code like this....
> (example code)
> > >
> > > try{
> > > }
> > > catch(XYZException e){
> > >        throw new JspException(e.getMessage());
> > > }
> > >
> > > to code that looks like this
> > > try{
> > > }
> > > catch(XYZException e){
> > >        throw new JspWrapperException(e, e.getMessage());
> > > }
> > >
> > >
> > > BTW Here is the code for JspWrapperException....
> > >
> > > Enjoy.....
> > >
> > > /*
> > >  * JspWrapperException.java
> > >  *
> > >  * Created on November 15, 2001, 11:14 PM
> > >  */
> > >
> > > package org.apache.struts.util;
> > > import javax.servlet.jsp.JspException;
> > >
> > > /**
> > >  *
> > >  * @author  rick
> > >  */
> > > public class JspWrapperException extends JspException  {
> > >
> > >         Exception e;
> > >
> > >     /**
> > >      * @param     Exception e
> > >      * @param     String message
> > >      */
> > >     public JspWrapperException(Exception e, String message) {
> > >         super(message);
> > >         this.e = e;
> > >     }
> > >
> > >     /**
> > >      */
> > >     public void printStackTrace () {
> > >         super.printStackTrace();
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         if (e != null) {
> > >             System.err.println("--------------- extended Exception
> > > nest ----------- ");
> > >             e.printStackTrace();
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @param ps
> > >      */
> > >     public void printStackTrace (java.io.PrintStream ps) {
> > >         super.printStackTrace(ps);
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         if (e != null) {
> > >             ps.println("--------------- extended Exception
> > > nest -----------
> > > ");
> > >             e.printStackTrace(ps);
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @param pw
> > >      */
> > >     public void printStackTrace (java.io.PrintWriter pw) {
> > >         super.printStackTrace(pw);
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >             //
> > >             //Nested exception
> > >         if (e != null) {
> > >             pw.println("--------------- extended Exception
> > > nest -----------
> > > ");
> > >             e.printStackTrace(pw);
> > >         }
> > >     }
> > >
> > >     /**
> > >      * @return
> > >      */
> > >     public String getMessage () {
> > >         StringBuffer message = new StringBuffer(150);
> > >         message.append(super.getMessage());
> > >
> > >             //
> > >             //add Line separator
> > >         String sep = System.getProperty("line.separator", "\r\n");
> > >         message.append(sep);
> > >
> > >             //
> > >             //Add the nested exception
> > >         if (e != null) {
> > >             message.append(e.getMessage());
> > >             //char = props["line.separator"]
> > >         }
> > >         return  message.toString();
> > >     }
> > > }
> > >
> > >
> > >
> > > Rick Hightower
> > > Director of Development
> > > eBlox, Inc.
> > >
> > > Check out our new website!
> > > www.eblox.com
> > >
> > > Contact Info:
> > > eBlox Tucson
> > > phone: 520-615-9345 x103
> > > fax: 520-529-5774
> > >
> > > Rick's stuff:
> > > http://www.eblox.com/people_detail.php?id=52
> > > http://www.geocities.com/rick_m_hightower/
> > > http://www.brainbench.com/transcript.jsp?pid=2351036
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > > additional commands,
> > > e-mail: <ma...@jakarta.apache.org>
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > > additional commands,
> > > e-mail: <ma...@jakarta.apache.org>
> > >
> > >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > For
> > additional commands,
> > e-mail: <ma...@jakarta.apache.org>
> >
> >
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-dev-> unsubscribe@jakarta.apache.org
> >
> For
> additional commands,
> e-mail: <mailto:struts-dev-help@jakarta.apache.org
> >
>
>
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> For
> additional commands,
> e-mail: <ma...@jakarta.apache.org>
>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>