[Logo] Mentawai Forum - Mentawai Web Framework
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
org.mentawai.ajax.AjaxConsequence  XML
Forum Index -> Comentários Gerais
Author Message
velo


[Avatar]

Joined: 16/02/2006 13:33:54
Messages: 1197
Location: Jaraguá do Sul - SC
Offline

Estava dando uma olhada no fonte do mentawai e vi um negócio que me chamou atenção nessa classe....

Não sei se isso pode causar algum bug, não cheguei a fazer um stress test nesse negocio, mas.... olhando o metodo execute, reparei que o PrintWriter nunca é fechado.

Acredito que deva ser feito algo assim:
Code:
 	public void execute(Action a, HttpServletRequest req, HttpServletResponse res) throws ConsequenceException {
 		PrintWriter printWriter = null;
 		try {
 
 			String s = this.ajaxRender.renderize(a);
 			res.setContentType(TEXT_XML);
 			printWriter = res.getWriter();
 			printWriter.print(s);
 		}
 		catch (IOException e) {
 			throw new ConsequenceException("Exception while writing the renderized document: " + e.getMessage());
 		}
 		catch (Exception e) {
 			throw new ConsequenceException("Exception while renderizing with render " + ajaxRender.getClass() + ": "
 					+ e.getMessage());
 		}
 		finally {
 			printWriter.close();
 		}
 
 	}
 


Não sei nem se o código está assim ainda, pois baixei do SVN tem uns dias....

Todos casos fica a dica.


VELO

_____________________________________
Mentawai Developer
"When the only tool you have is a hammer, everything looks like a nail"
http://en.wikipedia.org/wiki/Golden_hammer
[Email] [MSN]
saoj



Joined: 01/07/2005 09:59:17
Messages: 2846
Location: Rio de Janeiro, RJ
Offline

Fazer isso é o mais certo. Mas acredito que quando response for fechado esse writer tb o será.

Sergio Oliveira

 
Forum Index -> Comentários Gerais
Go to:   
Powered by JForum 2.1.6 © JForum Team