tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From HansD <co...@pobox.com>
Subject TapestryMessages (Was: RE: [PATCH] Javadoc, Logging strings and some)
Date Mon, 03 May 2004 17:59:01 GMT
If I take ApplicationServlet.java as example:

..
protected void doService(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
..
        catch (ServletException ex)
        {
            log("ServletException", ex);

            show(ex);

            // Rethrow it.

            throw ex;
        }
..
    protected void show(Exception ex)
    {
        System.err.println("\n\n**********************************************************\n\n");

        new ExceptionAnalyzer().reportException(ex, System.err);

        System.err.println("\n**********************************************************\n");

    }
..


should become something like
..
protected void doService(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
..
        catch (ServletException ex)
        {
            TapestryMessages.reportException(this, ex);

            // Rethrow it.
            throw ex;
        }
..

With in TapestryMessages.java (or perhaps some more generic class like Tapestry.java (shouldn't
that be moved to the util package?))

    public final static void reportException(HttpServlet httpServlet, Exception ex)
    {
        httpServlet.log(ex.getClass(), ex);

        System.err.println("\n\n**********************************************************\n\n");
        new ExceptionAnalyzer().reportException(ex, System.err);
        System.err.println("\n**********************************************************\n");

    }
..


And what convention shold we use to name the Messages class: <package>Messages.java
(the main being just TapestryMessages.java, and <package> being the package name below
org.apache.tapestry, first letter in Caps, '.' ommitted)
Or perhaps <package>LogMsg.java?

Hans

>
>Subject: RE: [PATCH] Javadoc, Logging strings and some
>   From: "Howard M. Lewis Ship" <hlship@comcast.net>
>   Date: Sun, 2 May 2004 18:55:22 -0400
>     To: "'Tapestry development'" <tapestry-dev@jakarta.apache.org>
>
>Yep, that's pretty much what I was visualizing. It gets more interesting in the code that
is
>formatting exception messages, since those do more complex things when calling Tapestry.format().
>
>--
>Howard M. Lewis Ship
>Independent J2EE / Open-Source Java Consultant
>Creator, Tapestry: Java Web Components 
>Creator, HiveMind
>http://howardlewisship.com
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message