Program: 28797
Project: 28797
Buggy source:
/** 
 * <p>Set the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).  Prior to setting the basic Valve, the Valve's <code>setContainer()</code> will be called, if it implements <code>Contained</code>, with the owning Container as an argument.  The method may throw an <code>IllegalArgumentException</code> if this Valve chooses not to be associated with this Container, or <code>IllegalStateException</code> if it is already associated with a different Container.</p>
 * @param valve Valve to be distinguished as the basic Valve
 */
public void setBasic(GlassFishValve valve){
  GlassFishValve oldBasic=null;
synchronized (this) {
    oldBasic=this.basic;
  }
  if (oldBasic == valve) {
    return;
  }
  if (oldBasic != null) {
synchronized (this) {
      if (started && (oldBasic instanceof Lifecycle)) {
        try {
          ((Lifecycle)oldBasic).stop();
        }
 catch (        LifecycleException e) {
          log.log(Level.SEVERE,SET_BASIC_STOP_EXCEPTION,e);
        }
      }
    }
    if (oldBasic instanceof Contained) {
      try {
        ((Contained)oldBasic).setContainer(null);
      }
 catch (      Throwable t) {
      }
    }
  }
  if (valve == null) {
    return;
  }
  if (valve instanceof Contained) {
    ((Contained)valve).setContainer(this.container);
  }
  if (started && (valve instanceof Lifecycle)) {
    try {
      ((Lifecycle)valve).start();
    }
 catch (    LifecycleException e) {
      log.log(Level.SEVERE,SET_BASIC_START_EXCEPTION,e);
      return;
    }
  }
  this.basic=valve;
}

Fixed version (ground truth):
/** 
 * <p>Set the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).  Prior to setting the basic Valve, the Valve's <code>setContainer()</code> will be called, if it implements <code>Contained</code>, with the owning Container as an argument.  The method may throw an <code>IllegalArgumentException</code> if this Valve chooses not to be associated with this Container, or <code>IllegalStateException</code> if it is already associated with a different Container.</p>
 * @param valve Valve to be distinguished as the basic Valve
 */
public void setBasic(GlassFishValve valve){
  GlassFishValve oldBasic=null;
synchronized (this) {
    oldBasic=this.basic;
  }
  if (oldBasic == valve) {
    return;
  }
  if (oldBasic != null) {
synchronized (this) {
      if (started && (oldBasic instanceof Lifecycle)) {
        try {
          ((Lifecycle)oldBasic).stop();
        }
 catch (        LifecycleException e) {
          log.log(Level.SEVERE,SET_BASIC_STOP_EXCEPTION,e);
        }
      }
    }
    if (oldBasic instanceof Contained) {
      try {
        ((Contained)oldBasic).setContainer(null);
      }
 catch (      Throwable t) {
      }
    }
  }
  if (valve == null) {
    return;
  }
  if (valve instanceof Contained) {
    ((Contained)valve).setContainer(this.container);
  }
  if (started && (valve instanceof Lifecycle)) {
    try {
      ((Lifecycle)valve).start();
    }
 catch (    LifecycleException e) {
      log.log(Level.SEVERE,SET_BASIC_START_EXCEPTION,e);
      return;
    }
  }
synchronized (this) {
    this.basic=valve;
  }
}