Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
MICHAIL MOUDATSOS
Disable verbose error messages
2 de Abril de 2012 05:34
Resposta

MICHAIL MOUDATSOS

Ranking: Regular Member

Mensagens: 110

Data de entrada: 4 de Outubro de 2011

Mensagens recentes

Hello all

I ll try to be brief. A client of ours requires that all kind of error messages returned by the server to the client browser to be non verbose. I have partially tackled that by setting
1    <error-page>
2        <error-code>500</error-code>
3        <location>somehting here</location>
4    </error-page>
5    <error-page>
6        <error-code>404</error-code>
7        <location>somehting here</location>
8    </error-page>
in liferay-portal-6.0.6\tomcat-6.0.29\conf\web.xml
However our client still produced some error screens such as the ones attached when tampering with post requests of an authenticated user. The requests relate to a custom portlet we have deployed.

so
1)Any ideas of how to supress such errors
2)Any ideas how to supress any error message in general

Thank you all in advance!
Anexos: error1.bmp (2.940,5k), error2.bmp (919,7k)
David H Nebinger
RE: Disable verbose error messages
2 de Abril de 2012 05:43
Resposta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensagens: 11787

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

Thomas Buckley
RE: Disable verbose error messages
23 de Abril de 2012 00:24
Resposta

Thomas Buckley

Ranking: New Member

Mensagens: 2

Data de entrada: 23 de Abril de 2012

Mensagens recentes

Hi Michail

I looking for the exact same solution, but have not been able to find anything online on how to supress verbose error messages.
JSF returns errors such as "java.lang.NumberFormatException: For input string: "2012dsafsf"" when tampering with posts.

Did you find a solution to this?

I currently have a small hack (Create a phase listener, search for any messages in current context and remove them if they contain the word "java"). Not good but best I've come up with so far!

Thanks
David H Nebinger
RE: Disable verbose error messages
23 de Abril de 2012 05:41
Resposta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensagens: 11787

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

Did you try any of the things in the link I provided? I've used this to mask all kinds of details from the JSF output...
Thomas Buckley
RE: Disable verbose error messages
23 de Abril de 2012 06:05
Resposta

Thomas Buckley

Ranking: New Member

Mensagens: 2

Data de entrada: 23 de Abril de 2012

Mensagens recentes

Hi David

Yes I've tried all sorts of things including adding errors mapping into web.xml, creating custom converters/validators.
None have worked.

What I need to do is intercept the Exception and remove it from the current faces instance if it is of a certain type of exception (And redirect the user).

I believe this is happening due to the component values not been converted to the appropriate objects at the 'Apply Request Values' phase (Due to their values been tampered with).

I want to send users to a generic error page when these type of errors occur.

Thomas
David H Nebinger
RE: Disable verbose error messages
23 de Abril de 2012 06:18
Resposta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensagens: 11787

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

The portlet 2.0 spec includes a 'portlet filter' mechanism similar to a servlet filter.

I've used this in the past as kind of a 'last resort' method to catch exceptions thrown in the underlying code. The problem for JSF is often that it can swallow the exceptions.

I guess you could try this in order to massage the results.
Neil Griffin
RE: Disable verbose error messages
23 de Abril de 2012 08:21
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2378

Data de entrada: 26 de Julho de 2005

Mensagens recentes

[moved to Liferay Faces forum category]

Are you using PortletFaces Bridge or Liferay Faces Bridge? Liferay Faces Bridge has a new class named ExceptionHandlerAjaxImpl that tries to prevent Mojarra from swallowing exceptions. It also serves as an example of how to create a custom Ajax exception handler. It should be registered automatically if you have the liferay-faces-bridge-impl JAR in your portlet's WEB-INF/lib folder.

However I think the error message you showed in error2.bmp is one that is handled by the jsf.js JavaScript library. To see what I mean, search for "XML Parsing Error" in the jsf.js source code.

This error is probably the result of a malformedXML JavaScript parsing error. In order to catch this on the server side, I *think* you would have to develop your own PartialResponseWriter wrapper/decorator that checks for well-formedness. I've never tried something like that so it's just a best guess.