#1925 FileDialog().open(null) throws an Illegal Argument Exception

yliu Thu 21 Jun 2012

The API says FileDialog.open() can take a null as the parent window parameter, but an exception is still thrown. Should the API be changed to reflect this?

fansh> using fwt
fansh> FileDialog().open(null)
sys::ArgErr: java.lang.IllegalArgumentException: Argument cannot be null

from FileDialog source:

native Obj? open(Window? parent)

andy Thu 21 Jun 2012

You probably need to have at least one window open, in order to "boot" SWT. Does is it still fail in that case?

yliu Thu 21 Jun 2012

Yeah it works in that case, but still kinda sucks that it doesn't work in the other case.

It's pretty useful for hacky scripts to stick that in when you need a quick file reference. :)

Login or Signup to reply.