[opencms-dev] Status code bug (500 this time)

Joe Desbonnet jdesbonnet at gmail.com
Wed Apr 5 03:34:44 CEST 2006


This is entered as  bug #1138 in Bugzilla.

I believe I have located the problem code. If I replace code (version
6.0.4) at  org.opencms.main.OpenCmsCore around line 1703 with:

                res.setStatus(status);
                res.setContentType("text/plain");
                res.getWriter().write("Error " + status + "\n" + t.toString());
                    //res.sendError(status, t.toString());

the 500 status code gets sent back to the browser. So it seems that
sendError() is not honoring the status code sent to it (I did verify
-- it's being called with status 500 but the browser is receiving
200).

Obviously this is not a proper fix as the error ugly and cannot be customized.

Also I'm not sure line 1697:
                    res.setStatus(HttpServletResponse.SC_OK);
 is correct. Why set the status code to SC_OK if it's an error?

BTW: if this bug bothers anyone, just apply the change above, compile
OpenCmsCore.java and copy OpenCmsCore.class to
WEB-INF/classes/org/opencms/main
The version in the classes directory will override the version in opencms.jar.

Joe.


On 4/4/06, Joe Desbonnet <jdesbonnet at gmail.com> wrote:
> I disagree. It is at least "moderate" in my books. My automated
> monitoring software missed a severe site failure because the site home
> page returned a healthy 200 status code instead of a 500.
>
> Status codes are more for computers than humans. An example of what
> getting the status codes can mean try googling "OpenCms 404". An
> earlier version of OpenCms 6.0.x returned status 200 for 404 pages.
> Consequently google indexed a pile of 404 pages in OpenCms sites.
>
> I'll log it in bugzilla and see if I can come up with a quick fix. I'm
> not ready to move on to 6.2 for some sites yet.
>
> Joe.
>
>
> On 4/4/06, Robert Petermeier <robert2.0 at gmx.de> wrote:
> > Joe Desbonnet schrieb:
>
> > Yep, you're right. IMO, it's a bug, albeit a minor one. Ok, the browser
> > doesn't know there's an error but the user does when he reads the error
> > message. I guess that's why nobody else noticed that yet. You should
> > report this in Bugzilla.
> >
> >
> > Robert
> >
> > _______________________________________________
> > This mail is sent to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the list, please visit
> > http://lists.opencms.org/mailman/listinfo/opencms-dev
> >
>



More information about the opencms-dev mailing list