You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Eelco Hillenius <ee...@gmail.com> on 2006/11/28 20:06:00 UTC

runtime exception in WebClientInfo

Currently, WebClientInfo throws a RuntimeException in it's constructor
when the 'User-Agent' header cannot be read from the request. Problems
with that:

* it's not documented;
* even if it was documented, you could argue when it is clear enough
and whether this is a case where you can regard an exception as being
recoverable and that thus a checked exception would be more suitable;

Al's proposal was to at least document it (+1) and preferably let it
throw a checked exception (+0).

Other issues:

Turns out it is not clear enough that you typically don't use this
class directly, but instead use Session#getClientInfo (or
RequestCycle#getClientInfo, which uses Session#getClientInfo... maybe
we actually should get rid of this method). The session caches the
client info instance, and calls RequestCycle#newClientInfo - which
creates the new (Web)ClientInfo instance - when the instance does not
yet exist.

Besides the fact this WebClientInfo should hint this, we should either
let newClientInfo return null when the object can't be constructed, or
implement newClientInfo and getClientInfo with checked exceptions or
at the very least document that an exception might be thrown.

Thoughts/ opinions?

Eelco