Re: Static initilizer failed to execute?



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).


4) The static initializer was never entered in the first place, for reasons centered elsewhere.

--
John Bollinger
jobollin@xxxxxxxxxxx
.