Bug 31853

Summary: jstl/fmt - SetLocaleSupport.java:getFormattingLocale calls setResponseLocale
Product: Taglibs Reporter: Kenny <kenny_grimm>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P3    
Version: 1.0.6   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Kenny 2004-10-22 18:09:31 UTC
Using the jstl/fmt tag can cause "java.lang.IllegalStateException: Response is
already committed!" on Oracle(9|10)iAS.  I believe that the stack trace provided
(see below) indicates that this is due to a fmt:formatDate which is attempting
to setLocale after the response buffer has already been written.  This probably
only occurs when the buffer size reaches it's limit before this code is
encountered.  It looks like FormatDateSuport.java calls
SetLocaleSupport.java:getFormattingLocale which then calls setResponseLocale.

My question / concern is whether there is a way to keep it from attempting to
set the locale since this cannot be done once the response has begun.  Is there
a reason that it must do this and if so is there a workaround?

at
com.evermind.server.http.EvermindHttpServletResponse.setLocale(EvermindHttpServletResponse.java:1808)
	at
org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.setResponseLocale(SetLocaleSupport.java:234)
	at
org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.getFormattingLocale(SetLocaleSupport.java:314)
	at
org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport.doEndTag(FormatDateSupport.java:148)
	at _jsp_page._jspService(_jsp_page.java:4518)
Comment 1 Otis Gospodnetic 2004-11-08 21:51:59 UTC
A colleague of mine just run into this same problem - same tag, same stack
trace, but different line in the fmt tag implementation, probably because of a
different version:

java.lang.IllegalStateException: Response is already committed!
    at com.evermind[Oracle Application Server Containers for J2EE
10g
(9.0.4.0.0)].server.http.EvermindHttpServletResponse.setLocale(EvermindH
ttpServletResponse.java:1808)
    at
org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.setResponseL
ocale(SetLocaleSupport.java:200)
...
...

Is this fixed in one of the newer version?  Does anyone know if this is a known
Oracle app server/servlet engine bug?
Comment 2 Viktor Levine 2005-05-12 10:48:41 UTC
I would say that after the source examination, the MessageSupport calls( for no
apparent reason) SetLocaleSupport.setLocale. That is what causing the exception
due to the server's behaviour i.e. commiting response when it wants (and I'm not
pointing fingers here).

Two things could be done:
1. Do not call the SetLocaleSupport as it is not the right place to set Locale
on the response.
And/Or
2. Check if the response has been committed b4 setting locale (in SetLocaleSupport)

Comment 3 Michael Flanakin 2005-06-13 23:16:27 UTC
I'm having the same problem, but am not explicitly making any calls to set the
locale. Here's the code that caused the exception...

<fmt:formatDate value="${myBean.myDate}" />

And the exception...

java.lang.IllegalStateException: Response is already committed!
  at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.EvermindHttpServletResponse.setLocale(EvermindHttpServletResponse.java:1808)
  at
org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.setResponseLocale(SetLocaleSupport.java:234)
  at
org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.getFormattingLocale(SetLocaleSupport.java:314)
  at
org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport.doEndTag(FormatDateSupport.java:148)
  at _MyJsp._jspService(_MyJsp.java:870)
Comment 4 Henri Yandell 2006-12-27 15:07:09 UTC
Looking around, this looks like an interesting issue that has been resolved as
INVALID:

http://issues.apache.org/bugzilla/show_bug.cgi?id=19408

It looks like the same problem, but in this case for Tomcat 4. The comment from
Pierre appears to imply it's a problem with the container, and I'm guessing the
same would apply to the container in Oracle. 

This seems like a WONTFIX.
Comment 5 Henri Yandell 2007-01-03 16:06:54 UTC
Looks like the bug is in the container, marking WONTFIX.