Program: 28193
Project: 28193
Buggy source:
/** 
 * Update an network-listener
 * @param httpService the configuration bean.
 */
public void updateConnector(NetworkListener networkListener,HttpService httpService) throws LifecycleException {
synchronized (mapperUpdateSync) {
    if (networkListener.findHttpProtocol().getHttp().getDefaultVirtualServer().equals(org.glassfish.api.web.Constants.ADMIN_VS) || "String_Node_Str".equals(networkListener.getName()) && connectorMap.get("String_Node_Str") == null) {
      return;
    }
    WebConnector connector=connectorMap.get(networkListener.getName());
    if (connector != null) {
      deleteConnector(connector);
    }
    if (!Boolean.valueOf(networkListener.getEnabled())) {
      return;
    }
    connector=addConnector(networkListener,httpService,false);
    List<VirtualServer> virtualServers=getVirtualServersForHttpListenerId(httpService,networkListener.getName());
    if (virtualServers != null) {
      Mapper mapper=connector.getMapper();
      for (      VirtualServer vs : virtualServers) {
        boolean found=false;
        String[] listenerNames=vs.getNetworkListenerNames();
        String name=connector.getName();
        for (        String listenerName : listenerNames) {
          if (listenerName.equals(name)) {
            found=true;
            break;
          }
        }
        if (!found) {
          String[] newListenerNames=new String[listenerNames.length + 1];
          System.arraycopy(listenerNames,0,newListenerNames,0,listenerNames.length);
          newListenerNames[listenerNames.length]=connector.getName();
          vs.setNetworkListenerNames(newListenerNames);
        }
      }
    }
    connector.start();
    if (virtualServers != null) {
      Mapper mapper=connector.getMapper();
      for (      VirtualServer vs : virtualServers) {
        String defaultWebModulePath=vs.getDefaultContextPath(domain,appRegistry);
        if (defaultWebModulePath != null) {
          try {
            mapper.setDefaultContextPath(vs.getName(),defaultWebModulePath);
            vs.setDefaultContextPath(defaultWebModulePath);
          }
 catch (          Exception e) {
            throw new LifecycleException(e);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Update an network-listener
 * @param httpService the configuration bean.
 */
public void updateConnector(NetworkListener networkListener,HttpService httpService) throws LifecycleException {
synchronized (mapperUpdateSync) {
    if (networkListener.findHttpProtocol().getHttp().getDefaultVirtualServer().equals(org.glassfish.api.web.Constants.ADMIN_VS) || "String_Node_Str".equals(networkListener.getName()) && connectorMap.get("String_Node_Str") == null) {
      return;
    }
    WebConnector connector=connectorMap.get(networkListener.getName());
    if (connector != null) {
      deleteConnector(connector);
    }
    if (!Boolean.valueOf(networkListener.getEnabled())) {
      return;
    }
    connector=addConnector(networkListener,httpService,false);
    List<VirtualServer> virtualServers=getVirtualServersForHttpListenerId(httpService,networkListener.getName());
    if (virtualServers != null) {
      for (      VirtualServer vs : virtualServers) {
        boolean found=false;
        String[] listenerNames=vs.getNetworkListenerNames();
        String name=connector.getName();
        for (        String listenerName : listenerNames) {
          if (listenerName.equals(name)) {
            found=true;
            break;
          }
        }
        if (!found) {
          String[] newListenerNames=new String[listenerNames.length + 1];
          System.arraycopy(listenerNames,0,newListenerNames,0,listenerNames.length);
          newListenerNames[listenerNames.length]=connector.getName();
          vs.setNetworkListenerNames(newListenerNames);
        }
      }
    }
    connector.start();
    if (virtualServers != null) {
      Mapper mapper=connector.getMapper();
      for (      VirtualServer vs : virtualServers) {
        String defaultWebModulePath=vs.getDefaultContextPath(domain,appRegistry);
        if (defaultWebModulePath != null) {
          try {
            mapper.setDefaultContextPath(vs.getName(),defaultWebModulePath);
            vs.setDefaultContextPath(defaultWebModulePath);
          }
 catch (          Exception e) {
            throw new LifecycleException(e);
          }
        }
      }
    }
  }
}