proposals/gk/log4j2/src/java/org/apache/turbine/Turbine.java [754:873]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                runDataMap.put(RunData.class, pipelineData);
                // put the data into the pipeline
                pipelineData.put(RunData.class, runDataMap);

                // If this is the first invocation, perform some
                // initialization.  Certain services need RunData to initialize
                // themselves.
                if (firstDoGet)
                {
                    init(pipelineData);
                }

                // Stages of Pipeline implementation execution
                // configurable via attached Valve implementations in a
                // XML properties file.
                pipeline.invoke(pipelineData);
            }
            catch (Throwable t)
            {
                handleException(pipelineData, res, t);
            }
        }
        catch (Throwable t)
        {
            handleHorribleException(res, t);
        }
    }

    /**
     * In this application doGet and doPost are the same thing.
     *
     * @param req Servlet request.
     * @param res Servlet response.
     * @throws IOException a servlet exception.
     * @throws ServletException a servlet exception.
     */
    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException
    {
        doGet(req, res);
    }

    /**
     * Return the servlet info.
     *
     * @return a string with the servlet information.
     */
    @Override
    public String getServletInfo()
    {
        return "Turbine Servlet";
    }

    /**
     * This method is about making sure that we catch and display
     * errors to the screen in one fashion or another. What happens is
     * that it will attempt to show the error using your user defined
     * Error Screen. If that fails, then it will resort to just
     * displaying the error and logging it all over the place
     * including the servlet engine log file, the Turbine log file and
     * on the screen.
     *
     * @param pipelineData A Turbine PipelineData object.
     * @param res Servlet response.
     * @param t The exception to report.
     */
    protected void handleException(PipelineData pipelineData, HttpServletResponse res,
                                       Throwable t)
    {
        RunData data = (RunData) pipelineData;
        // make sure that the stack trace makes it the log
        log.error("Turbine.handleException: ", t);

        try
        {
            // This is where we capture all exceptions and show the
            // Error Screen.
            data.setStackTrace(ExceptionUtils.getStackTrace(t), t);

            // setup the screen
            data.setScreen(configuration.getString(
                    TurbineConstants.SCREEN_ERROR_KEY,
                    TurbineConstants.SCREEN_ERROR_DEFAULT));

            // do more screen setup for template execution if needed
            if (data.getTemplateInfo() != null)
            {
                data.getTemplateInfo()
                    .setScreenTemplate(configuration.getString(
                            TurbineConstants.TEMPLATE_ERROR_KEY,
                            TurbineConstants.TEMPLATE_ERROR_VM));
            }

            // Make sure to not execute an action.
            data.setAction("");

            PageLoader.getInstance().exec(pipelineData,
                    configuration.getString(TurbineConstants.PAGE_DEFAULT_KEY,
                            TurbineConstants.PAGE_DEFAULT_DEFAULT));

            data.getResponse().setContentType(data.getContentType());
            data.getResponse().setStatus(data.getStatusCode());
        }
        // Attempt to do *something* at this point...
        catch (Throwable reallyScrewedNow)
        {
            handleHorribleException(res, reallyScrewedNow);
        }
    }

    /**
     * This method handles exception cases where no PipelineData object exists
     *
     * @param res Servlet response.
     * @param t The exception to report.
     */
    protected void handleHorribleException(HttpServletResponse res, Throwable t)
    {
        try
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/java/org/apache/turbine/Turbine.java [768:896]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                runDataMap.put(RunData.class, pipelineData);
                // put the data into the pipeline
                pipelineData.put(RunData.class, runDataMap);

                // If this is the first invocation, perform some
                // initialization. Certain services need RunData to initialize
                // themselves.
                if (firstDoGet)
                {
                    init(pipelineData);
                }

                // Stages of Pipeline implementation execution
                // configurable via attached Valve implementations in a
                // XML properties file.
                pipeline.invoke(pipelineData);
            }
            catch (Throwable t)
            {
                handleException(pipelineData, res, t);
            }
        }
        catch (Throwable t)
        {
            handleHorribleException(res, t);

        }
    }

    /**
     * In this application doGet and doPost are the same thing.
     *
     * @param req
     *            Servlet request.
     * @param res
     *            Servlet response.
     * @throws IOException
     *             a servlet exception.
     * @throws ServletException
     *             a servlet exception.
     */
    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException
    {
        doGet(req, res);
    }

    /**
     * Return the servlet info.
     *
     * @return a string with the servlet information.
     */
    @Override
    public String getServletInfo()
    {
        return "Turbine Servlet";
    }

    /**
     * This method is about making sure that we catch and display errors to the
     * screen in one fashion or another. What happens is that it will attempt to
     * show the error using your user defined Error Screen. If that fails, then
     * it will resort to just displaying the error and logging it all over the
     * place including the servlet engine log file, the Turbine log file and on
     * the screen.
     *
     * @param pipelineData
     *            A Turbine PipelineData object.
     * @param res
     *            Servlet response.
     * @param t
     *            The exception to report.
     */
    protected void handleException(PipelineData pipelineData, HttpServletResponse res,
            Throwable t)
    {
        RunData data = (RunData) pipelineData;
        // make sure that the stack trace makes it the log
        log.error("Turbine.handleException: ", t);

        try
        {
            // This is where we capture all exceptions and show the
            // Error Screen.
            data.setStackTrace(ExceptionUtils.getStackTrace(t), t);

            // setup the screen
            data.setScreen(configuration.getString(
                    TurbineConstants.SCREEN_ERROR_KEY,
                    TurbineConstants.SCREEN_ERROR_DEFAULT));

            // do more screen setup for template execution if needed
            if (data.getTemplateInfo() != null)
            {
                data.getTemplateInfo()
                        .setScreenTemplate(configuration.getString(
                                TurbineConstants.TEMPLATE_ERROR_KEY,
                                TurbineConstants.TEMPLATE_ERROR_VM));
            }

            // Make sure to not execute an action.
            data.setAction("");

            PageLoader.getInstance().exec(pipelineData,
                    configuration.getString(TurbineConstants.PAGE_DEFAULT_KEY,
                            TurbineConstants.PAGE_DEFAULT_DEFAULT));

            data.getResponse().setContentType(data.getContentType());
            data.getResponse().setStatus(data.getStatusCode());
        }
        // Attempt to do *something* at this point...
        catch (Throwable reallyScrewedNow)
        {
            handleHorribleException(res, reallyScrewedNow);
        }
    }

    /**
     * This method handles exception cases where no PipelineData object exists
     *
     * @param res
     *            Servlet response.
     * @param t
     *            The exception to report.
     */
    protected void handleHorribleException(HttpServletResponse res, Throwable t)
    {
        try
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



