[OmniFaces utilities] The
unwrap() method unwraps the nested causes of given exception as long as until it is not an instance of the given type and then return it. If the given exception is already not an instance of the given type, then it will directly be returned. Or if the exception, unwrapped or not, does not have a nested cause anymore, then it will be returned. This is particularly useful if you want to unwrap the real root cause out of a nested hierarchy of ServletException or FacesException.Method:
OmniFaces 2.3 implementation (improve Exceptions#unwrap() to take varargs)
See also: Utils#isOneInstanceOf()
OmniFaces 2.1 implementation:
OmniFaces 2.0 implementation:
Usage:
Example 1 -
this is copy-pasted from OmniFaces documentation
try{
//...
} catch (FacesException e) {
Exception realRootCause =
Exceptions.unwrap(e, FacesException.class);
// ...
}
Example 2 - unwrap
ServletException
try{
//...
} catch (ServletException e) {
Exception realRootCause =
Exceptions.unwrap(e, ServletException.class);
// ...
}






Arrays
Converters


JSF 2 Tutorials at www.mkyong.com
JavaServer Faces (JSF) Tutorial 


















Niciun comentariu :
Trimiteți un comentariu