From: Leif Åstrand Date: Wed, 12 Sep 2012 08:53:55 +0000 (+0300) Subject: Avoid infinite recursion in LegacyApplication.terminalError (#9581) X-Git-Tag: 7.0.0.beta1~28 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d2fb55ba41f7bd1d52cd54a3ce7e9cbec3cc6652;p=vaadin-framework.git Avoid infinite recursion in LegacyApplication.terminalError (#9581) --- diff --git a/server/src/com/vaadin/LegacyApplication.java b/server/src/com/vaadin/LegacyApplication.java index ca9b196ff1..3a6ffaa39c 100644 --- a/server/src/com/vaadin/LegacyApplication.java +++ b/server/src/com/vaadin/LegacyApplication.java @@ -26,6 +26,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.DefaultErrorListener; import com.vaadin.server.Terminal.ErrorEvent; import com.vaadin.server.Terminal.ErrorListener; import com.vaadin.server.VaadinSession; @@ -105,8 +106,7 @@ public abstract class LegacyApplication extends AbstractUIProvider implements } @Override - public String getTheme(WrappedRequest request, - Class uiClass) { + public String getTheme(WrappedRequest request, Class uiClass) { return theme; } @@ -282,7 +282,7 @@ public abstract class LegacyApplication extends AbstractUIProvider implements @Override public void terminalError(ErrorEvent event) { - VaadinSession.getCurrent().getErrorHandler().terminalError(event); + DefaultErrorListener.doDefault(event); } public VaadinSession getContext() { diff --git a/server/src/com/vaadin/server/DefaultErrorListener.java b/server/src/com/vaadin/server/DefaultErrorListener.java index 46f96272fd..f007bdad63 100644 --- a/server/src/com/vaadin/server/DefaultErrorListener.java +++ b/server/src/com/vaadin/server/DefaultErrorListener.java @@ -26,11 +26,15 @@ import com.vaadin.ui.AbstractComponent; public class DefaultErrorListener implements Terminal.ErrorListener { @Override public void terminalError(ErrorEvent event) { + doDefault(event); + } + + public static void doDefault(ErrorEvent event) { final Throwable t = event.getThrowable(); if (t instanceof SocketException) { // Most likely client browser closed socket - getLogger() - .info("SocketException in CommunicationManager." + getLogger().info( + "SocketException in CommunicationManager." + " Most likely client (browser) closed socket."); return; } @@ -45,16 +49,15 @@ public class DefaultErrorListener implements Terminal.ErrorListener { // Shows the error in AbstractComponent if (owner instanceof AbstractComponent) { - ((AbstractComponent) owner) - .setComponentError(AbstractErrorMessage - .getErrorMessageForException(t)); + ((AbstractComponent) owner).setComponentError(AbstractErrorMessage + .getErrorMessageForException(t)); } // also print the error on console getLogger().log(Level.SEVERE, "Terminal error:", t); } - private Logger getLogger() { + private static Logger getLogger() { return Logger.getLogger(DefaultErrorListener.class.getName()); } } \ No newline at end of file