nus-yam/ex-repair huggingface dataset:
Program: 29854
Project: 29854
Buggy source:
/** 
 * Gets the names of the methods supported by the underlying servlet. This is the same set of methods included in the Allow response header in response to an OPTIONS request method processed by the underlying servlet.
 * @return Array of names of the methods supported by the underlyingservlet
 */
public String[] getServletMethods() throws ServletException {
  loadServletClass();
  if (!javax.servlet.http.HttpServlet.class.isAssignableFrom(servletClass)) {
    return DEFAULT_SERVLET_METHODS;
  }
  HashSet<String> allow=new HashSet<String>();
  allow.add("String_Node_Str");
  allow.add("String_Node_Str");
  Method[] methods=getAllDeclaredMethods(servletClass);
  for (int i=0; methods != null && i < methods.length; i++) {
    Method m=methods[i];
    if (m.getName().equals("String_Node_Str")) {
      allow.add("String_Node_Str");
      allow.add("String_Node_Str");
    }
 else     if (m.getName().equals("String_Node_Str")) {
      allow.add("String_Node_Str");
    }
 else     if (m.getName().equals("String_Node_Str")) {
      allow.add("String_Node_Str");
    }
 else     if (m.getName().equals("String_Node_Str")) {
      allow.add("String_Node_Str");
    }
  }
  String[] methodNames=new String[allow.size()];
  return allow.toArray(methodNames);
}

Fixed version (ground truth):
/** 
 * Gets the names of the methods supported by the underlying servlet. This is the same set of methods included in the Allow response header in response to an OPTIONS request method processed by the underlying servlet.
 * @return Array of names of the methods supported by the underlyingservlet
 */
public String[] getServletMethods() throws ServletException {
  loadServletClass();
  if (!javax.servlet.http.HttpServlet.class.isAssignableFrom(servletClass)) {
    return DEFAULT_SERVLET_METHODS;
  }
  HashSet<String> allow=new HashSet<String>();
  allow.add("String_Node_Str");
  allow.add("String_Node_Str");
  Method[] methods=getAllDeclaredMethods(servletClass);
  for (int i=0; methods != null && i < methods.length; i++) {
    Method m=methods[i];
    Class<?> params[]=m.getParameterTypes();
    if (!(params.length == 2 && params[0] == HttpServletRequest.class && params[1] == HttpServletResponse.class)) {
      continue;
    }
    if (m.getName().equals("String_Node_Str")) {
      allow.add("String_Node_Str");
      allow.add("String_Node_Str");
    }
 else     if (m.getName().equals("String_Node_Str")) {
      allow.add("String_Node_Str");
    }
 else     if (m.getName().equals("String_Node_Str")) {
      allow.add("String_Node_Str");
    }
 else     if (m.getName().equals("String_Node_Str")) {
      allow.add("String_Node_Str");
    }
  }
  String[] methodNames=new String[allow.size()];
  return allow.toArray(methodNames);
}
Program: 29857
Project: 29857
Buggy source:
/** 
 * @param mimeType The mimeType to set.
 */
public void setMimeType(String mimeType){
  this.mimeType=mimeType;
}

Fixed version (ground truth):
/** 
 * @param mimeType The mimeType to set.
 */
public void setMimeType(String mimeType){
  this.mimeTypeInitialized=true;
  this.mimeType=mimeType;
}
Program: 29858
Project: 29858
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumPotentialConnLeakCount(){
  return numPotentialConnLeak.getStatistic();
}

Fixed version (ground truth):
/** 
 * When a connection leak is observed, the monitoring statistics are displayed to the server.log. This method helps in segregating the statistics based on LOW/HIGH monitoring levels and displaying them.
 * @param poolName
 * @param stackTrace
 */
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumPotentialConnLeakCount(){
  return numPotentialConnLeak.getStatistic();
}
Program: 29860
Project: 29860
Buggy source:
public void setNetworkTimeout(Executor executorObj,int milliseconds) throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    checkValidity();
    Class<?>[] valueTypes=new Class<?>[]{Executor.class,Integer.TYPE};
    try {
      executor.invokeMethod(con,"String_Node_Str",valueTypes,executorObj,milliseconds);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public void setNetworkTimeout(Executor executorObj,int milliseconds) throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    checkValidity();
    Class<?>[] valueTypes=new Class<?>[]{Executor.class,Integer.TYPE};
    try {
      getMethodExecutor().invokeMethod(con,"String_Node_Str",valueTypes,executorObj,milliseconds);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 29861
Project: 29861
Buggy source:
public void setSchema(String schema) throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    checkValidity();
    Class<?>[] valueTypes=new Class<?>[]{String.class};
    try {
      executor.invokeMethod(con,"String_Node_Str",valueTypes,schema);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public void setSchema(String schema) throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    checkValidity();
    Class<?>[] valueTypes=new Class<?>[]{String.class};
    try {
      getMethodExecutor().invokeMethod(con,"String_Node_Str",valueTypes,schema);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 29862
Project: 29862
Buggy source:
public String getSchema() throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    checkValidity();
    try {
      return (String)executor.invokeMethod(con,"String_Node_Str",null);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public String getSchema() throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    checkValidity();
    try {
      return (String)getMethodExecutor().invokeMethod(con,"String_Node_Str",null);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 29863
Project: 29863
Buggy source:
public int getNetworkTimeout() throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    checkValidity();
    try {
      return (Integer)executor.invokeMethod(con,"String_Node_Str",null);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public int getNetworkTimeout() throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    checkValidity();
    try {
      return (Integer)getMethodExecutor().invokeMethod(con,"String_Node_Str",null);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 29864
Project: 29864
Buggy source:
public ResultSet getPseudoColumns(String catalog,String schemaPattern,String tableNamePattern,String columnNamePattern) throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    Class<?>[] valueTypes=new Class<?>[]{String.class,String.class,String.class,String.class};
    try {
      return (ResultSet)executor.invokeMethod(databaseMetaData,"String_Node_Str",valueTypes,catalog,schemaPattern,tableNamePattern,columnNamePattern);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public ResultSet getPseudoColumns(String catalog,String schemaPattern,String tableNamePattern,String columnNamePattern) throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    Class<?>[] valueTypes=new Class<?>[]{String.class,String.class,String.class,String.class};
    try {
      return (ResultSet)getMethodExecutor().invokeMethod(databaseMetaData,"String_Node_Str",valueTypes,catalog,schemaPattern,tableNamePattern,columnNamePattern);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 29865
Project: 29865
Buggy source:
public boolean generatedKeyAlwaysReturned() throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    try {
      return (Boolean)executor.invokeMethod(databaseMetaData,"String_Node_Str",null);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public boolean generatedKeyAlwaysReturned() throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    try {
      return (Boolean)getMethodExecutor().invokeMethod(databaseMetaData,"String_Node_Str",null);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 29866
Project: 29866
Buggy source:
public <T>T getObject(String columnLabel,Class<T> type) throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    Class<?>[] valueTypes=new Class<?>[]{String.class,Class.class};
    try {
      return (T)executor.invokeMethod(resultSet,"String_Node_Str",valueTypes,columnLabel,type);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public <T>T getObject(String columnLabel,Class<T> type) throws SQLException {
  if (DataSourceObjectBuilder.isJDBC41()) {
    Class<?>[] valueTypes=new Class<?>[]{String.class,Class.class};
    try {
      return (T)getMethodExecutor().invokeMethod(resultSet,"String_Node_Str",valueTypes,columnLabel,type);
    }
 catch (    ResourceException ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      throw new SQLException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 29867
Project: 29867
Buggy source:
private List<String> getGroups(String userDN){
  DirContext ctx=null;
  String srcFilter=null;
  try {
    ctx=new InitialDirContext(getLdapBindProps());
    X500Name name=new X500Name(userDN);
    String _username=name.getCommonName();
    if (_username == null && userDN != null && userDN.startsWith("String_Node_Str")) {
      int first=userDN.indexOf("String_Node_Str");
      int last=userDN.indexOf("String_Node_Str");
      if (first != -1 && last != -1) {
        _username=userDN.substring(first + 4,last);
      }
    }
    StringBuffer sb=new StringBuffer(getProperty(PARAM_GRP_SEARCH_FILTER));
    substitute(sb,SUBST_SUBJECT_NAME,_username);
    substitute(sb,SUBST_SUBJECT_DN,userDN);
    srcFilter=sb.toString();
    List<String> groupsList=new ArrayList<String>();
    groupsList.addAll(groupSearch(ctx,getProperty(PARAM_GRPDN),srcFilter,getProperty(PARAM_GRP_TARGET)));
    groupsList.addAll(dynamicGroupSearch(ctx,getProperty(PARAM_GRPDN),getProperty(PARAM_GRP_TARGET),userDN));
    return groupsList;
  }
 catch (  Exception e) {
    _logger.log(Level.WARNING,"String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
private List<String> getGroups(String userDN){
  DirContext ctx=null;
  String srcFilter=null;
  try {
    ctx=new InitialDirContext(getLdapBindProps());
    X500Name name=new X500Name(userDN);
    String _username=name.getCommonName();
    if (_username == null && userDN != null && userDN.startsWith("String_Node_Str")) {
      int first=userDN.indexOf("String_Node_Str");
      int last=userDN.indexOf("String_Node_Str");
      if (first != -1 && last != -1) {
        _username=userDN.substring(first + 4,last);
      }
    }
    StringBuffer sb=new StringBuffer(getProperty(PARAM_GRP_SEARCH_FILTER));
    substitute(sb,SUBST_SUBJECT_NAME,_username);
    substitute(sb,SUBST_SUBJECT_DN,userDN);
    srcFilter=sb.toString();
    List<String> groupsList=new ArrayList<String>();
    groupsList.addAll(groupSearch(ctx,getProperty(PARAM_GRPDN),srcFilter,getProperty(PARAM_GRP_TARGET)));
    groupsList.addAll(dynamicGroupSearch(ctx,getProperty(PARAM_GRPDN),getProperty(PARAM_GRP_TARGET),userDN));
    return groupsList;
  }
 catch (  Exception e) {
    _logger.log(Level.WARNING,"String_Node_Str",e);
  }
 finally {
    if (ctx != null) {
      try {
        ctx.close();
      }
 catch (      NamingException e) {
        _logger.log(Level.WARNING,"String_Node_Str",e);
      }
    }
  }
  return null;
}
Program: 29868
Project: 29868
Buggy source:
void notifyAsyncListeners(AsyncEventType asyncEventType,Throwable t){
synchronized (asyncListenerContexts) {
    if (asyncListenerContexts.isEmpty()) {
      return;
    }
    LinkedList<AsyncListenerContext> clone=new LinkedList<AsyncListenerContext>(asyncListenerContexts);
    if (asyncEventType.equals(AsyncEventType.START_ASYNC)) {
      asyncListenerContexts.clear();
    }
    for (    AsyncListenerContext asyncListenerContext : clone) {
      AsyncListener asyncListener=asyncListenerContext.getAsyncListener();
      AsyncEvent asyncEvent=new AsyncEvent(this,asyncListenerContext.getRequest(),asyncListenerContext.getResponse(),t);
      try {
switch (asyncEventType) {
case COMPLETE:
          asyncListener.onComplete(asyncEvent);
        break;
case TIMEOUT:
      asyncListener.onTimeout(asyncEvent);
    break;
case ERROR:
  asyncListener.onError(asyncEvent);
break;
case START_ASYNC:
asyncListener.onStartAsync(asyncEvent);
break;
default :
break;
}
}
 catch (IOException ioe) {
log.log(Level.WARNING,"String_Node_Str",ioe);
}
}
}
}

Fixed version (ground truth):
void notifyAsyncListeners(AsyncEventType asyncEventType,Throwable t){
  LinkedList<AsyncListenerContext> clone;
synchronized (asyncListenerContexts) {
    if (asyncListenerContexts.isEmpty()) {
      return;
    }
    clone=new LinkedList<AsyncListenerContext>(asyncListenerContexts);
    if (asyncEventType.equals(AsyncEventType.START_ASYNC)) {
      asyncListenerContexts.clear();
    }
  }
  for (  AsyncListenerContext asyncListenerContext : clone) {
    AsyncListener asyncListener=asyncListenerContext.getAsyncListener();
    AsyncEvent asyncEvent=new AsyncEvent(this,asyncListenerContext.getRequest(),asyncListenerContext.getResponse(),t);
    try {
switch (asyncEventType) {
case COMPLETE:
        asyncListener.onComplete(asyncEvent);
      break;
case TIMEOUT:
    asyncListener.onTimeout(asyncEvent);
  break;
case ERROR:
asyncListener.onError(asyncEvent);
break;
case START_ASYNC:
asyncListener.onStartAsync(asyncEvent);
break;
default :
break;
}
}
 catch (IOException ioe) {
log.log(Level.WARNING,STRING_MANAGER.getString("String_Node_Str"),ioe);
}
}
}
Program: 29869
Project: 29869
Buggy source:
/** 
 * Retrieves the work manager.
 * @return <code>WorkManager</code> instance.
 * @see com.sun.enterprise.connectors.work.CommonWorkManager
 * @see com.sun.enterprise.connectors.work.WorkManagerFactory
 */
public WorkManager getWorkManager(){
  initializeWorkManager();
  return wm;
}

Fixed version (ground truth):
/** 
 * Retrieves the work manager.
 * @return <code>WorkManager</code> instance.
 * @see com.sun.enterprise.connectors.work.CommonWorkManager
 * @see com.sun.enterprise.connectors.work.WorkManagerFactoryImpl
 */
public WorkManager getWorkManager(){
  initializeWorkManager();
  return wm;
}
Program: 29870
Project: 29870
Buggy source:
/** 
 * validates the work-contexts provided in the work
 * @param workToBeValidated work instance
 * @param context execution-context (if present)
 * @param contextHandler work-context-handler
 * @throws WorkCompletedException when work processing fails
 * @throws WorkRejectedException when work cannot be processed
 */
private void validateWork(Work workToBeValidated,ExecutionContext context,WorkContextHandler contextHandler) throws WorkCompletedException, WorkRejectedException {
  contextHandler.validateWork(workToBeValidated,context);
}

Fixed version (ground truth):
/** 
 * validates the work-contexts provided in the work
 * @param workToBeValidated work instance
 * @param context execution-context (if present)
 * @param contextHandler work-context-handler
 * @throws WorkCompletedException when work processing fails
 * @throws WorkRejectedException when work cannot be processed
 */
private void validateWork(Work workToBeValidated,ExecutionContext context,WorkContextHandlerImpl contextHandler) throws WorkCompletedException, WorkRejectedException {
  contextHandler.validateWork(workToBeValidated,context);
}
Program: 29871
Project: 29871
Buggy source:
/** 
 * Executes the work instance. The calling thread will wait until the start of work execution.
 * @param work         work instance from resource adapter
 * @param startTimeout Timeout for the work.
 * @param execContext  Execution context in which the work will be executed.
 * @param workListener Listener from RA that will listen to work events.
 * @throws WorkException if there is an exception while executing work.
 */
public long startWork(Work work,long startTimeout,ExecutionContext execContext,WorkListener workListener) throws WorkException {
  WorkContextHandler contextHandler=createWorkContextHandler();
  validateWork(work,WorkCoordinator.getExecutionContext(execContext,work),contextHandler);
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  long acceptanceTime=System.currentTimeMillis();
  WorkCoordinator wc=new WorkCoordinator(work,startTimeout,execContext,tp.getAnyWorkQueue(),workListener,this.probeProvider,runtime,raName,contextHandler);
  wc.submitWork(WorkCoordinator.WAIT_UNTIL_START);
  wc.lock();
  WorkException we=wc.getException();
  if (we != null) {
    throw we;
  }
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  long startTime=System.currentTimeMillis();
  return (startTime - acceptanceTime);
}

Fixed version (ground truth):
/** 
 * Executes the work instance. The calling thread will wait until the start of work execution.
 * @param work         work instance from resource adapter
 * @param startTimeout Timeout for the work.
 * @param execContext  Execution context in which the work will be executed.
 * @param workListener Listener from RA that will listen to work events.
 * @throws WorkException if there is an exception while executing work.
 */
public long startWork(Work work,long startTimeout,ExecutionContext execContext,WorkListener workListener) throws WorkException {
  WorkContextHandlerImpl contextHandler=createWorkContextHandler();
  validateWork(work,WorkCoordinator.getExecutionContext(execContext,work),contextHandler);
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  long acceptanceTime=System.currentTimeMillis();
  WorkCoordinator wc=new WorkCoordinator(work,startTimeout,execContext,tp.getAnyWorkQueue(),workListener,this.probeProvider,runtime,raName,contextHandler);
  wc.submitWork(WorkCoordinator.WAIT_UNTIL_START);
  wc.lock();
  WorkException we=wc.getException();
  if (we != null) {
    throw we;
  }
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  long startTime=System.currentTimeMillis();
  return (startTime - acceptanceTime);
}
Program: 29872
Project: 29872
Buggy source:
/** 
 * Executes the work instance. The calling thread will wait until the end of work execution.
 * @param work         work instance from resource adapter
 * @param startTimeout Timeout for the work.
 * @param execContext  Execution context in which the work will be executed.
 * @param workListener Listener from RA that will listen to work events.
 * @throws WorkException if there is an exception while executing work.
 */
public void doWork(Work work,long startTimeout,ExecutionContext execContext,WorkListener workListener) throws WorkException {
  WorkContextHandler contextHandler=createWorkContextHandler();
  validateWork(work,WorkCoordinator.getExecutionContext(execContext,work),contextHandler);
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  WorkCoordinator wc=new WorkCoordinator(work,startTimeout,execContext,tp.getAnyWorkQueue(),workListener,this.probeProvider,runtime,raName,contextHandler);
  wc.submitWork(WorkCoordinator.WAIT_UNTIL_FINISH);
  wc.lock();
  WorkException we=wc.getException();
  if (we != null) {
    throw we;
  }
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
}

Fixed version (ground truth):
/** 
 * Executes the work instance. The calling thread will wait until the end of work execution.
 * @param work         work instance from resource adapter
 * @param startTimeout Timeout for the work.
 * @param execContext  Execution context in which the work will be executed.
 * @param workListener Listener from RA that will listen to work events.
 * @throws WorkException if there is an exception while executing work.
 */
public void doWork(Work work,long startTimeout,ExecutionContext execContext,WorkListener workListener) throws WorkException {
  WorkContextHandlerImpl contextHandler=createWorkContextHandler();
  validateWork(work,WorkCoordinator.getExecutionContext(execContext,work),contextHandler);
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  WorkCoordinator wc=new WorkCoordinator(work,startTimeout,execContext,tp.getAnyWorkQueue(),workListener,this.probeProvider,runtime,raName,contextHandler);
  wc.submitWork(WorkCoordinator.WAIT_UNTIL_FINISH);
  wc.lock();
  WorkException we=wc.getException();
  if (we != null) {
    throw we;
  }
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
}
Program: 29873
Project: 29873
Buggy source:
/** 
 * prvides work-context-handler to handle the submitted work-contexts
 * @return work-context-handler
 */
private WorkContextHandler createWorkContextHandler(){
  WorkContextHandler contextHandler=new WorkContextHandler(runtime,raName,rarClassLoader);
  return contextHandler;
}

Fixed version (ground truth):
/** 
 * prvides work-context-handler to handle the submitted work-contexts
 * @return work-context-handler
 */
private WorkContextHandlerImpl createWorkContextHandler(){
  WorkContextHandlerImpl contextHandler=new WorkContextHandlerImpl(runtime,raName,rarClassLoader);
  return contextHandler;
}
Program: 29874
Project: 29874
Buggy source:
/** 
 * Executes the work instance. Calling thread will continue after scheduling the work
 * @param work         work instance from resource adapter
 * @param startTimeout Timeout for the work.
 * @param execContext  Execution context in which the work will be executed.
 * @param workListener Listener from RA that will listen to work events.
 * @throws WorkException if there is an exception while executing work.
 */
public void scheduleWork(Work work,long startTimeout,ExecutionContext execContext,WorkListener workListener) throws WorkException {
  WorkContextHandler contextHandler=createWorkContextHandler();
  validateWork(work,WorkCoordinator.getExecutionContext(execContext,work),contextHandler);
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  WorkCoordinator wc=new WorkCoordinator(work,startTimeout,execContext,tp.getAnyWorkQueue(),workListener,this.probeProvider,runtime,raName,contextHandler);
  wc.submitWork(WorkCoordinator.NO_WAIT);
  wc.lock();
  WorkException we=wc.getException();
  if (we != null) {
    throw we;
  }
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  return;
}

Fixed version (ground truth):
/** 
 * Executes the work instance. Calling thread will continue after scheduling the work
 * @param work         work instance from resource adapter
 * @param startTimeout Timeout for the work.
 * @param execContext  Execution context in which the work will be executed.
 * @param workListener Listener from RA that will listen to work events.
 * @throws WorkException if there is an exception while executing work.
 */
public void scheduleWork(Work work,long startTimeout,ExecutionContext execContext,WorkListener workListener) throws WorkException {
  WorkContextHandlerImpl contextHandler=createWorkContextHandler();
  validateWork(work,WorkCoordinator.getExecutionContext(execContext,work),contextHandler);
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  WorkCoordinator wc=new WorkCoordinator(work,startTimeout,execContext,tp.getAnyWorkQueue(),workListener,this.probeProvider,runtime,raName,contextHandler);
  wc.submitWork(WorkCoordinator.NO_WAIT);
  wc.lock();
  WorkException we=wc.getException();
  if (we != null) {
    throw we;
  }
  if (logger.isLoggable(Level.FINEST)) {
    String msg="String_Node_Str" + work.toString() + "String_Node_Str";
    logger.log(Level.FINEST,debugMsg(msg));
  }
  return;
}
Program: 29875
Project: 29875
Buggy source:
/** 
 * Creates a work object that can be submitted to a workqueue.
 * @param work Actual work submitted by Resource adapter.
 * @param coordinator <code>WorkCoordinator</code> object.
 */
OneWork(Work work,WorkCoordinator coordinator,WorkContextHandler contextHandler,ClassLoader tcc){
  this.work=work;
  this.coordinator=coordinator;
  this.contextHandler=contextHandler;
  this.tcc=tcc;
}

Fixed version (ground truth):
/** 
 * Creates a work object that can be submitted to a workqueue.
 * @param work Actual work submitted by Resource adapter.
 * @param coordinator <code>WorkCoordinator</code> object.
 */
OneWork(Work work,WorkCoordinator coordinator,WorkContextHandlerImpl contextHandler,ClassLoader tcc){
  this.work=work;
  this.coordinator=coordinator;
  this.contextHandler=contextHandler;
  this.tcc=tcc;
}
Program: 29876
Project: 29876
Buggy source:
/** 
 * Constructs a coordinator
 * @param work     A work object as submitted by the resource adapter
 * @param timeout  timeout for the work instance
 * @param ec       ExecutionContext object.
 * @param queue    WorkQueue of the threadpool, to which the workwill be submitted
 * @param listener WorkListener object from the resource adapter.
 */
public WorkCoordinator(javax.resource.spi.work.Work work,long timeout,ExecutionContext ec,WorkQueue queue,WorkListener listener,WorkManagementProbeProvider probeProvider,ConnectorRuntime runtime,String raName,WorkContextHandler handler){
  this.work=work;
  this.timeout=timeout;
  this.ec=ec;
  this.queue=queue;
  this.listener=listener;
synchronized (WorkCoordinator.class) {
    this.id=++seed;
  }
  this.runtime=runtime;
  this.lock=new Object();
  this.probeProvider=probeProvider;
  this.raName=raName;
  this.contextHandler=handler;
}

Fixed version (ground truth):
/** 
 * Constructs a coordinator
 * @param work     A work object as submitted by the resource adapter
 * @param timeout  timeout for the work instance
 * @param ec       ExecutionContext object.
 * @param queue    WorkQueue of the threadpool, to which the workwill be submitted
 * @param listener WorkListener object from the resource adapter.
 */
public WorkCoordinator(javax.resource.spi.work.Work work,long timeout,ExecutionContext ec,WorkQueue queue,WorkListener listener,WorkManagementProbeProvider probeProvider,ConnectorRuntime runtime,String raName,WorkContextHandlerImpl handler){
  this.work=work;
  this.timeout=timeout;
  this.ec=ec;
  this.queue=queue;
  this.listener=listener;
synchronized (WorkCoordinator.class) {
    this.id=++seed;
  }
  this.runtime=runtime;
  this.lock=new Object();
  this.probeProvider=probeProvider;
  this.raName=raName;
  this.contextHandler=handler;
}
Program: 29877
Project: 29877
Buggy source:
public static ExecutionContext getExecutionContext(ExecutionContext ec,Work work){
  if (ec == null) {
    return WorkContextHandler.getExecutionContext(work);
  }
  return ec;
}

Fixed version (ground truth):
public static ExecutionContext getExecutionContext(ExecutionContext ec,Work work){
  if (ec == null) {
    return WorkContextHandlerImpl.getExecutionContext(work);
  }
  return ec;
}
Program: 29878
Project: 29878
Buggy source:
/** 
 * @see java.io.Externalizable
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  moduleName=in.readUTF();
  wm=WorkManagerFactory.retrieveWorkManager(moduleName);
  _logger=LogDomains.getLogger(WorkManagerProxy.class,LogDomains.RSR_LOGGER);
}

Fixed version (ground truth):
/** 
 * @see java.io.Externalizable
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  moduleName=in.readUTF();
  wm=WorkManagerFactoryImpl.retrieveWorkManager(moduleName);
  _logger=LogDomains.getLogger(WorkManagerProxy.class,LogDomains.RSR_LOGGER);
}
Program: 29879
Project: 29879
Buggy source:
public void deleteInstanceFilesystem(AdminCommandContext context){
  NodeUtils nodeUtils=new NodeUtils(habitat,logger);
  Server dasServer=servers.getServer(SystemPropertyConstants.DAS_SERVER_NAME);
  ArrayList<String> command=new ArrayList<String>();
  String humanCommand=null;
  command.add("String_Node_Str");
  if (nodedir != null) {
    command.add("String_Node_Str");
    command.add(nodedir);
  }
  command.add("String_Node_Str");
  command.add(noderef);
  command.add(instanceName);
  humanCommand=makeCommandHuman(command);
  String firstErrorMessage=Strings.get("String_Node_Str",instanceName,noderef,theNode.getNodeHost());
  StringBuilder output=new StringBuilder();
  nodeUtils.runAdminCommandOnNode(theNode,command,ctx,firstErrorMessage,humanCommand,output);
  ActionReport report=ctx.getActionReport();
  if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS) {
    return;
  }
  String msg=Strings.get("String_Node_Str",instanceName,theNode.getNodeHost());
  if (!terse) {
    msg=StringUtils.cat(NL,output.toString().trim(),msg);
  }
  report.setMessage(msg);
}

Fixed version (ground truth):
private void deleteInstanceFilesystem(AdminCommandContext ctx){
  NodeUtils nodeUtils=new NodeUtils(habitat,logger);
  ArrayList<String> command=new ArrayList<String>();
  String humanCommand=null;
  command.add("String_Node_Str");
  if (nodedir != null) {
    command.add("String_Node_Str");
    command.add(nodedir);
  }
  command.add("String_Node_Str");
  command.add(noderef);
  command.add(instanceName);
  humanCommand=makeCommandHuman(command);
  String firstErrorMessage=Strings.get("String_Node_Str",instanceName,noderef,theNode.getNodeHost());
  StringBuilder output=new StringBuilder();
  nodeUtils.runAdminCommandOnNode(theNode,command,ctx,firstErrorMessage,humanCommand,output);
  ActionReport report=ctx.getActionReport();
  if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS) {
    return;
  }
  String msg=Strings.get("String_Node_Str",instanceName,theNode.getNodeHost());
  if (!terse) {
    msg=StringUtils.cat(NL,output.toString().trim(),msg);
  }
  report.setMessage(msg);
}
Program: 29881
Project: 29881
Buggy source:
private String pollForLife(){
  int counter=0;
  while (++counter < 240) {
    if (instance.isRunning())     return null;
    try {
      Thread.sleep(500);
    }
 catch (    Exception e) {
    }
  }
  return Strings.get("String_Node_Str",instanceName);
}

Fixed version (ground truth):
private String pollForLife(Server instance){
  int counter=0;
  while (++counter < 240) {
    if (instance.isRunning())     return null;
    try {
      Thread.sleep(500);
    }
 catch (    Exception e) {
    }
  }
  return Strings.get("String_Node_Str",instanceName);
}
Program: 29883
Project: 29883
Buggy source:
private void startInstance(){
  NodeUtils nodeUtils=new NodeUtils(habitat,logger);
  Server dasServer=servers.getServer(SystemPropertyConstants.DAS_SERVER_NAME);
  ArrayList<String> command=new ArrayList<String>();
  String humanCommand=null;
  command.add("String_Node_Str");
  command.add("String_Node_Str");
  command.add(noderef);
  if (nodedir != null) {
    command.add("String_Node_Str");
    command.add(nodedir);
  }
  command.add("String_Node_Str");
  command.add(sync);
  if (debug) {
    command.add("String_Node_Str");
  }
  command.add(instanceName);
  humanCommand=makeCommandHuman(command);
  String firstErrorMessage=Strings.get("String_Node_Str",instanceName,noderef,nodeHost);
  StringBuilder output=new StringBuilder();
  boolean waitForReaderThreads=true;
  if (OS.isWindows()) {
    waitForReaderThreads=false;
  }
  nodeUtils.runAdminCommandOnNode(node,command,ctx,firstErrorMessage,humanCommand,output,waitForReaderThreads);
  ActionReport report=ctx.getActionReport();
  if (report.getActionExitCode() == ActionReport.ExitCode.SUCCESS) {
    String msg=Strings.get("String_Node_Str",instanceName,nodeHost);
    if (!terse) {
      msg=StringUtils.cat(NL,output.toString().trim(),msg);
    }
    report.setMessage(msg);
  }
}

Fixed version (ground truth):
private void startInstance(AdminCommandContext ctx){
  NodeUtils nodeUtils=new NodeUtils(habitat,logger);
  ArrayList<String> command=new ArrayList<String>();
  String humanCommand=null;
  command.add("String_Node_Str");
  command.add("String_Node_Str");
  command.add(noderef);
  if (nodedir != null) {
    command.add("String_Node_Str");
    command.add(nodedir);
  }
  command.add("String_Node_Str");
  command.add(sync);
  if (debug) {
    command.add("String_Node_Str");
  }
  command.add(instanceName);
  humanCommand=makeCommandHuman(command);
  String firstErrorMessage=Strings.get("String_Node_Str",instanceName,noderef,nodeHost);
  StringBuilder output=new StringBuilder();
  boolean waitForReaderThreads=true;
  if (OS.isWindows()) {
    waitForReaderThreads=false;
  }
  nodeUtils.runAdminCommandOnNode(node,command,ctx,firstErrorMessage,humanCommand,output,waitForReaderThreads);
  ActionReport report=ctx.getActionReport();
  if (report.getActionExitCode() == ActionReport.ExitCode.SUCCESS) {
    String msg=Strings.get("String_Node_Str",instanceName,nodeHost);
    if (!terse) {
      msg=StringUtils.cat(NL,output.toString().trim(),msg);
    }
    report.setMessage(msg);
  }
}
Program: 29884
Project: 29884
Buggy source:
public void deleteInstanceFilesystem(AdminCommandContext context){
  NodeUtils nodeUtils=new NodeUtils(habitat,logger);
  Server dasServer=servers.getServer(SystemPropertyConstants.DAS_SERVER_NAME);
  String dasHost=dasServer.getAdminHost();
  String dasPort=Integer.toString(dasServer.getAdminPort());
  ArrayList<String> command=new ArrayList<String>();
  String humanCommand=null;
  command.add("String_Node_Str");
  if (nodedir != null) {
    command.add("String_Node_Str");
    command.add(nodedir);
  }
  command.add("String_Node_Str");
  command.add(noderef);
  command.add(instanceName);
  humanCommand=makeCommandHuman(command);
  String firstErrorMessage=Strings.get("String_Node_Str",instanceName,noderef,theNode.getNodeHost());
  StringBuilder output=new StringBuilder();
  nodeUtils.runAdminCommandOnNode(theNode,command,ctx,firstErrorMessage,humanCommand,output);
  ActionReport report=ctx.getActionReport();
  if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS) {
    return;
  }
  String msg=Strings.get("String_Node_Str",instanceName,theNode.getNodeHost());
  if (!terse) {
    msg=StringUtils.cat(NL,output.toString().trim(),msg);
  }
  report.setMessage(msg);
}

Fixed version (ground truth):
public void deleteInstanceFilesystem(AdminCommandContext context){
  NodeUtils nodeUtils=new NodeUtils(habitat,logger);
  Server dasServer=servers.getServer(SystemPropertyConstants.DAS_SERVER_NAME);
  ArrayList<String> command=new ArrayList<String>();
  String humanCommand=null;
  command.add("String_Node_Str");
  if (nodedir != null) {
    command.add("String_Node_Str");
    command.add(nodedir);
  }
  command.add("String_Node_Str");
  command.add(noderef);
  command.add(instanceName);
  humanCommand=makeCommandHuman(command);
  String firstErrorMessage=Strings.get("String_Node_Str",instanceName,noderef,theNode.getNodeHost());
  StringBuilder output=new StringBuilder();
  nodeUtils.runAdminCommandOnNode(theNode,command,ctx,firstErrorMessage,humanCommand,output);
  ActionReport report=ctx.getActionReport();
  if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS) {
    return;
  }
  String msg=Strings.get("String_Node_Str",instanceName,theNode.getNodeHost());
  if (!terse) {
    msg=StringUtils.cat(NL,output.toString().trim(),msg);
  }
  report.setMessage(msg);
}
Program: 29885
Project: 29885
Buggy source:
private void startInstance(){
  NodeUtils nodeUtils=new NodeUtils(habitat,logger);
  Server dasServer=servers.getServer(SystemPropertyConstants.DAS_SERVER_NAME);
  String dasHost=dasServer.getAdminHost();
  String dasPort=Integer.toString(dasServer.getAdminPort());
  ArrayList<String> command=new ArrayList<String>();
  String humanCommand=null;
  command.add("String_Node_Str");
  command.add("String_Node_Str");
  command.add(noderef);
  if (nodedir != null) {
    command.add("String_Node_Str");
    command.add(nodedir);
  }
  command.add("String_Node_Str");
  command.add(sync);
  if (debug) {
    command.add("String_Node_Str");
  }
  command.add(instanceName);
  humanCommand=makeCommandHuman(command);
  String firstErrorMessage=Strings.get("String_Node_Str",instanceName,noderef,nodeHost);
  StringBuilder output=new StringBuilder();
  boolean waitForReaderThreads=true;
  if (OS.isWindows()) {
    waitForReaderThreads=false;
  }
  nodeUtils.runAdminCommandOnNode(node,command,ctx,firstErrorMessage,humanCommand,output,waitForReaderThreads);
  ActionReport report=ctx.getActionReport();
  if (report.getActionExitCode() == ActionReport.ExitCode.SUCCESS) {
    String msg=Strings.get("String_Node_Str",instanceName,nodeHost);
    if (!terse) {
      msg=StringUtils.cat(NL,output.toString().trim(),msg);
    }
    report.setMessage(msg);
  }
}

Fixed version (ground truth):
private void startInstance(){
  NodeUtils nodeUtils=new NodeUtils(habitat,logger);
  Server dasServer=servers.getServer(SystemPropertyConstants.DAS_SERVER_NAME);
  ArrayList<String> command=new ArrayList<String>();
  String humanCommand=null;
  command.add("String_Node_Str");
  command.add("String_Node_Str");
  command.add(noderef);
  if (nodedir != null) {
    command.add("String_Node_Str");
    command.add(nodedir);
  }
  command.add("String_Node_Str");
  command.add(sync);
  if (debug) {
    command.add("String_Node_Str");
  }
  command.add(instanceName);
  humanCommand=makeCommandHuman(command);
  String firstErrorMessage=Strings.get("String_Node_Str",instanceName,noderef,nodeHost);
  StringBuilder output=new StringBuilder();
  boolean waitForReaderThreads=true;
  if (OS.isWindows()) {
    waitForReaderThreads=false;
  }
  nodeUtils.runAdminCommandOnNode(node,command,ctx,firstErrorMessage,humanCommand,output,waitForReaderThreads);
  ActionReport report=ctx.getActionReport();
  if (report.getActionExitCode() == ActionReport.ExitCode.SUCCESS) {
    String msg=Strings.get("String_Node_Str",instanceName,nodeHost);
    if (!terse) {
      msg=StringUtils.cat(NL,output.toString().trim(),msg);
    }
    report.setMessage(msg);
  }
}
Program: 29886
Project: 29886
Buggy source:
/** 
 * Adds a listener of the given class type to this ServletContext.
 */
@Override public void addListener(Class<? extends EventListener> listenerClass){
  try {
    addListener(createListenerInstance(listenerClass));
  }
 catch (  Throwable t) {
    throw new IllegalArgumentException(t);
  }
}

Fixed version (ground truth):
/** 
 * Adds a listener of the given class type to this ServletContext.
 */
@Override public void addListener(Class<? extends EventListener> listenerClass){
  EventListener listener=null;
  try {
    listener=createListenerInstance(listenerClass);
  }
 catch (  Throwable t) {
    throw new IllegalArgumentException(t);
  }
  addListener(listener);
}
Program: 29887
Project: 29887
Buggy source:
/** 
 * Given a byte[] containing session data, return a session object
 * @param state The byte[] with the session attribute data
 * @return A newly created object for the given session attribute data
 */
protected Object getAttributeValue(byte[] state) throws IOException, ClassNotFoundException {
  Object attributeValue=null;
  BufferedInputStream bis=null;
  ByteArrayInputStream bais=null;
  Loader loader=null;
  ClassLoader classLoader=null;
  ObjectInputStream ois=null;
  Container container=manager.getContainer();
  try {
    bais=new ByteArrayInputStream(state);
    bis=new BufferedInputStream(bais);
    if (container != null) {
      loader=container.getLoader();
    }
    if (loader != null) {
      classLoader=loader.getClassLoader();
    }
    if (classLoader != null) {
      try {
        ois=ioUtils.createObjectInputStream(bis,true,classLoader);
      }
 catch (      Exception ex) {
      }
    }
    if (ois == null) {
      ois=new ObjectInputStream(bis);
    }
    if (ois != null) {
      try {
        attributeValue=ois.readObject();
      }
  finally {
        if (ois != null) {
          try {
            ois.close();
            bis=null;
          }
 catch (          IOException e) {
          }
        }
      }
    }
  }
 catch (  ClassNotFoundException e) {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",e);
    }
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
  return attributeValue;
}

Fixed version (ground truth):
/** 
 * Given a byte[] containing session data, return a session object
 * @param state The byte[] with the session attribute data
 * @return A newly created object for the given session attribute data
 */
protected Object getAttributeValue(byte[] state) throws IOException, ClassNotFoundException {
  Object attributeValue=null;
  BufferedInputStream bis=null;
  ByteArrayInputStream bais=null;
  Loader loader=null;
  ClassLoader classLoader=null;
  ObjectInputStream ois=null;
  Container container=manager.getContainer();
  try {
    bais=new ByteArrayInputStream(state);
    bis=new BufferedInputStream(bais);
    if (container != null) {
      loader=container.getLoader();
    }
    if (loader != null) {
      classLoader=loader.getClassLoader();
    }
    if (classLoader != null) {
      try {
        ois=ioUtils.createObjectInputStream(bis,true,classLoader);
      }
 catch (      Exception ex) {
      }
    }
    if (ois == null) {
      ois=new ObjectInputStream(bis);
    }
    if (ois != null) {
      try {
        attributeValue=ois.readObject();
      }
  finally {
        try {
          ois.close();
          bis=null;
        }
 catch (        IOException e) {
        }
      }
    }
  }
 catch (  ClassNotFoundException e) {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",e);
    }
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
  return attributeValue;
}
Program: 29890
Project: 29890
Buggy source:
public void postRequestDispatcherProcess(ServletRequest request,ServletResponse response){
  Context context=(Context)this.getContainer();
  Session sess=this.getSession(request);
  if (sess != null) {
    doValveSave(sess);
  }
  return;
}

Fixed version (ground truth):
public void postRequestDispatcherProcess(ServletRequest request,ServletResponse response){
  Session sess=this.getSession(request);
  if (sess != null) {
    doValveSave(sess);
  }
  return;
}
Program: 29891
Project: 29891
Buggy source:
@Override public Object run(ConfigBeanProxy... params) throws PropertyVetoException, TransactionFailure {
  Cluster wCluster=(Cluster)params[0];
  ServerPoolConfig wServerPoolConfig=(ServerPoolConfig)params[1];
  VirtualMachineConfig vmConfig=config.getExtensionsByTypeAndName(VirtualMachineConfig.class,vm.getName());
  if (vmConfig != null) {
    wCluster.getExtensions().remove(vmConfig);
  }
 else {
    throw new TransactionFailure("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
@Override public Object run(ConfigBeanProxy... params) throws PropertyVetoException, TransactionFailure {
  Cluster wCluster=(Cluster)params[0];
  VirtualMachineConfig vmConfig=config.getExtensionsByTypeAndName(VirtualMachineConfig.class,vm.getName());
  if (vmConfig != null) {
    wCluster.getExtensions().remove(vmConfig);
  }
 else {
    throw new TransactionFailure("String_Node_Str");
  }
  return null;
}
Program: 29892
Project: 29892
Buggy source:
public synchronized void remove(final VirtualMachine vm){
  try {
    ConfigSupport.apply(new ConfigCode(){
      @Override public Object run(      ConfigBeanProxy... params) throws PropertyVetoException, TransactionFailure {
        Cluster wCluster=(Cluster)params[0];
        ServerPoolConfig wServerPoolConfig=(ServerPoolConfig)params[1];
        VirtualMachineConfig vmConfig=config.getExtensionsByTypeAndName(VirtualMachineConfig.class,vm.getName());
        if (vmConfig != null) {
          wCluster.getExtensions().remove(vmConfig);
        }
 else {
          throw new TransactionFailure("String_Node_Str");
        }
        return null;
      }
    }
,config,vm.getServerPool().getConfig());
  }
 catch (  TransactionFailure transactionFailure) {
    throw new RuntimeException(transactionFailure);
  }
  vms.remove(vm);
}

Fixed version (ground truth):
public synchronized void remove(final VirtualMachine vm){
  try {
    ConfigSupport.apply(new ConfigCode(){
      @Override public Object run(      ConfigBeanProxy... params) throws PropertyVetoException, TransactionFailure {
        Cluster wCluster=(Cluster)params[0];
        VirtualMachineConfig vmConfig=config.getExtensionsByTypeAndName(VirtualMachineConfig.class,vm.getName());
        if (vmConfig != null) {
          wCluster.getExtensions().remove(vmConfig);
        }
 else {
          throw new TransactionFailure("String_Node_Str");
        }
        return null;
      }
    }
,config,vm.getServerPool().getConfig());
  }
 catch (  TransactionFailure transactionFailure) {
    throw new RuntimeException(transactionFailure);
  }
  vms.remove(vm);
}