|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
NotInitializedException?Hi,
having to implement a service which has an explicit constructor taking two arguments, which are necessary for operation of the component, I wonder whether we already have some kind of NotInitializedException. That is, technically it is possible to create the component without actually invoking its constructor, so that is something I have to care for in the implementation. I would like to do so by throwing a dedicated exception, which clearly states the problem, whenever some (non-trivial) method is invoked before fully constructing the object. I imagine something like the following: /** is thrown when a component is attempted to be used before it was completely constructed. */ exception NotInitializedException : public Exception { }; - Do we already have something like this (perhaps not with this name, but with this semantics)? - Does it make sense to put this into css.lang? I'd say so, since - this is where XInitialization resides - we're talking about a basic "UNO language" feature here, namely constructors - Should this go into udkapi or offapi? I'd say the former (again for consistency with XInitialization) - Strictly speaking, the thingie should be named NotConstructedException: The fact that service constructors are implemented using XInitialization is a mere abus^W implementation detail (which hopefully will change sooner or later). So, it might make sense to not refer to "init" in the exception name. Opinions? Thanks & Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenheit@... - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: interface-discuss-unsubscribe@... For additional commands, e-mail: interface-discuss-help@... |
|
|
Re: NotInitializedException?now that I wrote this ...wrote:
> I imagine something like the following: > > /** is thrown when a component is attempted to be used before it was > completely constructed. > */ > exception NotInitializedException : public Exception > { > }; it should better be a RuntimeException, shouldn't it? Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenheit@... - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: interface-discuss-unsubscribe@... For additional commands, e-mail: interface-discuss-help@... |
|
|
|
|
|
Re: NotInitializedException?Hi Stephan,
> I would argue that it should be named NotInitializedException: Properly > using a service constructor can never cause this exception. It is using > the to-be-deprecated back door of createInstance/initialize that can > cause it. Agreed. > Then again, not sure if a dedicated NotInitializedException is really > useful, or if a plain RuntimeException (with an appropriate message > string) would suffice. What code would catch and handle > NotInitializedException (indicating a programming error)? Because I like exceptions which state the problem in their name already. Looking at today's code, too many developers are too lazy to care for proper error messages (you find way too many "throw IOException()"s and similar, if you want). A dedicated exception type can help here. The approach of course doesn't scale, but in some special cases such as here, I think the extra type is justified. Also, exception names can be examined programmatically, exceptions messages can't. Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenheit@... - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: interface-discuss-unsubscribe@... For additional commands, e-mail: interface-discuss-help@... |
|
|
Re: NotInitializedException?Hi Stephan,
>> Then again, not sure if a dedicated NotInitializedException is really >> useful > ... > Because ... Does your silence mean [ ] I convinced you [ ] you don't really care [ ] I offended you by using some forbidden word like, uh, "lazy" [ ] you did not find the time, yet, but still plan to blow away my arguments [ ] other: _________________________ ? Ciao Frank, just wondering whether he can go on / commit -- - Frank Schönheit, Software Engineer frank.schoenheit@... - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: interface-discuss-unsubscribe@... For additional commands, e-mail: interface-discuss-help@... |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |