nus-yam/ex-repair huggingface dataset:
Program: 29938
Project: 29938
Buggy source:
/** 
 * @param descriptor the WebServices  descriptor
 * @return <code>Result</code> the results for this assertion
 */
public Result check(WebServiceEndpoint descriptor){
  Result result=getInitializedResult();
  ComponentNameConstructor compName=getVerifierContext().getComponentNameConstructor();
  boolean pass=true;
  if (descriptor.hasHandlers()) {
    Collection allPortNames=getAllPortNamesInService(descriptor);
    List handlerChain=descriptor.getHandlerChain();
    for (Iterator it=handlerChain.iterator(); it.hasNext(); ) {
      Collection c=((WebServiceHandler)it.next()).getPortNames();
      Collection invalid=getInvalidHandlerPortNames(c,allPortNames);
      if (invalid.size() > 0) {
        result.addErrorDetails(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{compName.toString()}));
        result.failed(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{"String_Node_Str"}));
        pass=false;
      }
 else {
        result.addGoodDetails(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{compName.toString()}));
        result.passed(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{"String_Node_Str"}));
      }
    }
  }
 else {
    result.addNaDetails(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{compName.toString()}));
    result.notApplicable(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{"String_Node_Str"}));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param descriptor the WebServices  descriptor
 * @return <code>Result</code> the results for this assertion
 */
public Result check(WebServiceEndpoint descriptor){
  Result result=getInitializedResult();
  ComponentNameConstructor compName=getVerifierContext().getComponentNameConstructor();
  boolean pass=true;
  if (descriptor.hasHandlers()) {
    Collection allPortNames=getAllPortNamesInService(descriptor);
    List<WebServiceHandlerChain> handlerChains=descriptor.getHandlerChain();
    for (    WebServiceHandlerChain handlerChain : handlerChains) {
      Collection c=new HashSet();
      for (      WebServiceHandler wsh : handlerChain.getHandlers()) {
        c.addAll(wsh.getPortNames());
      }
      Collection invalid=getInvalidHandlerPortNames(c,allPortNames);
      if (invalid.size() > 0) {
        result.addErrorDetails(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{compName.toString()}));
        result.failed(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{"String_Node_Str"}));
        pass=false;
      }
 else {
        result.addGoodDetails(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{compName.toString()}));
        result.passed(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{"String_Node_Str"}));
      }
    }
  }
 else {
    result.addNaDetails(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{compName.toString()}));
    result.notApplicable(smh.getLocalString("String_Node_Str","String_Node_Str",new Object[]{"String_Node_Str"}));
  }
  return result;
}
Program: 29939
Project: 29939
Buggy source:
/** 
 * <p> This handler adds   {@link IntegrationPoint}s of a given type to a <code>UIComponent</code> tree.  It looks for  {@link IntegrationPoint}s using the given <code>type</code>.  It then sorts the results (if any) by <code>parentId</code>, and then by priority.  It next interates over each one looking for a <code>UIComponent</code> with an <code>id</code> which matches the its own <code>parentId</code> value.  It then uses the content of the   {@link IntegrationPoint} to attempt to include the .jsf pageit refers to under the identified parent component.</p>
 */
@Handler(id="String_Node_Str",input={@HandlerInput(name="String_Node_Str",type=String.class,required=true),@HandlerInput(name="String_Node_Str",type=UIComponent.class,required=false)}) public static void includeIntegrations(HandlerContext handlerCtx){
  String type=(String)handlerCtx.getInputValue("String_Node_Str");
  UIComponent root=(UIComponent)handlerCtx.getInputValue("String_Node_Str");
  FacesContext ctx=handlerCtx.getFacesContext();
  List<IntegrationPoint> points=getIntegrationPoints(ctx,type);
  includeIntegrationPoints(ctx,root,getSortedIntegrationPoints(points));
}

Fixed version (ground truth):
/** 
 * <p> This handler adds   {@link IntegrationPoint}s of a given type to a <code>UIComponent</code> tree.  It looks for  {@link IntegrationPoint}s using the given <code>type</code>.  It then sorts the results (if any) by <code>parentId</code>, and then by priority.  It next interates over each one looking for a <code>UIComponent</code> with an <code>id</code> which matches the its own <code>parentId</code> value.  It then uses the content of the   {@link IntegrationPoint} to attempt to include the .jsf pageit refers to under the identified parent component.</p>
 */
@Handler(id="String_Node_Str",input={@HandlerInput(name="String_Node_Str",type=String.class,required=true),@HandlerInput(name="String_Node_Str",type=UIComponent.class,required=false)}) public static void includeIntegrations(HandlerContext handlerCtx){
  String type=(String)handlerCtx.getInputValue("String_Node_Str");
  UIComponent root=(UIComponent)handlerCtx.getInputValue("String_Node_Str");
  try {
    FacesContext ctx=handlerCtx.getFacesContext();
    List<IntegrationPoint> points=getIntegrationPoints(ctx,type);
    includeIntegrationPoints(ctx,root,getSortedIntegrationPoints(points));
  }
 catch (  Exception ex) {
    GuiUtil.getLogger().severe("String_Node_Str" + type + "String_Node_Str"+ root.toString());
    if (GuiUtil.getLogger().isLoggable(Level.FINE)) {
      ex.printStackTrace();
    }
  }
}
Program: 29940
Project: 29940
Buggy source:
protected static Map<String,Object> fixKeyNames(Map<String,Object> map){
  Map<String,Object> results=new HashMap<String,Object>();
  for (  Map.Entry<String,Object> entry : map.entrySet()) {
    String key=entry.getKey().substring(0,1).toLowerCase() + entry.getKey().substring(1);
    Object value=entry.getValue();
    results.put(key,value);
  }
  return results;
}

Fixed version (ground truth):
protected static Map<String,Object> fixKeyNames(Map<String,Object> map){
  Map<String,Object> results=new HashMap<String,Object>();
  for (  Map.Entry<String,Object> entry : map.entrySet()) {
    String key=entry.getKey().substring(0,1).toLowerCase(GuiUtil.guiLocale) + entry.getKey().substring(1);
    Object value=entry.getValue();
    results.put(key,value);
  }
  return results;
}
Program: 29941
Project: 29941
Buggy source:
public static Map maskOffPassword(Map<String,Object> attrs){
  Map masked=new HashMap();
  if (attrs == null) {
    return masked;
  }
  for (  String key : attrs.keySet()) {
    if (pswdAttrList.contains(key.toLowerCase())) {
      masked.put(key,"String_Node_Str");
    }
 else {
      masked.put(key,attrs.get(key));
    }
  }
  return masked;
}

Fixed version (ground truth):
public static Map maskOffPassword(Map<String,Object> attrs){
  Map masked=new HashMap();
  if (attrs == null) {
    return masked;
  }
  for (  Map.Entry<String,Object> e : attrs.entrySet()) {
    String key=e.getKey().toLowerCase(GuiUtil.guiLocale);
    if (pswdAttrList.contains(key)) {
      masked.put(key,"String_Node_Str");
    }
 else {
      masked.put(key,e.getValue());
    }
  }
  return masked;
}
Program: 29942
Project: 29942
Buggy source:
/** 
 * Parses the parameters of this request. If parameters are present in both the query string and the request content, they are merged.
 */
void parseParameters(){
  if (parsedParams) {
    return;
  }
  parameters=new HashMap<String,String[]>();
synchronized (parameters) {
    parameters=copyMap(getRequest().getParameterMap());
    mergeParameters();
    parsedParams=true;
  }
}

Fixed version (ground truth):
/** 
 * Parses the parameters of this request. If parameters are present in both the query string and the request content, they are merged.
 */
void parseParameters(){
  if (parsedParams) {
    return;
  }
  parameters=new HashMap<String,String[]>();
synchronized (parameters) {
    copyMap(getRequest().getParameterMap(),parameters);
    mergeParameters();
    parsedParams=true;
  }
}
Program: 29943
Project: 29943
Buggy source:
/** 
 * Perform a shallow copy of the specified Map, and return the result.
 * @param orig Origin Map to be copied
 */
Map<String,String[]> copyMap(Map<String,String[]> orig){
  if (orig == null)   return (new HashMap<String,String[]>());
  HashMap<String,String[]> dest=new HashMap<String,String[]>();
synchronized (orig) {
    for (    Map.Entry<String,String[]> entry : orig.entrySet()) {
      dest.put(entry.getKey(),entry.getValue());
    }
  }
  return (dest);
}

Fixed version (ground truth):
/** 
 * Perform a shallow copy of the specified Map, and return the result.
 * @param orig Origin Map to be copied
 */
void copyMap(Map<String,String[]> orig,Map<String,String[]> dest){
  if (orig == null)   return;
synchronized (orig) {
    for (    Map.Entry<String,String[]> entry : orig.entrySet()) {
      dest.put(entry.getKey(),entry.getValue());
    }
  }
}
Program: 29944
Project: 29944
Buggy source:
/** 
 * Remove the specified Service from the set associated from this Server.
 * @param service The Service to be removed
 */
public void removeService(Service service){
synchronized (services) {
    int j=-1;
    for (int i=0; i < services.length; i++) {
      if (service == services[i]) {
        j=i;
        break;
      }
    }
    if (j < 0)     return;
    if (services[j] instanceof Lifecycle) {
      try {
        ((Lifecycle)services[j]).stop();
      }
 catch (      LifecycleException e) {
      }
    }
    int k=0;
    Service results[]=new Service[services.length - 1];
    for (int i=0; i < services.length; i++) {
      if (i != j)       results[k++]=services[i];
    }
    services=results;
    support.firePropertyChange("String_Node_Str",service,null);
  }
}

Fixed version (ground truth):
/** 
 * Remove the specified Service from the set associated from this Server.
 * @param service The Service to be removed
 */
public void removeService(Service service){
synchronized (servicesMonitor) {
    int j=-1;
    for (int i=0; i < services.length; i++) {
      if (service == services[i]) {
        j=i;
        break;
      }
    }
    if (j < 0)     return;
    if (services[j] instanceof Lifecycle) {
      try {
        ((Lifecycle)services[j]).stop();
      }
 catch (      LifecycleException e) {
      }
    }
    int k=0;
    Service results[]=new Service[services.length - 1];
    for (int i=0; i < services.length; i++) {
      if (i != j)       results[k++]=services[i];
    }
    services=results;
    support.firePropertyChange("String_Node_Str",service,null);
  }
}
Program: 29945
Project: 29945
Buggy source:
/** 
 * Add a new Service to the set of defined Services.
 * @param service The Service to be added
 */
public void addService(Service service){
  service.setServer(this);
synchronized (services) {
    Service results[]=new Service[services.length + 1];
    System.arraycopy(services,0,results,0,services.length);
    results[services.length]=service;
    services=results;
    if (initialized) {
      try {
        service.initialize();
      }
 catch (      LifecycleException e) {
        log.log(Level.SEVERE,e.toString());
      }
    }
    if (started && (service instanceof Lifecycle)) {
      try {
        ((Lifecycle)service).start();
      }
 catch (      LifecycleException e) {
      }
    }
    support.firePropertyChange("String_Node_Str",null,service);
  }
}

Fixed version (ground truth):
/** 
 * Add a new Service to the set of defined Services.
 * @param service The Service to be added
 */
public void addService(Service service){
  service.setServer(this);
synchronized (servicesMonitor) {
    Service results[]=new Service[services.length + 1];
    System.arraycopy(services,0,results,0,services.length);
    results[services.length]=service;
    services=results;
    if (initialized) {
      try {
        service.initialize();
      }
 catch (      LifecycleException e) {
        log.log(Level.SEVERE,e.toString());
      }
    }
    if (started && (service instanceof Lifecycle)) {
      try {
        ((Lifecycle)service).start();
      }
 catch (      LifecycleException e) {
      }
    }
    support.firePropertyChange("String_Node_Str",null,service);
  }
}
Program: 29946
Project: 29946
Buggy source:
/** 
 * Return the specified Service (if it exists); otherwise return <code>null</code>.
 * @param name Name of the Service to be returned
 */
public Service findService(String name){
  if (name == null) {
    return (null);
  }
synchronized (services) {
    for (int i=0; i < services.length; i++) {
      if (name.equals(services[i].getName())) {
        return (services[i]);
      }
    }
  }
  return (null);
}

Fixed version (ground truth):
/** 
 * Return the specified Service (if it exists); otherwise return <code>null</code>.
 * @param name Name of the Service to be returned
 */
public Service findService(String name){
  if (name == null) {
    return (null);
  }
synchronized (servicesMonitor) {
    for (int i=0; i < services.length; i++) {
      if (name.equals(services[i].getName())) {
        return (services[i]);
      }
    }
  }
  return (null);
}
Program: 29947
Project: 29947
Buggy source:
/** 
 * Prepare for the beginning of active use of the public methods of this component.  This method should be called before any of the public methods of this component are utilized.  It should also send a LifecycleEvent of type START_EVENT to any registered listeners.
 * @exception LifecycleException if this component detects a fatal errorthat prevents this component from being used
 */
public void start() throws LifecycleException {
  if (started) {
    if (log.isLoggable(Level.FINE)) {
      log.fine(sm.getString("String_Node_Str"));
    }
    return;
  }
  lifecycle.fireLifecycleEvent(BEFORE_START_EVENT,null);
  lifecycle.fireLifecycleEvent(START_EVENT,null);
  started=true;
synchronized (services) {
    for (int i=0; i < services.length; i++) {
      if (services[i] instanceof Lifecycle)       ((Lifecycle)services[i]).start();
    }
  }
  lifecycle.fireLifecycleEvent(AFTER_START_EVENT,null);
}

Fixed version (ground truth):
/** 
 * Prepare for the beginning of active use of the public methods of this component.  This method should be called before any of the public methods of this component are utilized.  It should also send a LifecycleEvent of type START_EVENT to any registered listeners.
 * @exception LifecycleException if this component detects a fatal errorthat prevents this component from being used
 */
public void start() throws LifecycleException {
  if (started) {
    if (log.isLoggable(Level.FINE)) {
      log.fine(sm.getString("String_Node_Str"));
    }
    return;
  }
  lifecycle.fireLifecycleEvent(BEFORE_START_EVENT,null);
  lifecycle.fireLifecycleEvent(START_EVENT,null);
  started=true;
synchronized (servicesMonitor) {
    for (int i=0; i < services.length; i++) {
      if (services[i] instanceof Lifecycle)       ((Lifecycle)services[i]).start();
    }
  }
  lifecycle.fireLifecycleEvent(AFTER_START_EVENT,null);
}
Program: 29948
Project: 29948
Buggy source:
/** 
 * Prepare for the beginning of active use of the public methods of this component.  This method should be called before any of the public methods of this component are utilized.  It should also send a LifecycleEvent of type START_EVENT to any registered listeners.
 * @exception LifecycleException if this component detects a fatal errorthat prevents this component from being used
 */
public void start() throws LifecycleException {
  if (started) {
    if (log.isLoggable(Level.INFO)) {
      log.info(sm.getString("String_Node_Str"));
    }
  }
  if (!initialized)   init();
  lifecycle.fireLifecycleEvent(BEFORE_START_EVENT,null);
  if (log.isLoggable(Level.INFO)) {
    log.info(sm.getString("String_Node_Str",this.name));
  }
  lifecycle.fireLifecycleEvent(START_EVENT,null);
  started=true;
  if (container != null) {
synchronized (container) {
      if (container instanceof Lifecycle) {
        ((Lifecycle)container).start();
      }
    }
  }
synchronized (connectors) {
    for (int i=0; i < connectors.length; i++) {
      if (connectors[i] instanceof Lifecycle)       ((Lifecycle)connectors[i]).start();
    }
  }
  lifecycle.fireLifecycleEvent(AFTER_START_EVENT,null);
}

Fixed version (ground truth):
/** 
 * Prepare for the beginning of active use of the public methods of this component.  This method should be called before any of the public methods of this component are utilized.  It should also send a LifecycleEvent of type START_EVENT to any registered listeners.
 * @exception LifecycleException if this component detects a fatal errorthat prevents this component from being used
 */
public void start() throws LifecycleException {
  if (started) {
    if (log.isLoggable(Level.INFO)) {
      log.info(sm.getString("String_Node_Str"));
    }
  }
  if (!initialized)   init();
  lifecycle.fireLifecycleEvent(BEFORE_START_EVENT,null);
  if (log.isLoggable(Level.INFO)) {
    log.info(sm.getString("String_Node_Str",this.name));
  }
  lifecycle.fireLifecycleEvent(START_EVENT,null);
  started=true;
  if (container != null) {
synchronized (container) {
      if (container instanceof Lifecycle) {
        ((Lifecycle)container).start();
      }
    }
  }
synchronized (connectorsMonitor) {
    for (int i=0; i < connectors.length; i++) {
      if (connectors[i] instanceof Lifecycle)       ((Lifecycle)connectors[i]).start();
    }
  }
  lifecycle.fireLifecycleEvent(AFTER_START_EVENT,null);
}
Program: 29949
Project: 29949
Buggy source:
/** 
 * Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.
 * @param connector The Connector to be added
 */
public void addConnector(Connector connector){
synchronized (connectors) {
    connector.setContainer(this.container);
    connector.setService(this);
    Connector results[]=new Connector[connectors.length + 1];
    System.arraycopy(connectors,0,results,0,connectors.length);
    results[connectors.length]=connector;
    connectors=results;
    if (initialized) {
      try {
        connector.initialize();
      }
 catch (      LifecycleException e) {
        log.log(Level.SEVERE,"String_Node_Str",e);
      }
    }
    if (started && (connector instanceof Lifecycle)) {
      try {
        ((Lifecycle)connector).start();
      }
 catch (      LifecycleException e) {
        log.log(Level.SEVERE,"String_Node_Str",e);
      }
    }
    support.firePropertyChange("String_Node_Str",null,connector);
  }
}

Fixed version (ground truth):
/** 
 * Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.
 * @param connector The Connector to be added
 */
public void addConnector(Connector connector){
synchronized (connectorsMonitor) {
    connector.setContainer(this.container);
    connector.setService(this);
    Connector results[]=new Connector[connectors.length + 1];
    System.arraycopy(connectors,0,results,0,connectors.length);
    results[connectors.length]=connector;
    connectors=results;
    if (initialized) {
      try {
        connector.initialize();
      }
 catch (      LifecycleException e) {
        log.log(Level.SEVERE,"String_Node_Str",e);
      }
    }
    if (started && (connector instanceof Lifecycle)) {
      try {
        ((Lifecycle)connector).start();
      }
 catch (      LifecycleException e) {
        log.log(Level.SEVERE,"String_Node_Str",e);
      }
    }
    support.firePropertyChange("String_Node_Str",null,connector);
  }
}
Program: 29950
Project: 29950
Buggy source:
/** 
 * Gracefully terminate the active use of the public methods of this component.  This method should be the last one called on a given instance of this component.  It should also send a LifecycleEvent of type STOP_EVENT to any registered listeners.
 * @exception LifecycleException if this component detects a fatal errorthat needs to be reported
 */
public void stop() throws LifecycleException {
  if (!started) {
    return;
  }
  lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT,null);
  lifecycle.fireLifecycleEvent(STOP_EVENT,null);
  if (log.isLoggable(Level.INFO)) {
    log.info(sm.getString("String_Node_Str",this.name));
  }
  started=false;
synchronized (connectors) {
    for (int i=0; i < connectors.length; i++) {
      if (connectors[i] instanceof Lifecycle)       ((Lifecycle)connectors[i]).stop();
    }
  }
  if (container != null) {
synchronized (container) {
      if (container instanceof Lifecycle) {
        ((Lifecycle)container).stop();
      }
    }
  }
  lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT,null);
}

Fixed version (ground truth):
/** 
 * Gracefully terminate the active use of the public methods of this component.  This method should be the last one called on a given instance of this component.  It should also send a LifecycleEvent of type STOP_EVENT to any registered listeners.
 * @exception LifecycleException if this component detects a fatal errorthat needs to be reported
 */
public void stop() throws LifecycleException {
  if (!started) {
    return;
  }
  lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT,null);
  lifecycle.fireLifecycleEvent(STOP_EVENT,null);
  if (log.isLoggable(Level.INFO)) {
    log.info(sm.getString("String_Node_Str",this.name));
  }
  started=false;
synchronized (connectorsMonitor) {
    for (int i=0; i < connectors.length; i++) {
      if (connectors[i] instanceof Lifecycle)       ((Lifecycle)connectors[i]).stop();
    }
  }
  if (container != null) {
synchronized (container) {
      if (container instanceof Lifecycle) {
        ((Lifecycle)container).stop();
      }
    }
  }
  lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT,null);
}
Program: 29951
Project: 29951
Buggy source:
/** 
 * Invoke a pre-startup initialization. This is used to allow connectors to bind to restricted ports under Unix operating environments.
 */
public void initialize() throws LifecycleException {
  if (initialized) {
    if (log.isLoggable(Level.INFO)) {
      log.info(sm.getString("String_Node_Str"));
    }
    return;
  }
  initialized=true;
  if (oname == null) {
    try {
      Container engine=this.getContainer();
      domain=engine.getName();
      oname=new ObjectName(domain + "String_Node_Str" + name);
      this.controller=oname;
      Registry.getRegistry(null,null).registerComponent(this,oname,null);
    }
 catch (    Exception e) {
      log.log(Level.SEVERE,sm.getString("String_Node_Str",domain),e);
    }
  }
  if (server == null) {
    ServerFactory.getServer().addService(this);
  }
synchronized (connectors) {
    for (int i=0; i < connectors.length; i++) {
      connectors[i].initialize();
    }
  }
}

Fixed version (ground truth):
/** 
 * Invoke a pre-startup initialization. This is used to allow connectors to bind to restricted ports under Unix operating environments.
 */
public void initialize() throws LifecycleException {
  if (initialized) {
    if (log.isLoggable(Level.INFO)) {
      log.info(sm.getString("String_Node_Str"));
    }
    return;
  }
  initialized=true;
  if (oname == null) {
    try {
      Container engine=this.getContainer();
      domain=engine.getName();
      oname=new ObjectName(domain + "String_Node_Str" + name);
      this.controller=oname;
      Registry.getRegistry(null,null).registerComponent(this,oname,null);
    }
 catch (    Exception e) {
      log.log(Level.SEVERE,sm.getString("String_Node_Str",domain),e);
    }
  }
  if (server == null) {
    ServerFactory.getServer().addService(this);
  }
synchronized (connectorsMonitor) {
    for (int i=0; i < connectors.length; i++) {
      connectors[i].initialize();
    }
  }
}
Program: 29952
Project: 29952
Buggy source:
/** 
 * Set the <code>Container</code> that handles requests for all <code>Connectors</code> associated with this Service.
 * @param container The new Container
 */
public void setContainer(Container container){
  Container oldContainer=this.container;
  if ((oldContainer != null) && (oldContainer instanceof Engine))   ((Engine)oldContainer).setService(null);
  this.container=container;
  if ((this.container != null) && (this.container instanceof Engine))   ((Engine)this.container).setService(this);
  if (started && (this.container != null) && (this.container instanceof Lifecycle)) {
    try {
      ((Lifecycle)this.container).start();
    }
 catch (    LifecycleException e) {
    }
  }
synchronized (connectors) {
    for (int i=0; i < connectors.length; i++)     connectors[i].setContainer(this.container);
  }
  if (started && (oldContainer != null) && (oldContainer instanceof Lifecycle)) {
    try {
      ((Lifecycle)oldContainer).stop();
    }
 catch (    LifecycleException e) {
    }
  }
  support.firePropertyChange("String_Node_Str",oldContainer,this.container);
}

Fixed version (ground truth):
/** 
 * Set the <code>Container</code> that handles requests for all <code>Connectors</code> associated with this Service.
 * @param container The new Container
 */
public void setContainer(Container container){
  Container oldContainer=this.container;
  if ((oldContainer != null) && (oldContainer instanceof Engine))   ((Engine)oldContainer).setService(null);
  this.container=container;
  if ((this.container != null) && (this.container instanceof Engine))   ((Engine)this.container).setService(this);
  if (started && (this.container != null) && (this.container instanceof Lifecycle)) {
    try {
      ((Lifecycle)this.container).start();
    }
 catch (    LifecycleException e) {
    }
  }
synchronized (connectorsMonitor) {
    for (int i=0; i < connectors.length; i++)     connectors[i].setContainer(this.container);
  }
  if (started && (oldContainer != null) && (oldContainer instanceof Lifecycle)) {
    try {
      ((Lifecycle)oldContainer).stop();
    }
 catch (    LifecycleException e) {
    }
  }
  support.firePropertyChange("String_Node_Str",oldContainer,this.container);
}
Program: 29953
Project: 29953
Buggy source:
/** 
 * Remove the specified Connector from the set associated from this Service.  The removed Connector will also be disassociated from our Container.
 * @param connector The Connector to be removed
 */
public void removeConnector(Connector connector) throws LifecycleException {
synchronized (connectors) {
    int j=-1;
    for (int i=0; i < connectors.length; i++) {
      if (connector == connectors[i]) {
        j=i;
        break;
      }
    }
    if (j < 0)     return;
    ((Lifecycle)connectors[j]).stop();
    int k=0;
    Connector results[]=new Connector[connectors.length - 1];
    for (int i=0; i < connectors.length; i++) {
      if (i != j)       results[k++]=connectors[i];
    }
    connectors=results;
    support.firePropertyChange("String_Node_Str",connector,null);
  }
}

Fixed version (ground truth):
/** 
 * Remove the specified Connector from the set associated from this Service.  The removed Connector will also be disassociated from our Container.
 * @param connector The Connector to be removed
 */
public void removeConnector(Connector connector) throws LifecycleException {
synchronized (connectorsMonitor) {
    int j=-1;
    for (int i=0; i < connectors.length; i++) {
      if (connector == connectors[i]) {
        j=i;
        break;
      }
    }
    if (j < 0)     return;
    ((Lifecycle)connectors[j]).stop();
    int k=0;
    Connector results[]=new Connector[connectors.length - 1];
    for (int i=0; i < connectors.length; i++) {
      if (i != j)       results[k++]=connectors[i];
    }
    connectors=results;
    support.firePropertyChange("String_Node_Str",connector,null);
  }
}
Program: 29954
Project: 29954
Buggy source:
/** 
 * Add a new parameter to the set of parameters for this constructor.
 * @param parameter The new parameter descriptor
 */
public void addParameter(ParameterInfo parameter){
synchronized (parameters) {
    ParameterInfo results[]=new ParameterInfo[parameters.length + 1];
    System.arraycopy(parameters,0,results,0,parameters.length);
    results[parameters.length]=parameter;
    parameters=results;
    this.info=null;
  }
}

Fixed version (ground truth):
/** 
 * Add a new parameter to the set of parameters for this constructor.
 * @param parameter The new parameter descriptor
 */
public void addParameter(ParameterInfo parameter){
synchronized (parametersMonitor) {
    ParameterInfo results[]=new ParameterInfo[parameters.length + 1];
    System.arraycopy(parameters,0,results,0,parameters.length);
    results[parameters.length]=parameter;
    parameters=results;
    this.info=null;
  }
}
Program: 29955
Project: 29955
Buggy source:
/** 
 * Add a new constructor to the set of constructors for this MBean.
 * @param constructor The new constructor descriptor
 */
public void addConstructor(ConstructorInfo constructor){
synchronized (constructors) {
    ConstructorInfo results[]=new ConstructorInfo[constructors.length + 1];
    System.arraycopy(constructors,0,results,0,constructors.length);
    results[constructors.length]=constructor;
    constructors=results;
    this.info=null;
  }
}

Fixed version (ground truth):
/** 
 * Add a new constructor to the set of constructors for this MBean.
 * @param constructor The new constructor descriptor
 */
public void addConstructor(ConstructorInfo constructor){
synchronized (constructors) {
    constructors.add(constructor);
    this.info=null;
  }
}
Program: 29956
Project: 29956
Buggy source:
/** 
 * The collection of notifications for this MBean.
 */
public NotificationInfo[] getNotifications(){
  return (this.notifications);
}

Fixed version (ground truth):
/** 
 * The collection of notifications for this MBean.
 */
public NotificationInfo[] getNotifications(){
  return (this.notifications.toArray(new NotificationInfo[this.notifications.size()]));
}
Program: 29957
Project: 29957
Buggy source:
/** 
 * The collection of constructors for this MBean.
 */
public ConstructorInfo[] getConstructors(){
  return (this.constructors);
}

Fixed version (ground truth):
/** 
 * The collection of constructors for this MBean.
 */
public ConstructorInfo[] getConstructors(){
  return (this.constructors.toArray(new ConstructorInfo[this.constructors.size()]));
}
Program: 29958
Project: 29958
Buggy source:
/** 
 * Add a new notification to the set of notifications for this MBean.
 * @param notification The new notification descriptor
 */
public void addNotification(NotificationInfo notification){
synchronized (notifications) {
    NotificationInfo results[]=new NotificationInfo[notifications.length + 1];
    System.arraycopy(notifications,0,results,0,notifications.length);
    results[notifications.length]=notification;
    notifications=results;
    this.info=null;
  }
}

Fixed version (ground truth):
/** 
 * Add a new notification to the set of notifications for this MBean.
 * @param notification The new notification descriptor
 */
public void addNotification(NotificationInfo notification){
synchronized (notifications) {
    notifications.add(notification);
    this.info=null;
  }
}
Program: 29959
Project: 29959
Buggy source:
/** 
 * The collection of operations for this MBean.
 */
public OperationInfo[] getOperations(){
  return (this.operations);
}

Fixed version (ground truth):
/** 
 * The collection of operations for this MBean.
 */
public OperationInfo[] getOperations(){
  return (this.operations.toArray(new OperationInfo[this.operations.size()]));
}
Program: 29960
Project: 29960
Buggy source:
/** 
 * The collection of attributes for this MBean.
 */
public AttributeInfo[] getAttributes(){
  return (this.attributes);
}

Fixed version (ground truth):
/** 
 * The collection of attributes for this MBean.
 */
public AttributeInfo[] getAttributes(){
  return (this.attributes.toArray(new AttributeInfo[this.attributes.size()]));
}
Program: 29961
Project: 29961
Buggy source:
/** 
 * Add a new operation to the set of operations for this MBean.
 * @param operation The new operation descriptor
 */
public void addOperation(OperationInfo operation){
synchronized (operations) {
    OperationInfo results[]=new OperationInfo[operations.length + 1];
    System.arraycopy(operations,0,results,0,operations.length);
    results[operations.length]=operation;
    operations=results;
    this.info=null;
  }
}

Fixed version (ground truth):
/** 
 * Add a new operation to the set of operations for this MBean.
 * @param operation The new operation descriptor
 */
public void addOperation(OperationInfo operation){
synchronized (operations) {
    operations.add(operation);
    this.info=null;
  }
}
Program: 29962
Project: 29962
Buggy source:
/** 
 * Add a new attribute to the set of attributes for this MBean.
 * @param attribute The new attribute descriptor
 */
public void addAttribute(AttributeInfo attribute){
synchronized (attributes) {
    AttributeInfo results[]=new AttributeInfo[attributes.length + 1];
    System.arraycopy(attributes,0,results,0,attributes.length);
    results[attributes.length]=attribute;
    attributes=results;
    this.info=null;
  }
}

Fixed version (ground truth):
/** 
 * Add a new attribute to the set of attributes for this MBean.
 * @param attribute The new attribute descriptor
 */
public void addAttribute(AttributeInfo attribute){
synchronized (attributes) {
    attributes.add(attribute);
    this.info=null;
  }
}
Program: 29963
Project: 29963
Buggy source:
/** 
 * Add a new notification type to the set managed by an MBean.
 * @param notifType The new notification type
 */
public void addNotifType(String notifType){
synchronized (notifTypes) {
    String results[]=new String[notifTypes.length + 1];
    System.arraycopy(notifTypes,0,results,0,notifTypes.length);
    results[notifTypes.length]=notifType;
    notifTypes=results;
    this.info=null;
  }
}

Fixed version (ground truth):
/** 
 * Add a new notification type to the set managed by an MBean.
 * @param notifType The new notification type
 */
public void addNotifType(String notifType){
synchronized (notifTypesMonitor) {
    String results[]=new String[notifTypes.length + 1];
    System.arraycopy(notifTypes,0,results,0,notifTypes.length);
    results[notifTypes.length]=notifType;
    notifTypes=results;
    this.info=null;
  }
}
Program: 29964
Project: 29964
Buggy source:
/** 
 * Add a new parameter to the set of arguments for this operation.
 * @param parameter The new parameter descriptor
 */
public void addParameter(ParameterInfo parameter){
synchronized (parameters) {
    ParameterInfo results[]=new ParameterInfo[parameters.length + 1];
    System.arraycopy(parameters,0,results,0,parameters.length);
    results[parameters.length]=parameter;
    parameters=results;
    this.info=null;
  }
}

Fixed version (ground truth):
/** 
 * Add a new parameter to the set of arguments for this operation.
 * @param parameter The new parameter descriptor
 */
public void addParameter(ParameterInfo parameter){
synchronized (parametersMonitor) {
    ParameterInfo results[]=new ParameterInfo[parameters.length + 1];
    System.arraycopy(parameters,0,results,0,parameters.length);
    results[parameters.length]=parameter;
    parameters=results;
    this.info=null;
  }
}
Program: 29967
Project: 29967
Buggy source:
/** 
 * <p> This method returns the <code>id</code> for the given tree node model object.</p>
 */
public String getId(Object nodeObject){
  if (nodeObject == null) {
    return "String_Node_Str";
  }
  if (nodeObject == TOP_ID) {
    return getLayoutComponent().getId(FacesContext.getCurrentInstance(),getParentUIComponent());
  }
  return GuiUtil.genId(nodeObject.toString());
}

Fixed version (ground truth):
/** 
 * <p> This method returns the <code>id</code> for the given tree node model object.</p>
 */
public String getId(Object nodeObject){
  if (nodeObject == null) {
    return "String_Node_Str";
  }
  if ((nodeObject instanceof Integer) && nodeObject == TOP_ID) {
    return getLayoutComponent().getId(FacesContext.getCurrentInstance(),getParentUIComponent());
  }
  return GuiUtil.genId(nodeObject.toString());
}
Program: 29968
Project: 29968
Buggy source:
/** 
 * <p> Returns child <code>TreeNode</code>s for the given <code>TreeNode</code> model Object.</p>
 */
public List getChildTreeNodeObjects(Object nodeObject){
  if (nodeObject == null) {
    return null;
  }
  if (nodeObject == TOP_ID) {
    if (_children != null) {
      return _children;
    }
    FacesContext ctx=FacesContext.getCurrentInstance();
    LayoutComponent desc=getLayoutComponent();
    Object val=desc.getOption("String_Node_Str");
    if (val == null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    val=desc.resolveValue(ctx,getParentUIComponent(),val.toString());
    if ((val != null) && (val instanceof Map)) {
      _childMap=(Map<String,Object>)val;
      val=new ArrayList<Object>(_childMap.keySet());
      Collections.sort((List)val);
    }
    _children=(List<Object>)val;
    Object retVal=getLayoutComponent().dispatchHandlers(ctx,FilterTreeEvent.EVENT_TYPE,new FilterTreeEvent(getParentUIComponent(),_children));
    if ((retVal != null) && (retVal instanceof List)) {
      _children=(List<Object>)retVal;
    }
  }
 else {
    return null;
  }
  return _children;
}

Fixed version (ground truth):
/** 
 * <p> Returns child <code>TreeNode</code>s for the given <code>TreeNode</code> model Object.</p>
 */
public List getChildTreeNodeObjects(Object nodeObject){
  if (nodeObject == null) {
    return null;
  }
  if ((nodeObject instanceof Integer) && nodeObject == TOP_ID) {
    if (_children != null) {
      return _children;
    }
    FacesContext ctx=FacesContext.getCurrentInstance();
    LayoutComponent desc=getLayoutComponent();
    Object val=desc.getOption("String_Node_Str");
    if (val == null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    val=desc.resolveValue(ctx,getParentUIComponent(),val.toString());
    if ((val != null) && (val instanceof Map)) {
      _childMap=(Map<String,Object>)val;
      val=new ArrayList<Object>(_childMap.keySet());
      Collections.sort((List)val);
    }
    _children=(List<Object>)val;
    Object retVal=getLayoutComponent().dispatchHandlers(ctx,FilterTreeEvent.EVENT_TYPE,new FilterTreeEvent(getParentUIComponent(),_children));
    if ((retVal != null) && (retVal instanceof List)) {
      _children=(List<Object>)retVal;
    }
  }
 else {
    return null;
  }
  return _children;
}
Program: 29971
Project: 29971
Buggy source:
/** 
 * <p> This method returns the <code>id</code> for the given tree node model object.</p>
 */
public String getId(Object nodeObject){
  if (nodeObject == null) {
    return "String_Node_Str";
  }
  if ((nodeObject instanceof Integer) && nodeObject == TOP_ID) {
    return getLayoutComponent().getId(FacesContext.getCurrentInstance(),getParentUIComponent());
  }
  return GuiUtil.genId(nodeObject.toString());
}

Fixed version (ground truth):
/** 
 * <p> This method returns the <code>id</code> for the given tree node model object.</p>
 */
public String getId(Object nodeObject){
  if (nodeObject == null) {
    return "String_Node_Str";
  }
  if ((nodeObject instanceof Integer) && nodeObject.equals(TOP_ID)) {
    return getLayoutComponent().getId(FacesContext.getCurrentInstance(),getParentUIComponent());
  }
  return GuiUtil.genId(nodeObject.toString());
}
Program: 29972
Project: 29972
Buggy source:
/** 
 * <p> Returns child <code>TreeNode</code>s for the given <code>TreeNode</code> model Object.</p>
 */
public List getChildTreeNodeObjects(Object nodeObject){
  if (nodeObject == null) {
    return null;
  }
  if ((nodeObject instanceof Integer) && nodeObject == TOP_ID) {
    if (_children != null) {
      return _children;
    }
    FacesContext ctx=FacesContext.getCurrentInstance();
    LayoutComponent desc=getLayoutComponent();
    Object val=desc.getOption("String_Node_Str");
    if (val == null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    val=desc.resolveValue(ctx,getParentUIComponent(),val.toString());
    if ((val != null) && (val instanceof Map)) {
      _childMap=(Map<String,Object>)val;
      val=new ArrayList<Object>(_childMap.keySet());
      Collections.sort((List)val);
    }
    _children=(List<Object>)val;
    Object retVal=getLayoutComponent().dispatchHandlers(ctx,FilterTreeEvent.EVENT_TYPE,new FilterTreeEvent(getParentUIComponent(),_children));
    if ((retVal != null) && (retVal instanceof List)) {
      _children=(List<Object>)retVal;
    }
  }
 else {
    return null;
  }
  return _children;
}

Fixed version (ground truth):
/** 
 * <p> Returns child <code>TreeNode</code>s for the given <code>TreeNode</code> model Object.</p>
 */
public List getChildTreeNodeObjects(Object nodeObject){
  if (nodeObject == null) {
    return null;
  }
  if ((nodeObject instanceof Integer) && nodeObject.equals(TOP_ID)) {
    if (_children != null) {
      return _children;
    }
    FacesContext ctx=FacesContext.getCurrentInstance();
    LayoutComponent desc=getLayoutComponent();
    Object val=desc.getOption("String_Node_Str");
    if (val == null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    val=desc.resolveValue(ctx,getParentUIComponent(),val.toString());
    if ((val != null) && (val instanceof Map)) {
      _childMap=(Map<String,Object>)val;
      val=new ArrayList<Object>(_childMap.keySet());
      Collections.sort((List)val);
    }
    _children=(List<Object>)val;
    Object retVal=getLayoutComponent().dispatchHandlers(ctx,FilterTreeEvent.EVENT_TYPE,new FilterTreeEvent(getParentUIComponent(),_children));
    if ((retVal != null) && (retVal instanceof List)) {
      _children=(List<Object>)retVal;
    }
  }
 else {
    return null;
  }
  return _children;
}
Program: 29973
Project: 29973
Buggy source:
public RestResponse execute(Method method,String endPoint,Map<String,Object> payload,boolean needsMultiPart){
  final WebResource request=client.resource(getRestUrl() + endPoint);
  ClientResponse clientResponse;
switch (method) {
case POST:
{
      if (needsMultiPart) {
        clientResponse=request.accept(RESPONSE_TYPE).type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class,buildFormDataMultipart(payload));
      }
 else {
        clientResponse=request.accept(RESPONSE_TYPE).post(ClientResponse.class,buildMultivalueMap(payload));
      }
      break;
    }
case PUT:
{
    if (needsMultiPart) {
      clientResponse=request.accept(RESPONSE_TYPE).type(MediaType.MULTIPART_FORM_DATA_TYPE).put(ClientResponse.class,buildFormDataMultipart(payload));
    }
 else {
      clientResponse=request.accept(RESPONSE_TYPE).put(ClientResponse.class,buildMultivalueMap(payload));
    }
    break;
  }
case DELETE:
{
  addQueryParams(payload,request);
  clientResponse=request.queryParams(buildMultivalueMap(payload)).accept(RESPONSE_TYPE).delete(ClientResponse.class);
  break;
}
default :
{
addQueryParams(payload,request);
clientResponse=request.queryParams(buildMultivalueMap(payload)).accept(RESPONSE_TYPE).get(ClientResponse.class);
}
}
return new RestResponse(clientResponse);
}

Fixed version (ground truth):
public RestResponse execute(Method method,String endPoint,Map<String,Object> payload,boolean needsMultiPart){
  final WebResource request=client.resource(getRestUrl() + endPoint);
  ClientResponse clientResponse;
switch (method) {
case POST:
{
      if (needsMultiPart) {
        clientResponse=request.accept(RESPONSE_TYPE).type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class,buildFormDataMultipart(payload));
      }
 else {
        clientResponse=request.accept(RESPONSE_TYPE).post(ClientResponse.class,buildMultivalueMap(payload));
      }
      break;
    }
case PUT:
{
    if (needsMultiPart) {
      clientResponse=request.accept(RESPONSE_TYPE).type(MediaType.MULTIPART_FORM_DATA_TYPE).put(ClientResponse.class,buildFormDataMultipart(payload));
    }
 else {
      clientResponse=request.accept(RESPONSE_TYPE).put(ClientResponse.class,buildMultivalueMap(payload));
    }
    break;
  }
case DELETE:
{
  clientResponse=request.queryParams(buildMultivalueMap(payload)).accept(RESPONSE_TYPE).delete(ClientResponse.class);
  break;
}
default :
{
clientResponse=request.queryParams(buildMultivalueMap(payload)).accept(RESPONSE_TYPE).get(ClientResponse.class);
}
}
return new RestResponse(clientResponse);
}
Program: 29974
Project: 29974
Buggy source:
/** 
 * Constructs a method name from  element's bean name for a given prefix.(schema2beans convention)
 * @param elementName the given element name
 * @param prefix the given prefix
 * @return a method name formed from the given name and the prefix
 */
public static String methodNameFromBeanName(String elementName,String prefix){
  if ((null == elementName) || (null == prefix) || (prefix.length() <= 0)) {
    return elementName;
  }
  String methodName=upperCaseFirstLetter(elementName);
  return methodName=prefix + methodName;
}

Fixed version (ground truth):
/** 
 * Constructs a method name from  element's bean name for a given prefix.(schema2beans convention)
 * @param elementName the given element name
 * @param prefix the given prefix
 * @return a method name formed from the given name and the prefix
 */
public static String methodNameFromBeanName(String elementName,String prefix){
  if ((null == elementName) || (null == prefix) || (prefix.length() <= 0)) {
    return elementName;
  }
  return prefix + upperCaseFirstLetter(elementName);
}
Program: 29975
Project: 29975
Buggy source:
public static void logTimingMessage(String msg){
  logger.log(Level.INFO,"String_Node_Str",new Object[]{sdf.format(new Date()),msg});
}

Fixed version (ground truth):
public static void logTimingMessage(String msg){
  SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  logger.log(Level.INFO,"String_Node_Str",new Object[]{sdf.format(new Date()),msg});
}
Program: 29976
Project: 29976
Buggy source:
public static Client getJerseyClient(){
  if (client == null) {
    client=Client.create();
  }
  return client;
}

Fixed version (ground truth):
public static synchronized Client getJerseyClient(){
  if (client == null) {
    client=Client.create();
  }
  return client;
}