Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ public Image(Device device, InputStream stream) {
zoom -> ImageDataLoader.loadByZoom(new ByteArrayInputStream(input), FileFormat.DEFAULT_ZOOM, zoom).element());
init();
} catch (IOException e) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT, e);
SWT.error(SWT.ERROR_IO, e);
} finally {
if (pool != null) pool.release();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ private class ImageDataLoaderStreamProviderWrapper extends ImageFromImageDataPro
this.inputStreamData = inputStream.readAllBytes();
initImage();
} catch (IOException e) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT, e);
SWT.error(SWT.ERROR_IO, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@ public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream
}
assertSWTProblem("Incorrect exception thrown for invalid InputStream", SWT.ERROR_UNSUPPORTED_FORMAT, e);

InputStream failingStream = new InputStream() {
@Override
public int read() throws IOException {
throw new IOException("bad input stream");
}
};
e = assertThrows(SWTException.class, () -> new Image(display, failingStream));
assertSWTProblem("Incorrect exception thrown for invalid InputStream", SWT.ERROR_IO, e);

String firstFile = SwtTestUtil.invalidImageFilenames[0];
Display[] displays = { display, null };
for (Display display : displays) {
Expand Down
Loading