Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
MICHAIL MOUDATSOS
Disable verbose error messages
2 aprile 2012 5.34
Risposta

MICHAIL MOUDATSOS

Punteggio: Regular Member

Messaggi: 110

Data di Iscrizione: 4 ottobre 2011

Messaggi recenti

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!
Allegati: error1.bmp (2.940,5k), error2.bmp (919,7k)
David H Nebinger
RE: Disable verbose error messages
2 aprile 2012 5.43
Risposta

David H Nebinger

Community Moderator

Punteggio: Liferay Legend

Messaggi: 11113

Data di Iscrizione: 1 settembre 2006

Messaggi recenti

You're using JSF, so you'll want to check this out: http://www.softwareengineeringsolutions.com/thoughts/frameworks/JSF.Techniques-Error.Handling.htm
Thomas Buckley
RE: Disable verbose error messages
23 aprile 2012 0.24
Risposta

Thomas Buckley

Punteggio: New Member

Messaggi: 2

Data di Iscrizione: 23 aprile 2012

Messaggi recenti

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 aprile 2012 5.41
Risposta

David H Nebinger

Community Moderator

Punteggio: Liferay Legend

Messaggi: 11113

Data di Iscrizione: 1 settembre 2006

Messaggi recenti

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 aprile 2012 6.05
Risposta

Thomas Buckley

Punteggio: New Member

Messaggi: 2

Data di Iscrizione: 23 aprile 2012

Messaggi recenti

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 aprile 2012 6.18
Risposta

David H Nebinger

Community Moderator

Punteggio: Liferay Legend

Messaggi: 11113

Data di Iscrizione: 1 settembre 2006

Messaggi recenti

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 aprile 2012 8.21
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 2337

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

[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.