[ https://issues.apache.org/activemq/browse/SM-570?page=all ]
Guillaume Nodet resolved SM-570.
--------------------------------
Fix Version/s: 3.0.1
3.1
Resolution: Fixed
Assignee: Guillaume Nodet
Author: gnodet
Date: Mon Sep 25 04:14:43 2006
New Revision: 449650
URL: http://svn.apache.org/viewvc?view=rev&rev=449650
Log:
SM-570: HTTP connector can blow up while trying to report a problem
Modified:
incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/main/java/org/apache/servicemix/components/http/HttpBindingSupport.java
Author: gnodet
Date: Mon Sep 25 04:14:45 2006
New Revision: 449651
URL: http://svn.apache.org/viewvc?view=rev&rev=449651
Log:
SM-570: HTTP connector can blow up while trying to report a problem
Modified:
incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/http/HttpBindingSupport.java
> HTTP connector can blow up while trying to report a problem
> -----------------------------------------------------------
>
> Key: SM-570
> URL: https://issues.apache.org/activemq/browse/SM-570
> Project: ServiceMix
> Issue Type: Bug
> Components: servicemix-components
> Affects Versions: 3.0-M2
> Reporter: Robert H. Pollack
> Assigned To: Guillaume Nodet
> Priority: Minor
> Fix For: 3.0.1, 3.1
>
> Attachments: HttpBindingSupport.java
>
>
> The HttpBindingSupport class has a general exception reporter that handles
> uncaught exceptions by sending them back to the client as HTML messages. The
> code looks like this:
> PrintWriter writer = response.getWriter();
> writer.println("Request failed with error: " + e);
> e.printStackTrace(writer);
> But the HttpMarshaler class, in preparing the normal response, has the
> following line:
> getTransformer().toResult(message.getContent(), new
> StreamResult(response.getOutputStream()));
> If this transformer fails, the error reporting logic will get an
> IllegalStateException, because you cannot ask for the response writer after
> you have already obtained the response output stream. The solution is to ask
> for the output stream again (you are allowed to get it more than once) and
> created a new PrintWriter: The following code seems to work just fine:
> PrintWriter writer = null;
> try {
> writer = response.getWriter();
> } catch (IllegalStateException ise) {
> OutputStream os = response.getOutputStream();
> writer = new PrintWriter (os);
> }
> writer.println("Request failed with error: " + e);
> e.printStackTrace(writer);
> A corrected version of the source file (you also need another import
> statement) is attached.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira