summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-12 11:53:55 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-12 11:54:14 +0300
commitd2fb55ba41f7bd1d52cd54a3ce7e9cbec3cc6652 (patch)
treed81b0f05929466a2a54db0c2413ecbd3d4673a95
parent008cd38ff9dd1f05304409723332bbfc0eb49e58 (diff)
downloadvaadin-framework-d2fb55ba41f7bd1d52cd54a3ce7e9cbec3cc6652.tar.gz
vaadin-framework-d2fb55ba41f7bd1d52cd54a3ce7e9cbec3cc6652.zip
Avoid infinite recursion in LegacyApplication.terminalError (#9581)
-rw-r--r--server/src/com/vaadin/LegacyApplication.java6
-rw-r--r--server/src/com/vaadin/server/DefaultErrorListener.java15
2 files changed, 12 insertions, 9 deletions
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<? extends UI> uiClass) {
+ public String getTheme(WrappedRequest request, Class<? extends UI> 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