How to make CustomizedSystemMessages work with network problem?

Hi,

I want to customize the System Messages,then I Override getSystemMessages() in Application ,following the guide of vaadin book.

public static SystemMessages getSystemMessages() {
        CustomizedSystemMessages messages = new CustomizedSystemMessages();

        messages.setCommunicationErrorCaption(null);
        messages.setCommunicationErrorMessage(i18n.getMsg("error.communicationError"));
        messages.setCommunicationErrorNotificationEnabled(true);
        messages.setInternalErrorCaption(null);
        messages.setInternalErrorMessage(i18n.getMsg("error.internalError"));
        messages.setInternalErrorNotificationEnabled(true);
        messages.setOutOfSyncCaption(null);
        messages.setOutOfSyncMessage(i18n.getMsg("error.outofsync"));
        messages.setOutOfSyncNotificationEnabled(true);
        messages.setSessionExpiredCaption(null);
        messages.setSessionExpiredMessage(i18n.getMsg("error.sessionExpired"));
        messages.setSessionExpiredNotificationEnabled(true);

        return messages;
    }

InternalError and OutOfSync work,But SessionExpied and CommunicationError not work.
Then I Override criticalNotification in AbstractApplicationServlet.

protected void criticalNotification(HttpServletRequest request,
            HttpServletResponse response, String caption, String message,
            String details, String url) throws IOException {

        if("Communication problem".equals(caption)){
            caption = null;
            message = i18n.getMsg("error.communicationError");
            details = null;
        }else if("Session Expired".equals(caption)){
            caption = null;
            message = i18n.getMsg("error.sessionExpired");
            details = null;
        }
        
        super.criticalNotification(request, response, caption, message, details, url);
        
    }

It seems work correctly at first.

[b]
Yesterday,the network is down suddenly when users are doing some operation,then they see the notification with default System Messages supported by vaadin,not the CustomizedSystemMessages.But some users do not understand any english.

It seems the CustomizedSystemMessages not work.
How to make CustomizedSystemMessages work with network problem?Any solution?
[/b]

I use Vaadin 6.8.0

That was my fault.

In my VaadinServlet which extends AbstractApplicationServlet,I override getApplicationClass(),and return com.vaadin.Application.class.

@Override
	protected Class<? extends Application> getApplicationClass()
			throws ClassNotFoundException { 
		return Application.class;
	}

But actually that should return MyApplication.class which extends com.vaadin.Application.

@Override
	protected Class<? extends Application> getApplicationClass()
			throws ClassNotFoundException {
	    // TODO: has to return the actual subclass who extends com.vaadin.Application  
		return MyApplication.class;
	}

So it works!

I suggests that the vaadin book should be updated,and clearly point out that getApplicationClass() function will affect SystemMessages.