nus-yam/ex-repair huggingface dataset:
Program: 28538
Project: 28538
Buggy source:
@Handler(id="String_Node_Str",input={@HandlerInput(name="String_Node_Str",type=List.class,required=true),@HandlerInput(name="String_Node_Str",type=java.util.List.class)},output={@HandlerOutput(name="String_Node_Str",type=java.util.List.class)}) public static void getLogicalJndiName(HandlerContext handlerCtx){
  List<Map<String,String>> logicalMapList=(List<Map<String,String>>)handlerCtx.getInputValue("String_Node_Str");
  List<Map<String,Object>> listRow=(List<Map<String,Object>>)handlerCtx.getInputValue("String_Node_Str");
  if (listRow == null || listRow.isEmpty()) {
    handlerCtx.setOutputValue("String_Node_Str",listRow);
  }
  try {
    for (    Map<String,Object> onerow : listRow) {
      String name=(String)onerow.get("String_Node_Str");
      onerow.put("String_Node_Str","String_Node_Str");
      onerow.put("String_Node_Str","String_Node_Str");
      for (      Map<String,String> logicalMap : logicalMapList) {
        if (name.equals(logicalMap.get("String_Node_Str"))) {
          String lname=logicalMap.get("String_Node_Str");
          if (!GuiUtil.isEmpty(lname)) {
            onerow.put("String_Node_Str",lname);
            onerow.put("String_Node_Str",URLEncoder.encode(lname,"String_Node_Str"));
          }
          break;
        }
      }
    }
    handlerCtx.setOutputValue("String_Node_Str",listRow);
  }
 catch (  Exception ex) {
    GuiUtil.handleException(handlerCtx,ex);
  }
}

Fixed version (ground truth):
@Handler(id="String_Node_Str",input={@HandlerInput(name="String_Node_Str",type=List.class,required=true),@HandlerInput(name="String_Node_Str",type=java.util.List.class)},output={@HandlerOutput(name="String_Node_Str",type=java.util.List.class)}) public static void getLogicalJndiName(HandlerContext handlerCtx){
  List<Map<String,String>> logicalMapList=(List<Map<String,String>>)handlerCtx.getInputValue("String_Node_Str");
  List<Map<String,Object>> listRow=(List<Map<String,Object>>)handlerCtx.getInputValue("String_Node_Str");
  if (listRow == null || listRow.isEmpty()) {
    handlerCtx.setOutputValue("String_Node_Str",listRow);
    return;
  }
  try {
    for (    Map<String,Object> onerow : listRow) {
      String name=(String)onerow.get("String_Node_Str");
      onerow.put("String_Node_Str","String_Node_Str");
      onerow.put("String_Node_Str","String_Node_Str");
      for (      Map<String,String> logicalMap : logicalMapList) {
        if (name.equals(logicalMap.get("String_Node_Str"))) {
          String lname=logicalMap.get("String_Node_Str");
          if (!GuiUtil.isEmpty(lname)) {
            onerow.put("String_Node_Str",lname);
            onerow.put("String_Node_Str",URLEncoder.encode(lname,"String_Node_Str"));
          }
          break;
        }
      }
    }
    handlerCtx.setOutputValue("String_Node_Str",listRow);
  }
 catch (  Exception ex) {
    GuiUtil.handleException(handlerCtx,ex);
  }
}
Program: 28539
Project: 28539
Buggy source:
private void destroyBean(EjbInvocation ejbInv,EJBContextImpl ctx){
  if (ejbInv == null) {
    ejbInv=createEjbInvocation(ctx.getEJB(),ctx);
  }
  boolean inTx=false;
  try {
    ((SessionContextImpl)ctx).setInLifeCycleCallback(true);
    invocationManager.preInvoke(ejbInv);
    inTx=callLifecycleCallbackInTxIfUsed(ejbInv,ctx,preDestroyInvInfo,CallbackType.PRE_DESTROY);
  }
 catch (  Throwable t) {
    _logger.log(Level.FINE,"String_Node_Str",t);
  }
 finally {
    invocationManager.postInvoke(ejbInv);
    completeLifecycleCallbackTxIfUsed(ejbInv,ctx,inTx);
  }
}

Fixed version (ground truth):
private void destroyBean(EjbInvocation ejbInv,EJBContextImpl ctx){
  if (ejbInv == null) {
    ejbInv=createEjbInvocation(ctx.getEJB(),ctx);
  }
  boolean inTx=false;
  try {
    invocationManager.preInvoke(ejbInv);
    inTx=callLifecycleCallbackInTxIfUsed(ejbInv,ctx,preDestroyInvInfo,CallbackType.PRE_DESTROY);
  }
 catch (  Throwable t) {
    _logger.log(Level.FINE,"String_Node_Str",t);
  }
 finally {
    invocationManager.postInvoke(ejbInv);
    completeLifecycleCallbackTxIfUsed(ejbInv,ctx,inTx);
  }
}
Program: 28542
Project: 28542
Buggy source:
@Override public void execute(AdminCommandContext context){
  ActionReport report=context.getActionReport();
  final Logger logger=context.getLogger();
  try {
    logger.log(Level.INFO,"String_Node_Str" + this.getClass().getName());
    final ExtendedDeploymentContext dc;
    if (suppInfo == null) {
      throw new IllegalStateException("String_Node_Str");
    }
 else {
      dc=suppInfo.deploymentContext();
    }
    final InterceptorNotifier notifier=new InterceptorNotifier(habitat,dc);
    try {
      notifier.ensureAfterReported(ExtendedDeploymentContext.Phase.REPLICATION);
      logger.log(Level.INFO,"String_Node_Str" + this.getClass().getName() + "String_Node_Str");
    }
 catch (    Exception e) {
      report.failure(logger,e.getMessage());
      logger.log(Level.SEVERE,"String_Node_Str" + this.getClass().getName(),e);
    }
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str" + this.getClass().getName(),e);
  }
}

Fixed version (ground truth):
@Override public void execute(AdminCommandContext context){
  ActionReport report=context.getActionReport();
  final Logger logger=context.getLogger();
  try {
    logger.log(Level.INFO,"String_Node_Str" + this.getClass().getName());
    final ExtendedDeploymentContext dc;
    if (suppInfo == null) {
      throw new IllegalStateException("String_Node_Str");
    }
 else {
      dc=suppInfo.deploymentContext();
    }
    if (dc == null) {
      return;
    }
    final InterceptorNotifier notifier=new InterceptorNotifier(habitat,dc);
    try {
      notifier.ensureAfterReported(ExtendedDeploymentContext.Phase.REPLICATION);
      logger.log(Level.INFO,"String_Node_Str" + this.getClass().getName() + "String_Node_Str");
    }
 catch (    Exception e) {
      report.failure(logger,e.getMessage());
      logger.log(Level.SEVERE,"String_Node_Str" + this.getClass().getName(),e);
    }
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str" + this.getClass().getName(),e);
  }
}
Program: 28544
Project: 28544
Buggy source:
/** 
 * Save the original request information into our session.
 * @param request The request to be saved
 * @param session The session to contain the saved information
 */
protected void saveRequest(HttpRequest request,Session session){
  HttpServletRequest hreq=(HttpServletRequest)request.getRequest();
  SavedRequest saved=new SavedRequest();
  Cookie cookies[]=hreq.getCookies();
  if (cookies != null) {
    for (int i=0; i < cookies.length; i++)     saved.addCookie(cookies[i]);
  }
  Enumeration names=hreq.getHeaderNames();
  while (names.hasMoreElements()) {
    String name=(String)names.nextElement();
    Enumeration values=hreq.getHeaders(name);
    while (values.hasMoreElements()) {
      String value=(String)values.nextElement();
      saved.addHeader(name,value);
    }
  }
  Enumeration locales=hreq.getLocales();
  while (locales.hasMoreElements()) {
    Locale locale=(Locale)locales.nextElement();
    saved.addLocale(locale);
  }
  Map<String,String[]> parameters=hreq.getParameterMap();
  for (  Map.Entry<String,String[]> e : parameters.entrySet()) {
    String paramName=e.getKey();
    String paramValues[]=e.getValue();
    saved.addParameter(paramName,paramValues);
  }
  saved.setMethod(hreq.getMethod());
  saved.setQueryString(hreq.getQueryString());
  saved.setRequestURI(hreq.getRequestURI());
  session.setNote(Constants.FORM_REQUEST_NOTE,saved);
}

Fixed version (ground truth):
/** 
 * Save the original request information into our session.
 * @param request The request to be saved
 * @param session The session to contain the saved information
 */
protected void saveRequest(HttpRequest request,Session session) throws IOException {
  HttpServletRequest hreq=(HttpServletRequest)request.getRequest();
  SavedRequest saved=new SavedRequest();
  Cookie cookies[]=hreq.getCookies();
  if (cookies != null) {
    for (int i=0; i < cookies.length; i++)     saved.addCookie(cookies[i]);
  }
  Enumeration names=hreq.getHeaderNames();
  while (names.hasMoreElements()) {
    String name=(String)names.nextElement();
    Enumeration values=hreq.getHeaders(name);
    while (values.hasMoreElements()) {
      String value=(String)values.nextElement();
      saved.addHeader(name,value);
    }
  }
  saved.setContentLength(hreq.getContentLength());
  Enumeration locales=hreq.getLocales();
  while (locales.hasMoreElements()) {
    Locale locale=(Locale)locales.nextElement();
    saved.addLocale(locale);
  }
  ((HttpResponse)request.getResponse()).sendAcknowledgement();
  ByteChunk body=new ByteChunk();
  body.setLimit(request.getConnector().getMaxSavePostSize());
  byte[] buffer=new byte[4096];
  int bytesRead;
  InputStream is=request.getStream();
  while ((bytesRead=is.read(buffer)) >= 0) {
    body.append(buffer,0,bytesRead);
  }
  if (body.getLength() > 0) {
    saved.setContentType(hreq.getContentType());
    saved.setBody(body);
  }
  saved.setMethod(hreq.getMethod());
  saved.setQueryString(hreq.getQueryString());
  saved.setRequestURI(hreq.getRequestURI());
  session.setNote(Constants.FORM_REQUEST_NOTE,saved);
}
Program: 28545
Project: 28545
Buggy source:
private boolean hasSecureAdminPrincipal(final AzSubject subject){
  for (  Principal p : subject.getSubject().getPrincipals()) {
    for (    SecureAdminPrincipal sap : secureAdmin.getSecureAdminPrincipal()) {
      if (sap.getDn().equals(p.getName())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean hasSecureAdminPrincipal(final AzSubject subject){
  if (secureAdmin == null) {
    return false;
  }
  for (  Principal p : subject.getSubject().getPrincipals()) {
    for (    SecureAdminPrincipal sap : secureAdmin.getSecureAdminPrincipal()) {
      if (sap.getDn().equals(p.getName())) {
        return true;
      }
    }
  }
  return false;
}
Program: 28547
Project: 28547
Buggy source:
/** 
 * <p> Load the Admin Console web application.</p>
 */
private void load(){
  Application config=adapter.getConfig();
  if (config == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  adapter.setStateMsg(AdapterState.APPLICATION_LOADING);
  String sn=env.getInstanceName();
  ApplicationRef ref=domain.getApplicationRefInServer(sn,AdminConsoleAdapter.ADMIN_APP_NAME);
  habitat.<ApplicationLoaderService>getService(ApplicationLoaderService.class).processApplication(config,ref,log);
  adapter.setStateMsg(AdapterState.APPLICATION_LOADED);
}

Fixed version (ground truth):
/** 
 * <p> Load the Admin Console web application.</p>
 */
private void load(){
  ApplicationRegistry appRegistry=habitat.<ApplicationRegistry>getService(ApplicationRegistry.class);
  ApplicationInfo appInfo=appRegistry.get(AdminConsoleAdapter.ADMIN_APP_NAME);
  if (appInfo != null && appInfo.isLoaded()) {
    adapter.setStateMsg(AdapterState.APPLICATION_LOADED);
    return;
  }
  Application config=adapter.getConfig();
  if (config == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  adapter.setStateMsg(AdapterState.APPLICATION_LOADING);
  String sn=env.getInstanceName();
  ApplicationRef ref=domain.getApplicationRefInServer(sn,AdminConsoleAdapter.ADMIN_APP_NAME);
  habitat.<ApplicationLoaderService>getService(ApplicationLoaderService.class).processApplication(config,ref,log);
  adapter.setStateMsg(AdapterState.APPLICATION_LOADED);
}
Program: 28548
Project: 28548
Buggy source:
@Override public List<SocketInfo> extract(IOR ior){
  List<SocketInfo> socketInfo=null;
  try {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",baseMsg);
    }
    IIOPProfileTemplate iiopProfileTemplate=(IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate();
    IIOPSSLUtil sslUtil=null;
    if (Globals.getDefaultHabitat() != null) {
      sslUtil=Globals.getDefaultHabitat().getService(IIOPSSLUtil.class);
      socketInfo=(List<SocketInfo>)sslUtil.getSSLPortsAsSocketInfo(ior);
    }
    if (socketInfo == null) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str",baseMsg);
      }
    }
 else {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str",baseMsg);
      }
    }
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",baseMsg);
    }
  }
 catch (  Exception ex) {
    _logger.log(Level.WARNING,"String_Node_Str",ex);
  }
 finally {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",new Object[]{baseMsg,socketInfo});
    }
  }
  return socketInfo;
}

Fixed version (ground truth):
@Override public List<SocketInfo> extract(IOR ior){
  List<SocketInfo> socketInfo=null;
  try {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",baseMsg);
    }
    IIOPSSLUtil sslUtil=null;
    if (Globals.getDefaultHabitat() != null) {
      sslUtil=Globals.getDefaultHabitat().getService(IIOPSSLUtil.class);
      socketInfo=(List<SocketInfo>)sslUtil.getSSLPortsAsSocketInfo(ior);
    }
    if (socketInfo == null) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str",baseMsg);
      }
    }
 else {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str",baseMsg);
      }
    }
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",baseMsg);
    }
  }
 catch (  Exception ex) {
    _logger.log(Level.WARNING,"String_Node_Str",ex);
  }
 finally {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",new Object[]{baseMsg,socketInfo});
    }
  }
  return socketInfo;
}
Program: 28549
Project: 28549
Buggy source:
private void writeMainClass(final ClientArtifactsManager clientArtifactsManager) throws IOException {
  final String mainClassResourceName=GLASSFISH_APPCLIENT_GROUP_FACADE_CLASS_NAME.replace('.','/') + "String_Node_Str";
  final File mainClassJAR=new File(AppClientDeployerHelper.getModulesDir(serviceLocator),AppClientDeployerHelper.GF_CLIENT_MODULE_PATH);
  final File mainClassFile=File.createTempFile("String_Node_Str","String_Node_Str");
  final OutputStream os=new BufferedOutputStream(new FileOutputStream(mainClassFile));
  InputStream is=null;
  try {
    is=openByteCodeStream(mainClassJAR,mainClassResourceName);
    DeploymentUtils.copyStream(is,os);
    is.close();
    clientArtifactsManager.add(mainClassFile,mainClassResourceName,true);
  }
 catch (  Exception e) {
    throw new DeploymentException(e);
  }
 finally {
    os.close();
    if (is != null) {
      is.close();
    }
  }
}

Fixed version (ground truth):
private void writeMainClass(final ClientArtifactsManager clientArtifactsManager) throws IOException {
  final String mainClassResourceName=GLASSFISH_APPCLIENT_GROUP_FACADE_CLASS_NAME.replace('.','/') + "String_Node_Str";
  final File mainClassJAR=new File(AppClientDeployerHelper.getModulesDir(serviceLocator),AppClientDeployerHelper.GF_CLIENT_MODULE_PATH);
  final File mainClassFile=File.createTempFile("String_Node_Str","String_Node_Str");
  final OutputStream os=new BufferedOutputStream(new FileOutputStream(mainClassFile));
  InputStream is=null;
  JarFile jf=null;
  try {
    jf=new JarFile(mainClassJAR);
    final JarEntry entry=jf.getJarEntry(mainClassResourceName);
    is=jf.getInputStream(entry);
    DeploymentUtils.copyStream(is,os);
    is.close();
    clientArtifactsManager.add(mainClassFile,mainClassResourceName,true);
  }
 catch (  Exception e) {
    throw new DeploymentException(e);
  }
 finally {
    try {
      os.close();
    }
  finally {
      try {
        if (is != null) {
          is.close();
        }
      }
  finally {
        if (jf != null) {
          jf.close();
        }
      }
    }
  }
}
Program: 28550
Project: 28550
Buggy source:
/** 
 * <p> This method is responsible for generating the content and returning an InputStream to that content.  It is also responsible for setting any attribute values in the  {@link DownloadServlet#Context}, such as   {@link DownloadServlet#EXTENSION} or{@link DownloadServlet#CONTENT_TYPE}.</p>
 */
public InputStream getInputStream(DownloadServlet.Context ctx){
  ctx.setAttribute(DownloadServlet.EXTENSION,"String_Node_Str");
  HttpServletRequest request=(HttpServletRequest)ctx.getServletRequest();
  String target=request.getParameter("String_Node_Str");
  String restUrl=request.getParameter("String_Node_Str");
  InputStream tmpFile=null;
  try {
    String endpoint=restUrl + "String_Node_Str";
    DateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
    Date date=new Date();
    Map attrsMap=new HashMap();
    String tempDir=System.getProperty("String_Node_Str");
    String fileName="String_Node_Str" + target + "String_Node_Str"+ dateFormat.format(date)+ "String_Node_Str";
    String filePath=tempDir + System.getProperty("String_Node_Str") + fileName;
    File file=new File(filePath);
    attrsMap.put("String_Node_Str",filePath);
    attrsMap.put("String_Node_Str","String_Node_Str");
    attrsMap.put("String_Node_Str",target);
    RestUtil.postRestRequestFromServlet(request,endpoint,attrsMap,true,true);
    tmpFile=new FileInputStream(file);
    file.delete();
  }
 catch (  Exception ex) {
    throw new RuntimeException(ex);
  }
  ctx.setAttribute("String_Node_Str",tmpFile);
  return tmpFile;
}

Fixed version (ground truth):
/** 
 * <p> This method is responsible for generating the content and returning an InputStream to that content.  It is also responsible for setting any attribute values in the  {@link DownloadServlet#Context}, such as   {@link DownloadServlet#EXTENSION} or{@link DownloadServlet#CONTENT_TYPE}.</p>
 */
public InputStream getInputStream(DownloadServlet.Context ctx){
  ctx.setAttribute(DownloadServlet.EXTENSION,"String_Node_Str");
  HttpServletRequest request=(HttpServletRequest)ctx.getServletRequest();
  String target=request.getParameter("String_Node_Str");
  String restUrl=request.getParameter("String_Node_Str");
  InputStream tmpFile=null;
  try {
    String endpoint=restUrl + "String_Node_Str";
    DateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
    Date date=new Date();
    Map attrsMap=new HashMap();
    String tempDir=System.getProperty("String_Node_Str");
    String fileName="String_Node_Str" + target + "String_Node_Str"+ dateFormat.format(date)+ "String_Node_Str";
    File file=new File(tempDir,fileName);
    attrsMap.put("String_Node_Str",file.getAbsolutePath());
    attrsMap.put("String_Node_Str","String_Node_Str");
    attrsMap.put("String_Node_Str",target);
    RestUtil.postRestRequestFromServlet(request,endpoint,attrsMap,true,true);
    tmpFile=new FileInputStream(file);
    file.delete();
  }
 catch (  Exception ex) {
    throw new RuntimeException(ex);
  }
  ctx.setAttribute("String_Node_Str",tmpFile);
  return tmpFile;
}
Program: 28551
Project: 28551
Buggy source:
@Override public void onAllDataRead(){
  if (!Boolean.TRUE.equals(IS_READY_SCOPE.get())) {
    processAllDataRead();
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processAllDataRead();
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void onAllDataRead(){
  if (disable) {
    return;
  }
  if (!Boolean.TRUE.equals(IS_READY_SCOPE.get())) {
    processAllDataRead();
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processAllDataRead();
      }
    }
);
  }
}
Program: 28552
Project: 28552
Buggy source:
private void processAllDataRead(){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=request.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (lk) {
      prevIsReady=true;
      try {
        readListener.onAllDataRead();
      }
 catch (      Throwable t) {
        readListener.onError(t);
      }
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}

Fixed version (ground truth):
private void processAllDataRead(){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=request.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (this) {
      prevIsReady=true;
      try {
        readListener.onAllDataRead();
      }
 catch (      Throwable t) {
        disable=true;
        readListener.onError(t);
      }
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}
Program: 28553
Project: 28553
Buggy source:
@Override public void onDataAvailable(){
  if (!Boolean.TRUE.equals(IS_READY_SCOPE.get())) {
    processDataAvailable();
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processDataAvailable();
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void onDataAvailable(){
  if (disable) {
    return;
  }
  if (!Boolean.TRUE.equals(IS_READY_SCOPE.get())) {
    processDataAvailable();
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processDataAvailable();
      }
    }
);
  }
}
Program: 28554
Project: 28554
Buggy source:
@Override public void onError(final Throwable t){
  if (!Boolean.TRUE.equals(IS_READY_SCOPE.get())) {
    processError(t);
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processError(t);
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void onError(final Throwable t){
  if (disable) {
    return;
  }
  disable=true;
  if (!Boolean.TRUE.equals(IS_READY_SCOPE.get())) {
    processError(t);
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processError(t);
      }
    }
);
  }
}
Program: 28555
Project: 28555
Buggy source:
private void processDataAvailable(){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=request.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (lk) {
      prevIsReady=true;
      try {
        readListener.onDataAvailable();
      }
 catch (      Throwable t) {
        readListener.onError(t);
      }
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}

Fixed version (ground truth):
private void processDataAvailable(){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=request.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (this) {
      prevIsReady=true;
      try {
        readListener.onDataAvailable();
      }
 catch (      Throwable t) {
        disable=true;
        readListener.onError(t);
      }
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}
Program: 28556
Project: 28556
Buggy source:
private void processError(final Throwable t){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=request.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (lk) {
      final boolean isUpgrade=request.isUpgrade();
      final WebConnection wc=request.getWebConnection();
      readListener.onError(t);
      if (isUpgrade) {
        if (wc != null) {
          try {
            wc.close();
          }
 catch (          Exception ignored) {
          }
        }
      }
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}

Fixed version (ground truth):
private void processError(final Throwable t){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=request.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (this) {
      final boolean isUpgrade=request.isUpgrade();
      final WebConnection wc=request.getWebConnection();
      try {
        readListener.onError(t);
      }
  finally {
        if (isUpgrade && wc != null) {
          try {
            wc.close();
          }
 catch (          Exception ignored) {
          }
        }
      }
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}
Program: 28557
Project: 28557
Buggy source:
public void onWritePossible(){
  if (!Boolean.TRUE.equals(CAN_WRITE_SCOPE.get())) {
    processWritePossible();
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processWritePossible();
      }
    }
);
  }
}

Fixed version (ground truth):
public void onWritePossible(){
  if (disable) {
    return;
  }
  if (!Boolean.TRUE.equals(CAN_WRITE_SCOPE.get())) {
    processWritePossible();
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processWritePossible();
      }
    }
);
  }
}
Program: 28558
Project: 28558
Buggy source:
private void processWritePossible(){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=response.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (lk) {
      prevIsReady=true;
      try {
        writeListener.onWritePossible();
      }
 catch (      Throwable t) {
        writeListener.onError(t);
      }
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}

Fixed version (ground truth):
private void processWritePossible(){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=response.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (this) {
      prevIsReady=true;
      try {
        writeListener.onWritePossible();
      }
 catch (      Throwable t) {
        disable=true;
        writeListener.onError(t);
      }
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}
Program: 28559
Project: 28559
Buggy source:
public void onError(final Throwable t){
  if (!Boolean.TRUE.equals(CAN_WRITE_SCOPE.get())) {
    processError(t);
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processError(t);
      }
    }
);
  }
}

Fixed version (ground truth):
public void onError(final Throwable t){
  if (disable) {
    return;
  }
  disable=true;
  if (!Boolean.TRUE.equals(CAN_WRITE_SCOPE.get())) {
    processError(t);
  }
 else {
    AsyncContextImpl.getExecutorService().execute(new Runnable(){
      @Override public void run(){
        processError(t);
      }
    }
);
  }
}
Program: 28560
Project: 28560
Buggy source:
private void processError(final Throwable t){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=response.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (lk) {
      writeListener.onError(t);
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}

Fixed version (ground truth):
private void processError(final Throwable t){
  ClassLoader oldCL;
  if (Globals.IS_SECURITY_ENABLED) {
    PrivilegedAction<ClassLoader> pa=new PrivilegedGetTccl();
    oldCL=AccessController.doPrivileged(pa);
  }
 else {
    oldCL=Thread.currentThread().getContextClassLoader();
  }
  try {
    ClassLoader newCL=response.getContext().getLoader().getClassLoader();
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(newCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(newCL);
    }
synchronized (this) {
      writeListener.onError(t);
    }
  }
  finally {
    if (Globals.IS_SECURITY_ENABLED) {
      PrivilegedAction<Void> pa=new PrivilegedSetTccl(oldCL);
      AccessController.doPrivileged(pa);
    }
 else {
      Thread.currentThread().setContextClassLoader(oldCL);
    }
  }
}
Program: 28561
Project: 28561
Buggy source:
void asyncTimeout(){
  if (asyncContext != null) {
    asyncContext.notifyAsyncListeners(AsyncContextImpl.AsyncEventType.TIMEOUT,null);
  }
  errorDispatchAndComplete(null);
}

Fixed version (ground truth):
void asyncTimeout(){
  if (asyncContext != null) {
    asyncContext.notifyAsyncListeners(AsyncContextImpl.AsyncEventType.TIMEOUT,null);
  }
  inputBuffer.disableReadHandler();
  if (response instanceof Response) {
    ((Response)response).disableWriteHandler();
  }
  errorDispatchAndComplete(null);
}
Program: 28562
Project: 28562
Buggy source:
private synchronized Decider getDecider(){
  if (decider == null) {
    decider=createDecider();
    if (isDebug) {
      _logger.log(DEBUG_LEVEL,"String_Node_Str",decider.getClass().getName());
    }
  }
  return decider;
}

Fixed version (ground truth):
private synchronized Decider getDecider(){
  if (decider == null) {
    decider=createDecider();
    if (isDebug()) {
      _logger.log(DEBUG_LEVEL,"String_Node_Str",decider.getClass().getName());
    }
  }
  return decider;
}
Program: 28563
Project: 28563
Buggy source:
private AzResult getAdminDecision(final AzSubject subject,final AzResource resource,final AzAction action,final AzEnvironment environment){
  if (isDebug) {
    _logger.log(DEBUG_LEVEL,"String_Node_Str");
  }
  AzResult rtn=new AzResultImpl(getDecider().decide(subject,resource,action,environment),Status.OK,new AzObligationsImpl());
  return rtn;
}

Fixed version (ground truth):
private AzResult getAdminDecision(final AzSubject subject,final AzResource resource,final AzAction action,final AzEnvironment environment){
  if (isDebug()) {
    _logger.log(DEBUG_LEVEL,"String_Node_Str");
  }
  AzResult rtn=new AzResultImpl(getDecider().decide(subject,resource,action,environment),Status.OK,new AzObligationsImpl());
  return rtn;
}
Program: 28564
Project: 28564
Buggy source:
@Override public AzResult getAuthorizationDecision(AzSubject subject,AzResource resource,AzAction action,AzEnvironment environment,List<AzAttributeResolver> attributeResolvers){
  isDebug=_logger.isLoggable(DEBUG_LEVEL);
  if (!isAdminResource(resource)) {
    final String resourceName=resource.getUri() == null ? "String_Node_Str" : resource.getUri().toASCIIString();
    _logger.log(Level.WARNING,resourceName,new IllegalArgumentException(resourceName));
  }
  return getAdminDecision(subject,resource,action,environment);
}

Fixed version (ground truth):
@Override public AzResult getAuthorizationDecision(AzSubject subject,AzResource resource,AzAction action,AzEnvironment environment,List<AzAttributeResolver> attributeResolvers){
  if (!isAdminResource(resource)) {
    final String resourceName=resource.getUri() == null ? "String_Node_Str" : resource.getUri().toASCIIString();
    _logger.log(Level.WARNING,resourceName,new IllegalArgumentException(resourceName));
  }
  return getAdminDecision(subject,resource,action,environment);
}
Program: 28565
Project: 28565
Buggy source:
public static void deploy(String app,String serverId,List<String> deployParams) throws Exception {
  GlassFish glassfish=gfMap.get(serverId);
  if (glassfish == null) {
    throw new Exception("String_Node_Str" + serverId + "String_Node_Str");
  }
  if (app == null) {
    throw new Exception("String_Node_Str");
  }
  Deployer deployer=glassfish.getDeployer();
  if (deployParams.size() > 0) {
    deployer.deploy(new File(app).toURI(),deployParams.toArray(new String[0]));
    System.out.println("String_Node_Str" + app + "String_Node_Str"+ deployParams);
  }
 else {
    deployer.deploy(new File(app).toURI());
    System.out.println("String_Node_Str" + app + "String_Node_Str");
  }
}

Fixed version (ground truth):
public static void deploy(String app,String serverId,List<String> deployParams) throws Exception {
  GlassFish glassfish=gfMap.get(serverId);
  if (glassfish == null) {
    throw new Exception("String_Node_Str" + serverId + "String_Node_Str");
  }
  if (app == null) {
    throw new Exception("String_Node_Str");
  }
  Deployer deployer=glassfish.getDeployer();
  final int len=deployParams.size();
  if (len > 0) {
    deployer.deploy(new File(app).toURI(),deployParams.toArray(new String[len]));
    System.out.println("String_Node_Str" + app + "String_Node_Str"+ deployParams);
  }
 else {
    deployer.deploy(new File(app).toURI());
    System.out.println("String_Node_Str" + app + "String_Node_Str");
  }
}
Program: 28566
Project: 28566
Buggy source:
public void execute(String commandExec) throws BuildException {
  log("String_Node_Str" + commandExec);
  String installDirectory=getInstallDir();
  if (installDirectory == null) {
    log("String_Node_Str",Project.MSG_WARN);
    return;
  }
  File f=new File(installDirectory);
  if (!f.exists()) {
    log("String_Node_Str" + installDirectory + "String_Node_Str");
    return;
  }
  try {
    File asadmin=getAsAdmin(f);
    Process pr=Runtime.getRuntime().exec(asadmin.getAbsolutePath() + "String_Node_Str" + commandExec);
    BufferedReader error=new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    String errorLine=null;
    while ((errorLine=error.readLine()) != null) {
      log(errorLine);
    }
    BufferedReader input=new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String inputLine=null;
    while ((inputLine=input.readLine()) != null) {
      log(inputLine);
    }
    int exitVal=pr.waitFor();
    if (exitVal != 0)     log("String_Node_Str" + exitVal);
  }
 catch (  Exception ex) {
    log(ex.getMessage());
  }
}

Fixed version (ground truth):
public void execute(String commandExec) throws BuildException {
  log("String_Node_Str" + commandExec);
  String installDirectory=getInstallDir();
  if (installDirectory == null) {
    log("String_Node_Str",Project.MSG_WARN);
    return;
  }
  File f=new File(installDirectory);
  if (!f.exists()) {
    log("String_Node_Str" + installDirectory + "String_Node_Str");
    return;
  }
  BufferedReader error=null;
  BufferedReader input=null;
  try {
    File asadmin=getAsAdmin(f);
    Process pr=Runtime.getRuntime().exec(asadmin.getAbsolutePath() + "String_Node_Str" + commandExec);
    error=new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    String errorLine=null;
    while ((errorLine=error.readLine()) != null) {
      log(errorLine);
    }
    input=new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String inputLine=null;
    while ((inputLine=input.readLine()) != null) {
      log(inputLine);
    }
    int exitVal=pr.waitFor();
    if (exitVal != 0)     log("String_Node_Str" + exitVal);
  }
 catch (  Exception ex) {
    log(ex.getMessage());
  }
 finally {
    if (error != null) {
      try {
        error.close();
      }
 catch (      Exception e) {
      }
    }
    if (input != null) {
      try {
        input.close();
      }
 catch (      Exception e) {
      }
    }
  }
}
Program: 28567
Project: 28567
Buggy source:
/** 
 * Prepares for invoking uninstall-node on DAS
 * @param ctx command context
 * @return true if uninstall-node succeeds, false otherwise
 */
private boolean uninstallNode(AdminCommandContext ctx,ParameterMap map,Node node){
  boolean res=false;
  remotepassword=map.getOne(NodeUtils.PARAM_REMOTEPASSWORD);
  sshkeypassphrase=map.getOne(NodeUtils.PARAM_SSHKEYPASSPHRASE);
  ArrayList<String> command=new ArrayList<String>();
  command.add(getUninstallCommandName());
  String type=node.getType();
  command.add("String_Node_Str");
  command.add(map.getOne(NodeUtils.PARAM_INSTALLDIR));
  if (force) {
    command.add("String_Node_Str");
  }
  setTypeSpecificOperands(command,map);
  String host=map.getOne(NodeUtils.PARAM_NODEHOST);
  command.add(host);
  String firstErrorMessage=Strings.get("String_Node_Str",node.getName(),host);
  StringBuilder out=new StringBuilder();
  int exitCode=execCommand(command,out);
  logger.info(out.toString().trim());
  ActionReport report=ctx.getActionReport();
  if (exitCode == 0) {
    String msg=Strings.get("String_Node_Str",host);
    report.setMessage(msg);
    res=true;
  }
 else {
    report.setMessage(firstErrorMessage);
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Prepares for invoking uninstall-node on DAS
 * @param ctx command context
 * @return true if uninstall-node succeeds, false otherwise
 */
private boolean uninstallNode(AdminCommandContext ctx,ParameterMap map,Node node){
  boolean res=false;
  remotepassword=map.getOne(NodeUtils.PARAM_REMOTEPASSWORD);
  sshkeypassphrase=map.getOne(NodeUtils.PARAM_SSHKEYPASSPHRASE);
  ArrayList<String> command=new ArrayList<String>();
  command.add(getUninstallCommandName());
  command.add("String_Node_Str");
  command.add(map.getOne(NodeUtils.PARAM_INSTALLDIR));
  if (force) {
    command.add("String_Node_Str");
  }
  setTypeSpecificOperands(command,map);
  String host=map.getOne(NodeUtils.PARAM_NODEHOST);
  command.add(host);
  String firstErrorMessage=Strings.get("String_Node_Str",node.getName(),host);
  StringBuilder out=new StringBuilder();
  int exitCode=execCommand(command,out);
  logger.info(out.toString().trim());
  ActionReport report=ctx.getActionReport();
  if (exitCode == 0) {
    String msg=Strings.get("String_Node_Str",host);
    report.setMessage(msg);
    res=true;
  }
 else {
    report.setMessage(firstErrorMessage);
  }
  return res;
}
Program: 28568
Project: 28568
Buggy source:
File defaultLocalNodeDirFile(){
  String installDir=node.getInstallDir();
  String nodeName=node.getName();
  final File nodeParentDir=(installDir == null ? serverContext.getInstallRoot() : new File(installDir,"String_Node_Str"));
  return new File(nodeParentDir,"String_Node_Str");
}

Fixed version (ground truth):
File defaultLocalNodeDirFile(){
  String installDir=node.getInstallDir();
  final File nodeParentDir=(installDir == null ? serverContext.getInstallRoot() : new File(installDir,"String_Node_Str"));
  return new File(nodeParentDir,"String_Node_Str");
}
Program: 28570
Project: 28570
Buggy source:
public void execute(AdminCommandContext context){
  ActionReport report=context.getActionReport();
  report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
  List<Config> configList=null;
  if (target.equals("String_Node_Str")) {
    Configs configs=domain.getConfigs();
    configList=configs.getConfig();
  }
 else {
    configList=createConfigList();
    if (configList == null) {
      fail(Strings.get("String_Node_Str",target));
      return;
    }
  }
  StringBuffer sb=new StringBuffer();
  for (  Config config : configList) {
    sb.append(config.getName()).append('\n');
  }
  String output=sb.toString();
  report.addSubActionsReport().setMessage(output.substring(0,output.length() - 1));
  report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}

Fixed version (ground truth):
public void execute(AdminCommandContext context){
  ActionReport report=context.getActionReport();
  report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
  List<Config> configList=null;
  if (target.equals("String_Node_Str")) {
    Configs configs=domain.getConfigs();
    configList=configs.getConfig();
  }
 else {
    configList=createConfigList();
    if (configList == null) {
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setMessage(Strings.get("String_Node_Str",target));
      return;
    }
  }
  StringBuilder sb=new StringBuilder();
  for (  Config config : configList) {
    sb.append(config.getName()).append('\n');
  }
  String output=sb.toString();
  report.addSubActionsReport().setMessage(output.substring(0,output.length() - 1));
  report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Program: 28571
Project: 28571
Buggy source:
private List<Server> getServersForNode(){
  boolean foundNode=false;
  Nodes nodes=domain.getNodes();
  if (nodes != null) {
    List<Node> nodeList=nodes.getNode();
    if (nodeList != null) {
      for (      Node node : nodeList) {
        if (whichTarget.equals(node.getName())) {
          foundNode=true;
          break;
        }
      }
    }
  }
  if (!foundNode) {
    return null;
  }
 else {
    return domain.getInstancesOnNode(whichTarget);
  }
}

Fixed version (ground truth):
private List<Server> getServersForNode(){
  if (whichTarget == null)   throw new NullPointerException("String_Node_Str");
  boolean foundNode=false;
  Nodes nodes=domain.getNodes();
  if (nodes != null) {
    List<Node> nodeList=nodes.getNode();
    if (nodeList != null) {
      for (      Node node : nodeList) {
        if (whichTarget.equals(node.getName())) {
          foundNode=true;
          break;
        }
      }
    }
  }
  if (!foundNode) {
    return null;
  }
 else {
    return domain.getInstancesOnNode(whichTarget);
  }
}
Program: 28572
Project: 28572
Buggy source:
public String getNodeList(){
  StringBuilder sb=new StringBuilder();
  boolean firstNode=true;
  for (  Node n : nodeList) {
    String name=n.getName();
    String nodeType=n.getType();
    String host=n.getNodeHost();
    String installDir=n.getInstallDir();
    if (!listType.equals(nodeType) && !listType.equals("String_Node_Str"))     continue;
    if (firstNode)     firstNode=false;
 else     sb.append(EOL);
    if (terse)     sb.append(name);
 else     if (!long_opt)     sb.append(name + "String_Node_Str" + nodeType+ "String_Node_Str"+ host);
    if (long_opt) {
      List<Server> serversOnNode=servers.getServersOnNode(n);
      StringBuilder instanceList=new StringBuilder();
      if (serversOnNode.size() > 0) {
        int i=0;
        for (        Server server : serversOnNode) {
          if (i > 0)           instanceList.append("String_Node_Str");
          instanceList.append(server.getName());
          i++;
        }
      }
      NodeInfo ni=new NodeInfo(name,host,installDir,nodeType,instanceList.toString());
      infos.add(ni);
    }
  }
  if (long_opt)   return NodeInfo.format(infos);
 else   return sb.toString();
}

Fixed version (ground truth):
public String getNodeList(){
  StringBuilder sb=new StringBuilder();
  boolean firstNode=true;
  for (  Node n : nodeList) {
    String name=n.getName();
    String nodeType=n.getType();
    String host=n.getNodeHost();
    String installDir=n.getInstallDir();
    if (!listType.equals(nodeType) && !listType.equals("String_Node_Str"))     continue;
    if (firstNode)     firstNode=false;
 else     sb.append(EOL);
    if (terse)     sb.append(name);
 else     if (!long_opt)     sb.append(name).append("String_Node_Str").append(nodeType).append("String_Node_Str").append(host);
    if (long_opt) {
      List<Server> serversOnNode=servers.getServersOnNode(n);
      StringBuilder instanceList=new StringBuilder();
      if (serversOnNode.size() > 0) {
        int i=0;
        for (        Server server : serversOnNode) {
          if (i > 0)           instanceList.append("String_Node_Str");
          instanceList.append(server.getName());
          i++;
        }
      }
      NodeInfo ni=new NodeInfo(name,host,installDir,nodeType,instanceList.toString());
      infos.add(ni);
    }
  }
  if (long_opt)   return NodeInfo.format(infos);
 else   return sb.toString();
}
Program: 28573
Project: 28573
Buggy source:
public ListNodesHelper(Logger _logger,Servers servers,Nodes nodes,String type,boolean long_opt,boolean terse){
  logger=_logger;
  this.listType=type;
  this.long_opt=long_opt;
  this.terse=terse;
  this.servers=servers;
  nodeList=nodes.getNode();
  infos=new LinkedList<NodeInfo>();
}

Fixed version (ground truth):
public ListNodesHelper(Logger _logger,Servers servers,Nodes nodes,String type,boolean long_opt,boolean terse){
  this.listType=type;
  this.long_opt=long_opt;
  this.terse=terse;
  this.servers=servers;
  nodeList=nodes.getNode();
  infos=new LinkedList<NodeInfo>();
}