/**
 * @license
 * Copyright 2019 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

package foam.core;

public class ContextAgentRunnable
  implements Runnable
{
  final X            x_;
  final ContextAgent agent_;
  final String description_;

  public ContextAgentRunnable(X x, ContextAgent agent, String description) {
    x_     = x;
    agent_ = agent;
    description_ = description;
  }

  public String toString() {
    return description_;
  }

  public void run() {
    agent_.execute(x_);
  }
}

@@ -518,27 +518,109 @@
     
-agent_.execute(x_);
+XLocator.set(x_);%0A    try %7B%0A      agent_.execute(x_);%0A    %7D finally %7B%0A      XLocator.set(null);%0A    %7D
 %0A  %7D

Fix XLocator when from from AssemblyLine.