Hi,

In ConnectionManagerDataSource, method isWrapperFor currently returns
false. Perhaps it should throw UnsupportedOperationException instead? I
think it could be misleading if some user code asks whether this object
is a wrapper then gets false returned.

Yes the primary reason for this method is so that someone can determine
whether to call unwrap in order to access a particular nested type. In
this scenario, false is the correct thing to return - because unwrap
should *not* be called :-)

However it's also possible that code will take other actions just
depending on the return value for isWrapperFor. In this case a false
return value is a lie; we just don't know whether we are a wrapper for
that class or not.

It seems to me that UnsupportedOperationException is the safer value -
better an exception than incorrect behaviour.

Thoughts?

Regards,

Simon

Reply via email to