No announcement yet.

Circular Dependency In The Configuration Class

  • Filter
  • Time
  • Show
Clear All
new posts

  • Circular Dependency In The Configuration Class

    Daily Build 1867
    JDK 8u92
    CentOS 7 3.10.0-327.13.1.el7.x86_64

    If things go wrong during the Configuration class's constructor - for example, a faulty resolution of lower-level classes such as XPath-related stuff, which was the case here at our site - it can expose a circular dependency in the Configuration class between its constructor and its own singleton instance.

    The problem manifests if execution ends up e.g. at line 118 in This causes a static initializer to fire in the Logging class, which in turn makes a series of static calls in the Configuration class that eventually want the Configuration instance's singleton to have been fully initialized and assigned. Because the singleton initialization is what's in progress when the logging call is made the singleton instance is still null, and this eventually causes a NullPointerException.

    Here is a partial stack trace of such a failure from daily build 1867:

    at gov.nasa.worldwind.Configuration.<init>(
    at gov.nasa.worldwind.Configuration.<clinit >(
    at gov.nasa.worldwind.awt.WorldWindowGLCanv as.<init>(
    ...other stuff...
    Caused by: java.lang.NullPointerException
    at gov.nasa.worldwind.Configuration.getStri ngValue(
    at gov.nasa.worldwind.Configuration.getInte gerValue(
    at gov.nasa.worldwind.Configuration.getInte gerValue(
    at gov.nasa.worldwind.util.Logging.<clinit> (