A subclass of Exception would also return true when using instanceof, where I think the class name is still informational.
--Max > On Nov 11, 2014, at 11:14, Xuelei Fan <xuelei....@oracle.com> wrote: > > Why not use "instanceof"? > > Xuelei > > On 11/11/2014 10:58 AM, Wang Weijun wrote: >> Please review the fix at >> >> http://cr.openjdk.java.net/~weijun/8063087/webrev.00/ >> >> which is simply >> >> void displayErrorDialog(Window w, Throwable t) { >> if (t instanceof NoDisplayException) { >> return; >> } >> >> + if (t.getClass() == Exception.class) { >> + displayErrorDialog(w, t.getLocalizedMessage()); >> + } else { >> displayErrorDialog(w, t.toString()); >> + } >> } >> >> Error messages like "java.lang.Exception:No Policy Entry selected" is now >> "No Policy Entry selected". For other exception types, there will be no >> change. >> >> Thanks >> Max >> >