On 9/30/11 2:15 PM, Sebastian Sickelmann wrote: >>> I think I know the reason. If you allow initCause to be called when a >>> cause is >>> not initially provided, then getCause will still return null, which >>> seems wrong. >>> >> getCause() of Throwable and all classes that doesn't had a chaining >> before >> Throwable introduces it, doing this excact this way. Whats wrong on this? >> >> return (cause==this ? null : cause); // Where the initial >> value(uninitialied) of cause is this. > Does this make sense? I actually not sure i understand you right.
The following code: KeySelectorException kse = new KeySelectorException("foo"); kse.initCause(new Exception("bar")); System.out.println(kse.getCause()); prints null as the cause, even though initCause was subsequently called. Do you see my concern? > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html Thanks! --Sean