Program: 29851
Project: 29851
Buggy source:
/** 
 * Stops the given <tt>context</tt> and removes it from this <tt>VirtualServer</tt>.
 */
public void removeContext(Context context) throws GlassFishException {
  ActionReport report=services.forContract(ActionReport.class).named("String_Node_Str").get();
  Deployment deployment=services.forContract(Deployment.class).get();
  String name=((ContextFacade)context).getAppName();
  ApplicationInfo appInfo=deployment.get(name);
  if (appInfo == null) {
    report.setMessage("String_Node_Str" + name);
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    throw new GlassFishException("String_Node_Str" + name);
  }
  ReadableArchive source=appInfo.getSource();
  if (source == null) {
    report.setMessage("String_Node_Str");
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    throw new GlassFishException("String_Node_Str");
  }
  UndeployCommandParameters params=new UndeployCommandParameters(name);
  params.origin=UndeployCommandParameters.Origin.undeploy;
  params.target="String_Node_Str";
  ExtendedDeploymentContext deploymentContext=null;
  try {
    deploymentContext=deployment.getBuilder(_logger,params,report).source(source).build();
    deployment.undeploy(name,deploymentContext);
    deployment.unregisterAppFromDomainXML(name,"String_Node_Str");
  }
 catch (  IOException e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    throw new GlassFishException("String_Node_Str",e);
  }
catch (  TransactionFailure e) {
    throw new GlassFishException(e);
  }
 finally {
    deploymentContext.clean();
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + name);
  }
}

Fixed version (ground truth):
/** 
 * Stops the given <tt>context</tt> and removes it from this <tt>VirtualServer</tt>.
 */
public void removeContext(Context context) throws GlassFishException {
  ActionReport report=services.forContract(ActionReport.class).named("String_Node_Str").get();
  Deployment deployment=services.forContract(Deployment.class).get();
  String name;
  if (context instanceof ContextFacade) {
    name=((ContextFacade)context).getAppName();
  }
 else {
    name=context.getPath();
  }
  ApplicationInfo appInfo=deployment.get(name);
  if (appInfo == null) {
    report.setMessage("String_Node_Str" + name);
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    throw new GlassFishException("String_Node_Str" + name);
  }
  ReadableArchive source=appInfo.getSource();
  if (source == null) {
    report.setMessage("String_Node_Str");
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    throw new GlassFishException("String_Node_Str");
  }
  UndeployCommandParameters params=new UndeployCommandParameters(name);
  params.origin=UndeployCommandParameters.Origin.undeploy;
  params.target="String_Node_Str";
  ExtendedDeploymentContext deploymentContext=null;
  try {
    deploymentContext=deployment.getBuilder(_logger,params,report).source(source).build();
    deployment.undeploy(name,deploymentContext);
    deployment.unregisterAppFromDomainXML(name,"String_Node_Str");
  }
 catch (  IOException e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    throw new GlassFishException("String_Node_Str",e);
  }
catch (  TransactionFailure e) {
    throw new GlassFishException(e);
  }
 finally {
    if (deploymentContext != null) {
      deploymentContext.clean();
    }
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + name);
  }
}