use of static Class.getName()

  • A+

I stumbled upon the following code in NestedRuntimeException in org.springframework.core:

static {     NestedExceptionUtils.class.getName(); } 

What is the use of having such a block?

It will eagerly load the NestedExceptionUtils class to avoid classloader deadlock. There was a bug reported (SPR-5607) "Non-trivial NestedRuntimeException.getMessage() can cause deadlocks on OSGi" and this is the solution for the same issue.


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: