Fórumok

Disable verbose error messages

MICHAIL MOUDATSOS, módosítva 11 év-val korábban

Disable verbose error messages

Regular Member Bejegyzések: 110 Csatlakozás dátuma: 2011.10.04. Legújabb bejegyzések
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
	<error-page>
		<error-code>500</error-code>
		<location>somehting here</location>
	</error-page>
	<error-page>
		<error-code>404</error-code>
		<location>somehting here</location>
	</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!
thumbnail
David H Nebinger, módosítva 11 év-val korábban

RE: Disable verbose error messages

Liferay Legend Bejegyzések: 14914 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Thomas Buckley, módosítva 11 év-val korábban

RE: Disable verbose error messages

New Member Bejegyzések: 2 Csatlakozás dátuma: 2012.04.23. Legújabb bejegyzések
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
thumbnail
David H Nebinger, módosítva 11 év-val korábban

RE: Disable verbose error messages

Liferay Legend Bejegyzések: 14914 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: Disable verbose error messages

New Member Bejegyzések: 2 Csatlakozás dátuma: 2012.04.23. Legújabb bejegyzések
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
thumbnail
David H Nebinger, módosítva 11 év-val korábban

RE: Disable verbose error messages

Liferay Legend Bejegyzések: 14914 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
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.
thumbnail
Neil Griffin, módosítva 11 év-val korábban

RE: Disable verbose error messages

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
[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.