Re: Static initilizer failed to execute?
- From: "Virgil Green" <vjg@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 19:59:31 GMT
John C. Bollinger wrote:
> Virgil Green wrote:
>
> [...]
>
>> Here is the static initializer code. I haven't provided a complete,
>> working example because this is not a reproducible problem - it
>> seems to be a complete anomaly:
>>
>> static
>> {
>> try
>> {
>> TimingReporter resolveDuration = new TimingReporter("Resolve
>> to file " + FILE_NAME);
>> library =
>> LibraryListManager.getInstance().resolveLibraryName(FILE_NAME,
>> OBJECT_TYPE).trim();
>> resolveDuration.report();
>> } catch (Exception e)
>> {
>> e.printStackTrace();
>> }
>> }
>>
>> I would expect one of two things to happen:
>>
>> 1) the library variable would be populated and the
>> resolveDuration.report() call would produce a log entry telling me
>> how long the operation took to complete.
>> 2) there was an error (exception) in the resolveLibraryName() method
>> and I would get a stacktrace printed.
>
> 3) Something in the try block threw an Error, in which case the above
> code would print nothing (but something else would need to handle the
> error to prevent the application from crashing).
In this particular case, crashing is exactly what I would expect, but thanks
for the reminder that an unchecked exception might have been thrown.
> 4) The static initializer was never entered in the first place, for
> reasons centered elsewhere.
Reason's which I couldn't fathom, but could not yet discard.
As it happens, you may have seen my other post where I finally found the
stacktrace I had been expecting to find. I'll need to go in and make this
code a bit more robust.
Thanks for your comments.
--
Virgil
.
- References:
- Static initilizer failed to execute?
- From: Virgil Green
- Re: Static initilizer failed to execute?
- From: John C. Bollinger
- Static initilizer failed to execute?
- Prev by Date: Re: Static initilizer failed to execute?
- Next by Date: Re: IMPOSSIBLE to do this with LOG4J
- Previous by thread: Re: Static initilizer failed to execute?
- Next by thread: Re: Static initilizer failed to execute?
- Index(es):
Relevant Pages
|