Monday, July 13, 2009

Look at the code and find NPE

NPE at IconAndMessageDialog.getSWTImage(). No line number.
How much time do you need to figure out what's wrong?

This bugzilla entry contains spoiler (comment 6, and solution, comment 10).

The challenge code is:

private Image getSWTImage(final int imageID) {
Shell shell = getShell();
final Display display;
if (shell == null || shell.isDisposed()) {
shell = getParentShell();
}
if (shell == null || shell.isDisposed()) {
display = Display.getCurrent();
} else {
display = shell.getDisplay();
}

final Image[] image = new Image[1];
display.syncExec(new Runnable() {
public void run() {
image[0] = display.getSystemImage(imageID);
}
});

return image[0];

}



BTW. Does anybody knows good plug-in to export html code?

Monday, July 6, 2009

Is this under EPL?