Program: 79653
Project: 79653
Buggy source:
public static <T>T waitInTaskForAttributeReady(Entity source,AttributeSensor<T> sensor,Predicate<? super T> ready){
  T value=source.getAttribute(sensor);
  if (ready == null)   ready=GroovyJavaMethods.truthPredicate();
  if (ready.apply(value))   return value;
  BasicTask current=(BasicTask)Tasks.current();
  if (current == null)   throw new IllegalStateException("String_Node_Str");
  Entity entity=Iterables.find(current.getTags(),Predicates.instanceOf(Entity.class));
  if (entity == null)   throw new IllegalStateException("String_Node_Str" + current + "String_Node_Str"+ current.getStatusDetail(false)+ "String_Node_Str");
  final AtomicReference<T> data=new AtomicReference<T>();
  final Semaphore semaphore=new Semaphore(0);
  SubscriptionHandle subscription=null;
  try {
    subscription=((EntityInternal)entity).getSubscriptionContext().subscribe(source,sensor,new SensorEventListener<T>(){
      public void onEvent(      SensorEvent<T> event){
        data.set(event.getValue());
        semaphore.release();
      }
    }
);
    value=source.getAttribute(sensor);
    while (!ready.apply(value)) {
      current.setBlockingDetails("String_Node_Str" + source + "String_Node_Str"+ sensor);
      semaphore.acquire();
      current.setBlockingDetails(null);
      value=data.get();
    }
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str",sensor,source);
    return value;
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    throw Throwables.propagate(e);
  }
 finally {
    if (subscription != null) {
      ((EntityInternal)entity).getSubscriptionContext().unsubscribe(subscription);
    }
  }
}

Fixed version (ground truth):
public static <T>T waitInTaskForAttributeReady(Entity source,AttributeSensor<T> sensor,Predicate<? super T> ready){
  T value=source.getAttribute(sensor);
  if (ready == null)   ready=GroovyJavaMethods.truthPredicate();
  if (ready.apply(value))   return value;
  BasicTask current=(BasicTask)Tasks.current();
  if (current == null)   throw new IllegalStateException("String_Node_Str");
  Entity entity=(Entity)Iterables.find(current.getTags(),Predicates.instanceOf(Entity.class));
  if (entity == null)   throw new IllegalStateException("String_Node_Str" + current + "String_Node_Str"+ current.getStatusDetail(false)+ "String_Node_Str");
  final AtomicReference<T> data=new AtomicReference<T>();
  final Semaphore semaphore=new Semaphore(0);
  SubscriptionHandle subscription=null;
  try {
    subscription=((EntityInternal)entity).getSubscriptionContext().subscribe(source,sensor,new SensorEventListener<T>(){
      public void onEvent(      SensorEvent<T> event){
        data.set(event.getValue());
        semaphore.release();
      }
    }
);
    value=source.getAttribute(sensor);
    while (!ready.apply(value)) {
      current.setBlockingDetails("String_Node_Str" + source + "String_Node_Str"+ sensor);
      semaphore.acquire();
      current.setBlockingDetails(null);
      value=data.get();
    }
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str",sensor,source);
    return value;
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    throw Throwables.propagate(e);
  }
 finally {
    if (subscription != null) {
      ((EntityInternal)entity).getSubscriptionContext().unsubscribe(subscription);
    }
  }
}