clickEventHandler.handleEventHandlerRegistration();
- getWidget().setUrl(
- getResourceUrl(AbstractEmbeddedState.SOURCE_RESOURCE));
- getWidget().setAltText(getState().alternateText);
+ String url = getResourceUrl(AbstractEmbeddedState.SOURCE_RESOURCE);
+ getWidget().setUrl(url != null ? url : "");
+
+ String alt = getState().alternateText;
+ // Some browsers turn a null alt text into a literal "null"
+ getWidget().setAltText(alt != null ? alt : "");
}
protected final ClickEventHandler clickEventHandler = new ClickEventHandler(
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>EmbeddedWithNullSource</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">EmbeddedWithNullSource</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/EmbeddedWithNullSource?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /dev/null
+package com.vaadin.tests.components.abstractembedded;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractEmbedded;
+import com.vaadin.ui.BrowserFrame;
+import com.vaadin.ui.Flash;
+import com.vaadin.ui.Image;
+
+public class EmbeddedWithNullSource extends TestBase {
+
+ @Override
+ protected void setup() {
+ AbstractEmbedded e;
+
+ e = new Image("Image w/o alt text");
+ addComponent(e);
+
+ e = new Image("Image w/ alt text");
+ e.setAlternateText("Image");
+ addComponent(e);
+
+ e = new Flash("Flash w/o alt text");
+ addComponent(e);
+
+ e = new Flash("Flash w/ alt text");
+ e.setAlternateText("Flash");
+ addComponent(e);
+
+ e = new BrowserFrame("BrowserFrame w/o alt text");
+ addComponent(e);
+
+ e = new BrowserFrame("BrowserFrame w/ alt text");
+ e.setAlternateText("BrowserFrame");
+ addComponent(e);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Image without a source causes a client-side NPE";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10101;
+ }
+
+}