I'm using Flex + Blazeds + Spring Security. Something weird is going on my ExceptionTranslator.
public class ProjectExceptionTranslator implements ExceptionTranslator {
@Override
public boolean handles(Class<?> arg0) {
return true;
}
@Override
public MessageException translate(Throwable throwable) {
MessageException exception = new MessageException();
if (throwable instanceof BadCredentialsException) {
exception.setCode("08");
exception.setMessage("Login error.");
}
if (throwable instanceof HibernateException) {
exception.setCode("16");
exception.setMessage("Data base error.");
}
return exception;
}
}
All messages that spring throws, ex: BadCredentialsException, return to flex. But if my service throws something ex: HibernateException, it does not return to flex.
This is my config:
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<flex:message-broker>
<flex:exception-translator ref="projectExceptionTranslator" />
<flex:secured />
</flex:message-broker>
Am I missing something? Thanks.
I solved the problem by re-installing Flash Builder.