Class AntTaskHolder

java.lang.Object
org.owasp.dependencycheck.ant.logging.AntTaskHolder

public final class AntTaskHolder extends Object
Holds a reference to the current Ant Task for logging. Replaces the old StaticLoggerBinder singleton pattern used with SLF4J 1.x.

Uses ThreadLocal to ensure thread-safety when Ant runs tasks in parallel.

  • Method Details

    • setTask

      public static void setTask(org.apache.tools.ant.Task t)
      Sets the current Ant task to use for logging.
      Parameters:
      t - the Ant task
    • getTask

      public static org.apache.tools.ant.Task getTask()
      Returns the current Ant task.
      Returns:
      the Ant task, or null if not set
    • remove

      public static void remove()
      Removes the current Ant task from the thread-local storage. This should be called when the task completes to prevent memory leaks in environments with thread pooling.