So end of the method is never reached
2 cases :
1) ExtendedServiceExceptionHandler.getServiceException is never call
with my custom Exception that I try to convert
2) with AccesLocalException launched I always fall in condition if (t
instanceof ServiceException) so end of the method isn't reached
I added
List<ExceptionConverter> lec =
GraniteContext.getCurrentInstance().getGraniteConfig().getExceptionConverters();
at top of the method and debug it. I was surprised to see that my
PersoExceptionConverter was correctly registered (nb: in granite-
config.xml with automatic configuration and manual configuration my
converter was registered twice. Maybe you can improve it for next
release to prevent GDS to register same converter twice ? See here
please :
http://hpics.li/5a61940).
Here is my Exception that I try to convert :
public class PersoException extends RuntimeException { // tried
extending Exception or AccesLocalException etc..
/**
*
*/
private static final long serialVersionUID = 1L;
}
My PersoExceptionConverter :
public class PersoExceptionConverter implements ExceptionConverter {
public static final String PERSO_EXCEPTION = "Perso.Exception";
@Override
public boolean accepts(Throwable t, Throwable finalException) {
return true; // to accept all
//return t.getClass().equals(PersoException.class);
}
@Override
public ServiceException convert(Throwable t, String detail,
Map<String, Object> extendedData) {
ServiceException se = new ServiceException(PERSO_EXCEPTION,
t.getMessage(), detail, t);
se.getExtendedData().putAll(extendedData);
return se;
}
}
Where my PersoException is launched :
@Override
@RolesAllowed("admin")
public String testOlivier() {
try {
// throw new AccessLocalException();
throw new PersoException();
} catch (PersoException e) {
e.printStackTrace();
}
return "ok";
}
So where can be the problem please ?
I would like to know what is the method that calls
ExtendedServiceExceptionHandler.getServiceException upstream to debug
it please ?
Thank you