return options;
}
+ @Override
protected void log(String msg) {
log.log(msg);
}
import java.io.File;
import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.DefaultErrorHandler;
+import com.vaadin.server.ErrorHandler;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.server.WebBrowser;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
-public abstract class AbstractTestUI extends UI {
+public abstract class AbstractTestUI extends UI implements ErrorHandler {
@Override
public void init(VaadinRequest request) {
getPage().setTitle(getClass().getName());
+ setErrorHandler(this);
+
Label label = new Label(getTestDescription(), ContentMode.HTML);
label.setWidth("100%");
}
}.start();
}
+
+ @Override
+ public void error(com.vaadin.server.ErrorEvent event) {
+ final Throwable throwable = DefaultErrorHandler
+ .findRelevantThrowable(event.getThrowable());
+
+ log("Exception occurred, " + throwable.getClass().getName() + ": "
+ + throwable.getMessage());
+ throwable.printStackTrace();
+ }
+
+ protected void log(String message) {
+ // NOP
+ }
}
((VerticalLayout) getContent()).addComponent(log, 0);
}
+ @Override
protected void log(String message) {
log.log(message);
}
package com.vaadin.tests.components.grid;
+import java.util.ArrayList;
+import java.util.List;
+
import com.vaadin.annotations.Widgetset;
import com.vaadin.data.provider.ListDataProvider;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.data.bean.Sex;
import com.vaadin.ui.Button;
import com.vaadin.ui.Grid;
-import com.vaadin.ui.TextField;
import com.vaadin.ui.renderers.TextRenderer;
-import java.util.ArrayList;
-import java.util.List;
-
@Widgetset("com.vaadin.DefaultWidgetSet")
public class GridNullSafeNestedPropertyColumn extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
+ setErrorHandler(null);
+
Grid<Person> grid = new Grid<>(Person.class);
grid.setSizeFull();
import java.util.Random;
import com.vaadin.annotations.Theme;
-import com.vaadin.server.DefaultErrorHandler;
-import com.vaadin.server.ErrorHandler;
import com.vaadin.shared.data.sort.SortDirection;
import com.vaadin.shared.ui.ContentMode;
import com.vaadin.tests.components.AbstractComponentTest;
* @author Vaadin Ltd
*/
@Theme("valo")
-public class GridBasicFeatures extends AbstractComponentTest<Grid>
- implements ErrorHandler {
+public class GridBasicFeatures extends AbstractComponentTest<Grid> {
public static final String ROW_STYLE_GENERATOR_ROW_NUMBERS_FOR_3_OF_4 = "Row numbers for 3/4";
public static final String ROW_STYLE_GENERATOR_NONE = "None";
}
};
- public GridBasicFeatures() {
- super();
- setErrorHandler(this);
- }
-
@Override
protected void createActions() {
super.createActions();
return Grid.class;
}
- @Override
- public void error(com.vaadin.server.ErrorEvent event) {
- final Throwable throwable = DefaultErrorHandler
- .findRelevantThrowable(event.getThrowable());
-
- log("Exception occurred, " + throwable.getClass().getName() + ": "
- + throwable.getMessage());
- throwable.printStackTrace();
- }
-
}
$(ButtonElement.class).get(2).click();
assertTrue(logContainsText("0. Throwing exception in access"));
- assertTrue(logContainsText("1. firstFuture is done? true"));
assertTrue(logContainsText(
- "2. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can"));
+ "1. Exception occurred, java.lang.RuntimeException: Catch me if you can"));
+ assertTrue(logContainsText("2. firstFuture is done? true"));
+ assertTrue(logContainsText(
+ "3. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can"));
}
@Test
upload.click();
- assertEquals("2. finished", getLogRow(0));
+ assertEquals("2. finished", getLogRow(1));
+ assertEquals(
+ "3. Exception occurred, com.vaadin.server.UploadException: Upload failed",
+ getLogRow(0));
tempFile = createTempFile();
fillPathToUploadInput(tempFile.getPath());
- assertEquals("3. change", getLogRow(0));
+ assertEquals("4. change", getLogRow(0));
}
/**