You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by HansD <co...@pobox.com> on 2004/05/03 19:59:01 UTC

TapestryMessages (Was: RE: [PATCH] Javadoc, Logging strings and some)

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" <hl...@comcast.net>
>   Date: Sun, 2 May 2004 18:55:22 -0400
>     To: "'Tapestry development'" <ta...@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