Image

Hi,

when I try to show an Image through a StreamSource, I always get an exception

Message: Failed to serialize shared state for connector com.vaadin.ui.Image (44): null

Image image = new Image(“Uploaded Image”);
final byte imageData = fg.itemDataSource.getItemProperty(propertyId).getValue();
if(imageData!=null) {
image.setSource(new StreamSource() {
@Override
InputStream getStream() {
return new ByteArrayInputStream(imageData);
}
}
} else {
image.setVisible(false);
}

I imagine the shared state is the byte array imageData.
Have you tried loading that resource through a URL?

Hmm, it seems that it work if I define the StreamSource separatly and not as anonymous class?
I will check further!