nus-yam/ex-repair huggingface dataset:
Program: 167888
Project: 167888
Buggy source:
/** 
 * Updates the handlers to be assigned. Checks to see if the handler already exists and throws an  {@link OperationFailedException exception} if it does.
 * @param handlerAttribute the handler attribute.
 * @param operation        the operation.
 * @param model            the new model
 * @throws OperationFailedException if an error occurs.
 */
protected void updateHandlersForAssign(final AttributeDefinition handlerAttribute,ModelNode operation,ModelNode model) throws OperationFailedException {
  final String handlerName=getHandlerName(operation);
  if (handlerExists(handlerName,handlerAttribute,operation)) {
    throw createFailureMessage(MESSAGES.handlerAlreadyDefined(handlerName));
  }
  getAssignedHandlers(operation).add(handlerName);
  handlerAttribute.validateAndSet(operation,model);
}

Fixed version (ground truth):
/** 
 * Updates the handlers to be assigned. Checks to see if the handler already exists and throws an  {@link OperationFailedException exception} if it does.
 * @param handlerAttribute the handler attribute.
 * @param operation        the operation.
 * @param model            the new model
 * @throws OperationFailedException if an error occurs.
 */
protected void updateHandlersForAssign(final AttributeDefinition handlerAttribute,final ModelNode operation,final ModelNode model) throws OperationFailedException {
  final String handlerName=getHandlerName(operation);
  final ModelNode parent=getParent(model);
  if (handlerExists(handlerName,handlerAttribute,parent)) {
    throw createFailureMessage(MESSAGES.handlerAlreadyDefined(handlerName));
  }
  parent.get(handlerAttribute.getName()).add(handlerName);
}
Program: 167889
Project: 167889
Buggy source:
/** 
 * Updates the handlers to be unassigned. Checks to see if the handler exists and creates a new list of handlers removing the handler to be unassigned. If the handler to be unassigned does not exist an  {@link OperationFailedException exception} is thrown.
 * @param handlerAttribute the handler attribute.
 * @param operation        the operation.
 * @param model            the new model
 * @throws OperationFailedException if an error occurs.
 */
protected void updateHandlersForUnassign(final AttributeDefinition handlerAttribute,ModelNode operation,ModelNode model) throws OperationFailedException {
  final String handlerName=getHandlerName(operation);
  if (handlerExists(handlerName,handlerAttribute,operation)) {
    final ModelNode currentSubhandlers=getAssignedHandlers(model);
    final List<ModelNode> newSubhandlers=new ArrayList<ModelNode>();
    for (    ModelNode node : currentSubhandlers.asList()) {
      if (node.asString().equals(handlerName)) {
        continue;
      }
      newSubhandlers.add(node);
    }
    model.get(handlerAttribute.getName()).set(newSubhandlers);
  }
 else {
    throw createFailureMessage(MESSAGES.cannotUnassignHandler(handlerName));
  }
}

Fixed version (ground truth):
/** 
 * Updates the handlers to be unassigned. Checks to see if the handler exists and creates a new list of handlers removing the handler to be unassigned. If the handler to be unassigned does not exist an  {@link OperationFailedException exception} is thrown.
 * @param handlerAttribute the handler attribute.
 * @param operation        the operation.
 * @param model            the new model
 * @throws OperationFailedException if an error occurs.
 */
protected void updateHandlersForUnassign(final AttributeDefinition handlerAttribute,final ModelNode operation,final ModelNode model) throws OperationFailedException {
  final String handlerName=getHandlerName(operation);
  final ModelNode parent=getParent(model);
  if (handlerExists(handlerName,handlerAttribute,parent)) {
    final ModelNode currentSubhandlers=handlerAttribute.validateResolvedOperation(parent);
    final List<ModelNode> newSubhandlers=new ArrayList<ModelNode>();
    for (    ModelNode node : currentSubhandlers.asList()) {
      if (node.asString().equals(handlerName)) {
        continue;
      }
      newSubhandlers.add(node);
    }
    parent.get(handlerAttribute.getName()).set(newSubhandlers);
  }
 else {
    throw createFailureMessage(MESSAGES.cannotUnassignHandler(handlerName));
  }
}
Program: 167890
Project: 167890
Buggy source:
@Override protected void updateModel(ModelNode operation,ModelNode model) throws OperationFailedException {
  NAME.validateAndSet(operation,model);
  updateHandlersForAssign(SUBHANDLERS,operation,model);
}

Fixed version (ground truth):
@Override protected void updateModel(ModelNode operation,ModelNode model) throws OperationFailedException {
  updateHandlersForAssign(SUBHANDLERS,operation,model);
}
Program: 167891
Project: 167891
Buggy source:
@Override protected void updateModel(ModelNode operation,ModelNode model) throws OperationFailedException {
  NAME.validateAndSet(operation,model);
  updateHandlersForUnassign(SUBHANDLERS,operation,model);
}

Fixed version (ground truth):
@Override protected void updateModel(ModelNode operation,ModelNode model) throws OperationFailedException {
  updateHandlersForUnassign(SUBHANDLERS,operation,model);
}
Program: 167892
Project: 167892
Buggy source:
@Override protected void updateModel(final ModelNode operation,final ModelNode model) throws OperationFailedException {
  NAME.validateAndSet(operation,model);
  updateHandlersForAssign(HANDLERS,operation,model);
}

Fixed version (ground truth):
@Override protected void updateModel(final ModelNode operation,final ModelNode model) throws OperationFailedException {
  updateHandlersForAssign(HANDLERS,operation,model);
}
Program: 167893
Project: 167893
Buggy source:
@Override protected void performRuntime(final OperationContext context,final ModelNode operation,final ModelNode model,final ServiceVerificationHandler verificationHandler,final List<ServiceController<?>> newControllers) throws OperationFailedException {
  String loggerName=getLoggerName(operation);
  String handlerName=getHandlerName(operation);
  final ServiceRegistry serviceRegistry=context.getServiceRegistry(false);
  ServiceController<?> loggerHandlerController=serviceRegistry.getService(LogServices.loggerHandlerName(loggerName,handlerName));
  final ServiceController<Handler> handlerController=(ServiceController<Handler>)serviceRegistry.getService(LogServices.handlerName(handlerName));
  if (loggerHandlerController != null) {
    throw createFailureMessage(MESSAGES.handlerAlreadyDefined(handlerName));
  }
  if (handlerController == null)   throw createFailureMessage(MESSAGES.handlerNotFound(handlerName));
  ServiceTarget target=context.getServiceTarget();
  LoggerHandlerService service=new LoggerHandlerService(loggerName);
  ServiceBuilder<Logger> builder=target.addService(LogServices.loggerHandlerName(loggerName,handlerName),service);
  builder.addDependency(LogServices.loggerName(loggerName));
  builder.addDependency(LogServices.handlerName(handlerName),Handler.class,service.getHandlerInjector());
  builder.addListener(verificationHandler);
  newControllers.add(builder.install());
}

Fixed version (ground truth):
@Override protected void performRuntime(final OperationContext context,final ModelNode operation,final ModelNode model,final ServiceVerificationHandler verificationHandler,final List<ServiceController<?>> newControllers) throws OperationFailedException {
  String loggerName=getLoggerName(operation);
  String handlerName=getHandlerName(operation);
  final ServiceRegistry serviceRegistry=context.getServiceRegistry(false);
  ServiceController<?> loggerHandlerController=serviceRegistry.getService(LogServices.loggerHandlerName(loggerName,handlerName));
  final ServiceController<Handler> handlerController=(ServiceController<Handler>)serviceRegistry.getService(LogServices.handlerName(handlerName));
  if (loggerHandlerController != null) {
    throw createFailureMessage(MESSAGES.handlerAlreadyDefined(handlerName));
  }
  if (handlerController == null) {
    throw createFailureMessage(MESSAGES.handlerNotFound(handlerName));
  }
  ServiceTarget target=context.getServiceTarget();
  LoggerHandlerService service=new LoggerHandlerService(loggerName);
  ServiceBuilder<Logger> builder=target.addService(LogServices.loggerHandlerName(loggerName,handlerName),service);
  builder.addDependency(LogServices.loggerName(loggerName));
  builder.addDependency(LogServices.handlerName(handlerName),Handler.class,service.getHandlerInjector());
  builder.addListener(verificationHandler);
  newControllers.add(builder.install());
}
Program: 167894
Project: 167894
Buggy source:
@Override protected void updateModel(final ModelNode operation,final ModelNode model) throws OperationFailedException {
  NAME.validateAndSet(operation,model);
  updateHandlersForUnassign(HANDLERS,operation,model);
}

Fixed version (ground truth):
@Override protected void updateModel(final ModelNode operation,final ModelNode model) throws OperationFailedException {
  updateHandlersForUnassign(HANDLERS,operation,model);
}
Program: 167895
Project: 167895
Buggy source:
@Override protected void updateModel(final ModelNode operation,final ModelNode model) throws OperationFailedException {
  LEVEL.validateAndSet(operation.get(ROOT_LOGGER),model.get(ROOT_LOGGER));
}

Fixed version (ground truth):
@Override protected void updateModel(final ModelNode operation,final ModelNode model) throws OperationFailedException {
  LEVEL.validateAndSet(operation,model.get(ROOT_LOGGER));
}
Program: 167896
Project: 167896
Buggy source:
@Override protected void performRuntime(final OperationContext context,final ModelNode operation,final ModelNode model,final ServiceVerificationHandler verificationHandler,final List<ServiceController<?>> newControllers) throws OperationFailedException {
  final ServiceRegistry serviceRegistry=context.getServiceRegistry(false);
  final ServiceController<Logger> controller=(ServiceController<Logger>)serviceRegistry.getService(LogServices.ROOT_LOGGER);
  final ModelNode level=LEVEL.validateResolvedOperation(model);
  if (controller != null && level.isDefined()) {
    controller.getValue().setLevel(Level.parse(level.asString()));
  }
}

Fixed version (ground truth):
@Override protected void performRuntime(final OperationContext context,final ModelNode operation,final ModelNode model,final ServiceVerificationHandler verificationHandler,final List<ServiceController<?>> newControllers) throws OperationFailedException {
  final ServiceRegistry serviceRegistry=context.getServiceRegistry(false);
  final ServiceController<Logger> controller=(ServiceController<Logger>)serviceRegistry.getService(LogServices.ROOT_LOGGER);
  final ModelNode level=LEVEL.validateResolvedOperation(model.get(ROOT_LOGGER));
  if (controller != null && level.isDefined()) {
    controller.getValue().setLevel(Level.parse(level.asString()));
  }
}
Program: 167897
Project: 167897
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void initializeParsers(ExtensionParsingContext context){
  context.setSubsystemXmlMapping(Namespace.CURRENT.getUriString(),NewRemotingSubsystemParser.INSTANCE);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void initializeParsers(ExtensionParsingContext context){
  context.setSubsystemXmlMapping(Namespace.CURRENT.getUriString(),NewRemotingSubsystemParser.INSTANCE);
}
Program: 167898
Project: 167898
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void writeContent(XMLExtendedStreamWriter writer,SubsystemMarshallingContext context) throws XMLStreamException {
  context.startSubsystemElement(Namespace.CURRENT.getUriString(),false);
  final ModelNode node=context.getModelNode();
  if (node.hasDefined(CONNECTOR)) {
    final ModelNode connector=node.get(CONNECTOR);
    for (    String name : connector.keys()) {
      writeConnector(writer,connector.require(name),name);
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void writeContent(XMLExtendedStreamWriter writer,SubsystemMarshallingContext context) throws XMLStreamException {
  context.startSubsystemElement(Namespace.CURRENT.getUriString(),false);
  final ModelNode node=context.getModelNode();
  if (node.hasDefined(CONNECTOR)) {
    final ModelNode connector=node.get(CONNECTOR);
    for (    String name : connector.keys()) {
      writeConnector(writer,connector.require(name),name);
    }
  }
  writer.writeEndElement();
}
Program: 167899
Project: 167899
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + moduleClass + '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + moduleClass + "String_Node_Str"+ moduleClass.getClassLoader()+ '}';
}
Program: 167900
Project: 167900
Buggy source:
/** 
 * Finds and returns a method corresponding to the passed <code>methodIdentifier</code>. The passed <code>classReflectionIndex</code> will be used to traverse the class hierarchy while finding the method. <p/> Returns null if no such method is found
 * @param deploymentReflectionIndex The deployment reflection index
 * @param classReflectionIndex      The class reflection index which will be used to traverse the class hierarchy to find the method
 * @param methodIdentifier          The method identifier of the method being searched for
 * @return
 */
public static Method findMethod(final DeploymentReflectionIndex deploymentReflectionIndex,final ClassReflectionIndex classReflectionIndex,final MethodIdentifier methodIdentifier){
  Method method=classReflectionIndex.getMethod(methodIdentifier);
  if (method != null) {
    return method;
  }
  Class<?> superClass=classReflectionIndex.getIndexedClass().getSuperclass();
  if (superClass != null) {
    ClassReflectionIndex<?> superClassIndex=deploymentReflectionIndex.getClassIndex(superClass);
    if (superClassIndex != null) {
      return findMethod(deploymentReflectionIndex,superClassIndex,methodIdentifier);
    }
  }
  return method;
}

Fixed version (ground truth):
/** 
 * Finds and returns a method corresponding to the passed <code>method</code>, which may be declared in the super class of the passed <code>classReflectionIndex</code>. <p/> <p/>
 * @param deploymentReflectionIndex The deployment reflection index
 * @param classReflectionIndex      The class reflection index which will be used to traverse the class hierarchy to find the method
 * @param method                    The method being searched for
 * @return
 */
public static Method findMethod(final DeploymentReflectionIndex deploymentReflectionIndex,final ClassReflectionIndex classReflectionIndex,final Method method){
  if (method == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  MethodIdentifier methodIdentifier=MethodIdentifier.getIdentifierForMethod(method);
  return findMethod(deploymentReflectionIndex,classReflectionIndex,methodIdentifier);
}
Program: 167901
Project: 167901
Buggy source:
@Override public void execute(OperationContext context,ModelNode operation){
  try {
    final String name=operation.require(NAME).asString();
    final boolean value=operation.get(VALUE).asBoolean();
    ModelNode valNode=context.readModelForUpdate(PathAddress.EMPTY_ADDRESS).get(name);
    boolean oldVal=valNode.asBoolean();
    valNode.set(value);
  }
 catch (  Exception e) {
    context.getFailureDescription().set(e.toString());
  }
  context.completeStep();
}

Fixed version (ground truth):
@Override public void execute(OperationContext context,ModelNode operation) throws OperationFailedException {
  validator.validateParameter(JVM_OPTION,operation.get(JVM_OPTION));
  final Resource resource=context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS);
  final ModelNode model=resource.getModel();
  final ModelNode option=operation.require(JVM_OPTION);
  if (model.hasDefined(JVM_OPTIONS)) {
    final ModelNode values=model.get(JVM_OPTIONS);
    model.get(JVM_OPTIONS).setEmptyList();
    for (    ModelNode value : values.asList()) {
      if (!value.equals(option)) {
        model.get(JVM_OPTIONS).add(value);
      }
    }
  }
  context.completeStep();
}
Program: 167903
Project: 167903
Buggy source:
@Override protected void doHandle(CommandContext ctx) throws CommandFormatException {
  final String nodePath=this.nodePath.getValue(ctx.getParsedCommandLine());
  final OperationRequestAddress address;
  if (nodePath != null) {
    address=new DefaultOperationRequestAddress(ctx.getPrefix());
    CommandLineParser.CallbackHandler handler=new DefaultCallbackHandler(address);
    try {
      ctx.getCommandLineParser().parse(nodePath,handler);
    }
 catch (    CommandFormatException e) {
      ctx.printLine(e.getLocalizedMessage());
    }
  }
 else {
    address=new DefaultOperationRequestAddress(ctx.getPrefix());
  }
  final List<String> names;
  if (address.endsOnType()) {
    final String type=address.getNodeType();
    address.toParentNode();
    names=Util.getNodeNames(ctx.getModelControllerClient(),address,type);
  }
 else {
    names=Util.getNodeTypes(ctx.getModelControllerClient(),address);
  }
  printList(ctx,names,l.isPresent(ctx.getParsedCommandLine()));
}

Fixed version (ground truth):
@Override protected void doHandle(CommandContext ctx) throws CommandFormatException {
  final ParsedCommandLine parsedCmd=ctx.getParsedCommandLine();
  String nodePath=this.nodePath.getValue(parsedCmd);
  final OperationRequestAddress address;
  if (nodePath != null) {
    address=new DefaultOperationRequestAddress(ctx.getPrefix());
    CommandLineParser.CallbackHandler handler=new DefaultCallbackHandler(address);
    nodePath=ctx.getArgumentsString();
    if (l.isPresent(parsedCmd)) {
      nodePath=nodePath.trim();
      if (nodePath.startsWith("String_Node_Str")) {
        nodePath=nodePath.substring(3);
      }
 else {
        nodePath=nodePath.substring(0,nodePath.length() - 3);
      }
    }
    try {
      ctx.getCommandLineParser().parse(nodePath,handler);
    }
 catch (    CommandFormatException e) {
      ctx.printLine(e.getLocalizedMessage());
    }
  }
 else {
    address=new DefaultOperationRequestAddress(ctx.getPrefix());
  }
  final List<String> names;
  if (address.endsOnType()) {
    final String type=address.getNodeType();
    address.toParentNode();
    names=Util.getNodeNames(ctx.getModelControllerClient(),address,type);
  }
 else {
    names=Util.getNodeTypes(ctx.getModelControllerClient(),address);
  }
  printList(ctx,names,l.isPresent(parsedCmd));
}
Program: 167904
Project: 167904
Buggy source:
public LdapConnectionManagerService getValue() throws IllegalStateException, IllegalArgumentException {
  return this;
}

Fixed version (ground truth):
public synchronized LdapConnectionManagerService getValue() throws IllegalStateException, IllegalArgumentException {
  return this;
}
Program: 167905
Project: 167905
Buggy source:
public void stop(StopContext context){
  connectionOnlyProperties=null;
  fullProperties=null;
}

Fixed version (ground truth):
public synchronized void stop(StopContext context){
  connectionOnlyProperties=null;
  fullProperties=null;
}
Program: 167906
Project: 167906
Buggy source:
public void start(StartContext context) throws StartException {
  connectionOnlyProperties=new Properties();
  connectionOnlyProperties.put(Context.SECURITY_AUTHENTICATION,"String_Node_Str");
  String initialContextFactory=DEFAULT_INITIAL_CONTEXT;
  if (ldapConnection.has(INITIAL_CONTEXT_FACTORY)) {
    initialContextFactory=ldapConnection.require(INITIAL_CONTEXT_FACTORY).asString();
  }
  connectionOnlyProperties.put(Context.INITIAL_CONTEXT_FACTORY,initialContextFactory);
  String url=ldapConnection.require(URL).asString();
  connectionOnlyProperties.put(Context.PROVIDER_URL,url);
  fullProperties=(Properties)connectionOnlyProperties.clone();
  String searchDN=ldapConnection.require(SEARCH_DN).asString();
  String searchCredential=ldapConnection.require(SEARCH_CREDENTIAL).asString();
  fullProperties.put(Context.SECURITY_PRINCIPAL,searchDN);
  fullProperties.put(Context.SECURITY_CREDENTIALS,searchCredential);
}

Fixed version (ground truth):
public synchronized void start(StartContext context) throws StartException {
  connectionOnlyProperties=new Properties();
  connectionOnlyProperties.put(Context.SECURITY_AUTHENTICATION,"String_Node_Str");
  String initialContextFactory=DEFAULT_INITIAL_CONTEXT;
  if (ldapConnection.has(INITIAL_CONTEXT_FACTORY)) {
    initialContextFactory=ldapConnection.require(INITIAL_CONTEXT_FACTORY).asString();
  }
  connectionOnlyProperties.put(Context.INITIAL_CONTEXT_FACTORY,initialContextFactory);
  String url=ldapConnection.require(URL).asString();
  connectionOnlyProperties.put(Context.PROVIDER_URL,url);
  fullProperties=(Properties)connectionOnlyProperties.clone();
  String searchDN=ldapConnection.require(SEARCH_DN).asString();
  String searchCredential=ldapConnection.require(SEARCH_CREDENTIAL).asString();
  fullProperties.put(Context.SECURITY_PRINCIPAL,searchDN);
  fullProperties.put(Context.SECURITY_CREDENTIALS,searchCredential);
}
Program: 167907
Project: 167907
Buggy source:
protected void stop(final StopContext context,final Logger logger){
  logger.setLevel(null);
  logger.setUseParentHandlers(true);
  logger.clearHandlers();
  for (  Handler handler : saved) {
    logger.addHandler(handler);
  }
}

Fixed version (ground truth):
protected synchronized void stop(final StopContext context,final Logger logger){
  logger.setLevel(null);
  logger.setUseParentHandlers(true);
  logger.clearHandlers();
  for (  Handler handler : saved) {
    logger.addHandler(handler);
  }
}
Program: 167908
Project: 167908
Buggy source:
protected void start(final StartContext context,final Logger logger) throws StartException {
  logger.setLevel(level);
  logger.setUseParentHandlers(useParentHandlers);
  saved=logger.clearHandlers();
}

Fixed version (ground truth):
protected synchronized void start(final StartContext context,final Logger logger) throws StartException {
  logger.setLevel(level);
  logger.setUseParentHandlers(useParentHandlers);
  saved=logger.clearHandlers();
}
Program: 167909
Project: 167909
Buggy source:
protected void stop(final StopContext context,final Logger logger){
  logger.setLevel(null);
  logger.setUseParentHandlers(true);
  logger.clearHandlers();
  for (  Handler handler : saved) {
    logger.addHandler(handler);
  }
  log.info("String_Node_Str");
}

Fixed version (ground truth):
protected synchronized void stop(final StopContext context,final Logger logger){
  logger.setLevel(null);
  logger.setUseParentHandlers(true);
  logger.clearHandlers();
  for (  Handler handler : saved) {
    logger.addHandler(handler);
  }
  log.info("String_Node_Str");
}
Program: 167910
Project: 167910
Buggy source:
protected void start(final StartContext context,final Logger logger) throws StartException {
  logger.setLevel(level);
  log.info("String_Node_Str");
  saved=logger.clearHandlers();
}

Fixed version (ground truth):
protected synchronized void start(final StartContext context,final Logger logger) throws StartException {
  logger.setLevel(level);
  log.info("String_Node_Str");
  saved=logger.clearHandlers();
}
Program: 167911
Project: 167911
Buggy source:
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
  DeploymentUnit deploymentUnit=phaseContext.getDeploymentUnit();
  if (deploymentUnit.getParent() == null) {
    return;
  }
  final List<DeploymentUnit> deploymentUnits=new ArrayList<DeploymentUnit>();
  deploymentUnits.add(deploymentUnit);
  deploymentUnits.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS));
  for (  DeploymentUnit unit : deploymentUnits) {
    final ResourceRoot mainRoot=unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
    if (mainRoot == null)     continue;
    VirtualFile root=mainRoot.getRoot();
    for (    String path : SEAM_FILES) {
      if (root.getChild(path).exists()) {
        final ModuleSpecification moduleSpecification=deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
        final ModuleLoader moduleLoader=Module.getBootModuleLoader();
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader,VFS_MODULE,false,false,false));
        moduleSpecification.addResourceLoader(getSeamIntResourceLoader());
        return;
      }
    }
  }
}

Fixed version (ground truth):
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
  DeploymentUnit deploymentUnit=phaseContext.getDeploymentUnit();
  if (deploymentUnit.getParent() != null) {
    return;
  }
  final List<DeploymentUnit> deploymentUnits=new ArrayList<DeploymentUnit>();
  deploymentUnits.add(deploymentUnit);
  deploymentUnits.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS));
  for (  DeploymentUnit unit : deploymentUnits) {
    final ResourceRoot mainRoot=unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
    if (mainRoot == null)     continue;
    VirtualFile root=mainRoot.getRoot();
    for (    String path : SEAM_FILES) {
      if (root.getChild(path).exists()) {
        final ModuleSpecification moduleSpecification=deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
        final ModuleLoader moduleLoader=Module.getBootModuleLoader();
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader,VFS_MODULE,false,false,false));
        moduleSpecification.addResourceLoader(getSeamIntResourceLoader());
        return;
      }
    }
  }
}
Program: 167912
Project: 167912
Buggy source:
@Override protected ModelNode readResponse(final DataInput input) throws IOException {
  try {
    ProtocolUtils.expectHeader(input,NewModelControllerProtocol.PARAM_RESPONSE);
    ModelNode node=new ModelNode();
    node.readExternal(input);
    return node;
  }
  finally {
    ManagementBatchIdManager.DEFAULT.freeBatchId(getBatchId());
    activeRequests.remove(getCurrentRequestId());
  }
}

Fixed version (ground truth):
@Override protected ModelNode readResponse(final DataInput input) throws IOException {
  System.out.println("String_Node_Str" + getBatchId());
  try {
    ProtocolUtils.expectHeader(input,NewModelControllerProtocol.PARAM_RESPONSE);
    ModelNode node=new ModelNode();
    node.readExternal(input);
    return node;
  }
 catch (  Exception e) {
    super.setError(e);
    if (e instanceof IOException) {
      throw (IOException)e;
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new IOException(e);
  }
 finally {
    ManagementBatchIdManager.DEFAULT.freeBatchId(getBatchId());
    activeRequests.remove(getCurrentRequestId());
    System.out.println("String_Node_Str" + getBatchId());
  }
}
Program: 167913
Project: 167913
Buggy source:
public OperationMessageHandler getMessageHandler(){
  return messageHandler;
}

Fixed version (ground truth):
OperationMessageHandler getMessageHandler(){
  return messageHandler;
}
Program: 167914
Project: 167914
Buggy source:
@Override protected void readRequest(final DataInput input) throws IOException {
  int batchId=getContext().getHeader().getBatchId();
  ProtocolUtils.expectHeader(input,NewModelControllerProtocol.PARAM_INPUTSTREAM_INDEX);
  int index=input.readInt();
  ExecuteRequestContext requestContext=activeRequests.get(batchId);
  if (requestContext == null) {
    throw new IOException("String_Node_Str" + batchId);
  }
  InputStream in=requestContext.getAttachments().getInputStreams().get(index);
  attachmentInput=in != null ? new BufferedInputStream(in) : null;
}

Fixed version (ground truth):
@Override protected void readRequest(final DataInput input) throws IOException {
  int batchId=getContext().getHeader().getBatchId();
  System.out.println("String_Node_Str" + batchId);
  ProtocolUtils.expectHeader(input,NewModelControllerProtocol.PARAM_INPUTSTREAM_INDEX);
  int index=input.readInt();
  ExecuteRequestContext requestContext=activeRequests.get(batchId);
  if (requestContext == null) {
    throw new IOException("String_Node_Str" + batchId);
  }
  InputStream in=requestContext.getAttachments().getInputStreams().get(index);
  attachmentInput=in != null ? new BufferedInputStream(in) : null;
}
Program: 167915
Project: 167915
Buggy source:
@Override protected void writeResponse(final FlushableDataOutput output) throws IOException {
  ByteArrayOutputStream bout=new ByteArrayOutputStream();
  if (attachmentInput != null) {
    int i=attachmentInput.read();
    while (i != -1) {
      bout.write(i);
      i=attachmentInput.read();
    }
  }
  byte[] bytes=bout.toByteArray();
  output.write(NewModelControllerProtocol.PARAM_INPUTSTREAM_LENGTH);
  output.writeInt(bytes.length);
  output.write(NewModelControllerProtocol.PARAM_INPUTSTREAM_CONTENTS);
  output.write(bytes);
}

Fixed version (ground truth):
@Override protected void writeResponse(final FlushableDataOutput output) throws IOException {
  ByteArrayOutputStream bout=new ByteArrayOutputStream();
  if (attachmentInput != null) {
    int i=attachmentInput.read();
    while (i != -1) {
      bout.write(i);
      i=attachmentInput.read();
    }
  }
  byte[] bytes=bout.toByteArray();
  output.write(NewModelControllerProtocol.PARAM_INPUTSTREAM_LENGTH);
  output.writeInt(bytes.length);
  output.write(NewModelControllerProtocol.PARAM_INPUTSTREAM_CONTENTS);
  output.write(bytes);
  System.out.println("String_Node_Str" + getContext().getHeader().getBatchId());
}
Program: 167916
Project: 167916
Buggy source:
public OperationAttachments getAttachments(){
  return attachments;
}

Fixed version (ground truth):
OperationAttachments getAttachments(){
  return attachments;
}
Program: 167917
Project: 167917
Buggy source:
public ExecuteRequestContext(final OperationMessageHandler messageHandler,final OperationAttachments attachments){
  this.messageHandler=messageHandler;
  this.attachments=attachments;
}

Fixed version (ground truth):
ExecuteRequestContext(final OperationMessageHandler messageHandler,final OperationAttachments attachments){
  this.messageHandler=messageHandler;
  this.attachments=attachments;
}
Program: 167918
Project: 167918
Buggy source:
@Override protected void writeRequest(final int protocolVersion,final FlushableDataOutput output) throws IOException {
  activeRequests.put(getBatchId(),executeRequestContext);
  output.write(NewModelControllerProtocol.PARAM_OPERATION);
  operation.writeExternal(output);
  output.write(NewModelControllerProtocol.PARAM_INPUTSTREAMS_LENGTH);
  int inputStreamLength=0;
  if (executeRequestContext.getAttachments() != null) {
    List<InputStream> streams=executeRequestContext.getAttachments().getInputStreams();
    if (streams != null) {
      inputStreamLength=streams.size();
    }
  }
  output.writeInt(inputStreamLength);
}

Fixed version (ground truth):
@Override protected void writeRequest(final int protocolVersion,final FlushableDataOutput output) throws IOException {
  try {
    System.out.println("String_Node_Str" + getBatchId());
    activeRequests.put(getBatchId(),executeRequestContext);
    output.write(NewModelControllerProtocol.PARAM_OPERATION);
    operation.writeExternal(output);
    output.write(NewModelControllerProtocol.PARAM_INPUTSTREAMS_LENGTH);
    int inputStreamLength=0;
    if (executeRequestContext.getAttachments() != null) {
      List<InputStream> streams=executeRequestContext.getAttachments().getInputStreams();
      if (streams != null) {
        inputStreamLength=streams.size();
      }
    }
    output.writeInt(inputStreamLength);
  }
 catch (  Exception e) {
    super.setError(e);
    if (e instanceof IOException) {
      throw (IOException)e;
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new IOException(e);
  }
}
Program: 167919
Project: 167919
Buggy source:
@Override protected void writeResponse(final FlushableDataOutput output) throws IOException {
  ModelNode result;
  try {
    result=controller.execute(operation,new OperationMessageHandlerProxy(getContext(),batchId),NewModelController.OperationTransactionControl.COMMIT,new OperationAttachmentsProxy(getContext(),batchId,attachmentsLength));
  }
 catch (  Exception e) {
    final ModelNode failure=new ModelNode();
    failure.get(OUTCOME).set(FAILED);
    failure.get(FAILURE_DESCRIPTION).set(e.getClass().getName() + "String_Node_Str" + e.getMessage());
    result=failure;
  }
  output.write(NewModelControllerProtocol.PARAM_RESPONSE);
  result.writeExternal(output);
}

Fixed version (ground truth):
@Override protected void writeResponse(final FlushableDataOutput output) throws IOException {
  ModelNode result;
  try {
    System.out.println("String_Node_Str" + batchId);
    result=controller.execute(operation,new OperationMessageHandlerProxy(getContext(),batchId),NewModelController.OperationTransactionControl.COMMIT,new OperationAttachmentsProxy(getContext(),batchId,attachmentsLength));
  }
 catch (  Exception e) {
    final ModelNode failure=new ModelNode();
    failure.get(OUTCOME).set(FAILED);
    failure.get(FAILURE_DESCRIPTION).set(e.getClass().getName() + "String_Node_Str" + e.getMessage());
    result=failure;
  }
  System.out.println("String_Node_Str" + batchId + "String_Node_Str"+ result.get(OUTCOME).asString());
  output.write(NewModelControllerProtocol.PARAM_RESPONSE);
  result.writeExternal(output);
}
Program: 167920
Project: 167920
Buggy source:
private void handleRequest(final ManagementRequestHeader header,final DataInput input) throws IOException {
  final FlushableDataOutputImpl output=FlushableDataOutputImpl.create(writeMessage());
  Exception error=null;
  try {
    final ManagementRequestHandler requestHandler;
    try {
      requestHandler=getRequestHandler(header);
      requestHandler.setContext(new ManagementRequestContext(ManagementChannel.this,header));
      requestHandler.readRequest(input);
      expectHeader(input,ManagementProtocol.REQUEST_END);
    }
 catch (    Exception e) {
      error=e;
      throw e;
    }
 finally {
      writeResponseHeader(header,output,error);
      if (error != null) {
        output.writeByte(ManagementProtocol.RESPONSE_END);
      }
    }
    requestHandler.writeResponse(output);
    output.writeByte(ManagementProtocol.RESPONSE_END);
  }
 catch (  Exception e) {
    formatException(e);
  }
 finally {
    IoUtils.safeClose(output);
  }
}

Fixed version (ground truth):
private void handleRequest(final ManagementRequestHeader header,final DataInput input) throws IOException {
  final FlushableDataOutputImpl output=FlushableDataOutputImpl.create(writeMessage());
  Exception error=null;
  try {
    final ManagementRequestHandler requestHandler;
    try {
      requestHandler=getRequestHandler(header);
      requestHandler.setContext(new ManagementRequestContext(ManagementChannel.this,header));
      requestHandler.readRequest(input);
      expectHeader(input,ManagementProtocol.REQUEST_END);
    }
 catch (    Exception e) {
      error=e;
      throw e;
    }
 finally {
      writeResponseHeader(header,output,error);
      if (error != null) {
        output.writeByte(ManagementProtocol.RESPONSE_END);
      }
    }
    requestHandler.writeResponse(output);
    output.writeByte(ManagementProtocol.RESPONSE_END);
  }
 catch (  Exception e) {
    e.printStackTrace();
    throwFormattedException(e);
  }
 finally {
    IoUtils.safeClose(output);
  }
}
Program: 167921
Project: 167921
Buggy source:
@Override public void start(StartContext context) throws StartException {
  try {
    endpointValue.getValue().registerService(channelName,this,optionMap);
  }
 catch (  Exception e) {
    throw new StartException(e);
  }
}

Fixed version (ground truth):
@Override public void start(StartContext context) throws StartException {
  try {
    System.out.println("String_Node_Str" + channelName);
    endpointValue.getValue().registerService(channelName,this,optionMap);
  }
 catch (  Exception e) {
    throw new StartException(e);
  }
}
Program: 167922
Project: 167922
Buggy source:
@Override protected void doHandle(CommandContext ctx) throws CommandFormatException {
  ModelNode request;
  try {
    request=buildRequest(ctx);
  }
 catch (  CommandFormatException e1) {
    ctx.printLine(e1.getLocalizedMessage());
    return;
  }
  if (request == null) {
    ctx.printLine("String_Node_Str");
    return;
  }
  ModelControllerClient client=ctx.getModelControllerClient();
  final ModelNode result;
  try {
    result=client.execute(request);
  }
 catch (  Exception e) {
    ctx.printLine("String_Node_Str" + e.getLocalizedMessage());
    return;
  }
  if (!Util.isSuccess(result)) {
    ctx.printLine(Util.getFailureDescription(result));
    return;
  }
}

Fixed version (ground truth):
@Override protected void doHandle(CommandContext ctx) throws CommandFormatException {
  ModelNode request;
  try {
    request=buildRequest(ctx);
  }
 catch (  CommandFormatException e1) {
    ctx.printLine(e1.getLocalizedMessage());
    return;
  }
  if (request == null) {
    ctx.printLine("String_Node_Str");
    return;
  }
  NewModelControllerClient client=ctx.getModelControllerClient();
  final ModelNode result;
  try {
    result=client.execute(request);
  }
 catch (  Exception e) {
    ctx.printLine("String_Node_Str" + e.getLocalizedMessage());
    return;
  }
  if (!Util.isSuccess(result)) {
    ctx.printLine(Util.getFailureDescription(result));
    return;
  }
}
Program: 167923
Project: 167923
Buggy source:
public ValueCompleter(final String attrName){
  super(new CandidatesProvider(){
    @Override public List<String> getAllCandidates(    CommandContext ctx){
      ModelControllerClient client=ctx.getModelControllerClient();
      if (client == null) {
        return Collections.emptyList();
      }
      DefaultOperationRequestBuilder builder=new DefaultOperationRequestBuilder();
      if (ctx.isDomainMode()) {
        final String profileName=profile.getValue(ctx.getParsedArguments());
        if (profileName == null) {
          return Collections.emptyList();
        }
        builder.addNode("String_Node_Str",profileName);
      }
      builder.addNode("String_Node_Str","String_Node_Str");
      final String dsName=jndiName.getValue(ctx.getParsedArguments());
      if (dsName == null) {
        return Collections.emptyList();
      }
      builder.addNode(dsType,dsName);
      builder.setOperationName("String_Node_Str");
      builder.addProperty("String_Node_Str",attrName);
      try {
        ModelNode result=client.execute(builder.buildRequest());
        if (!result.hasDefined("String_Node_Str"))         return Collections.emptyList();
        return Collections.singletonList(result.get("String_Node_Str").asString());
      }
 catch (      Exception e) {
        return Collections.emptyList();
      }
    }
  }
);
}

Fixed version (ground truth):
public ValueCompleter(final String attrName){
  super(new CandidatesProvider(){
    @Override public List<String> getAllCandidates(    CommandContext ctx){
      NewModelControllerClient client=ctx.getModelControllerClient();
      if (client == null) {
        return Collections.emptyList();
      }
      DefaultOperationRequestBuilder builder=new DefaultOperationRequestBuilder();
      if (ctx.isDomainMode()) {
        final String profileName=profile.getValue(ctx.getParsedArguments());
        if (profileName == null) {
          return Collections.emptyList();
        }
        builder.addNode("String_Node_Str",profileName);
      }
      builder.addNode("String_Node_Str","String_Node_Str");
      final String dsName=jndiName.getValue(ctx.getParsedArguments());
      if (dsName == null) {
        return Collections.emptyList();
      }
      builder.addNode(dsType,dsName);
      builder.setOperationName("String_Node_Str");
      builder.addProperty("String_Node_Str",attrName);
      try {
        ModelNode result=client.execute(builder.buildRequest());
        if (!result.hasDefined("String_Node_Str"))         return Collections.emptyList();
        return Collections.singletonList(result.get("String_Node_Str").asString());
      }
 catch (      Exception e) {
        return Collections.emptyList();
      }
    }
  }
);
}
Program: 167924
Project: 167924
Buggy source:
@Override public List<String> getAllCandidates(CommandContext ctx){
  ModelControllerClient client=ctx.getModelControllerClient();
  if (client == null) {
    return Collections.emptyList();
  }
  DefaultOperationRequestBuilder builder=new DefaultOperationRequestBuilder();
  if (ctx.isDomainMode()) {
    final String profileName=profile.getValue(ctx.getParsedArguments());
    if (profileName == null) {
      return Collections.emptyList();
    }
    builder.addNode("String_Node_Str",profileName);
  }
  builder.addNode("String_Node_Str","String_Node_Str");
  final String dsName=jndiName.getValue(ctx.getParsedArguments());
  if (dsName == null) {
    return Collections.emptyList();
  }
  builder.addNode(dsType,dsName);
  builder.setOperationName("String_Node_Str");
  builder.addProperty("String_Node_Str",attrName);
  try {
    ModelNode result=client.execute(builder.buildRequest());
    if (!result.hasDefined("String_Node_Str"))     return Collections.emptyList();
    return Collections.singletonList(result.get("String_Node_Str").asString());
  }
 catch (  Exception e) {
    return Collections.emptyList();
  }
}

Fixed version (ground truth):
@Override public List<String> getAllCandidates(CommandContext ctx){
  NewModelControllerClient client=ctx.getModelControllerClient();
  if (client == null) {
    return Collections.emptyList();
  }
  DefaultOperationRequestBuilder builder=new DefaultOperationRequestBuilder();
  if (ctx.isDomainMode()) {
    final String profileName=profile.getValue(ctx.getParsedArguments());
    if (profileName == null) {
      return Collections.emptyList();
    }
    builder.addNode("String_Node_Str",profileName);
  }
  builder.addNode("String_Node_Str","String_Node_Str");
  final String dsName=jndiName.getValue(ctx.getParsedArguments());
  if (dsName == null) {
    return Collections.emptyList();
  }
  builder.addNode(dsType,dsName);
  builder.setOperationName("String_Node_Str");
  builder.addProperty("String_Node_Str",attrName);
  try {
    ModelNode result=client.execute(builder.buildRequest());
    if (!result.hasDefined("String_Node_Str"))     return Collections.emptyList();
    return Collections.singletonList(result.get("String_Node_Str").asString());
  }
 catch (  Exception e) {
    return Collections.emptyList();
  }
}
Program: 167926
Project: 167926
Buggy source:
@Override public List<String> getAllCandidates(CommandContext ctx){
  ModelControllerClient client=ctx.getModelControllerClient();
  if (client == null) {
    return Collections.emptyList();
  }
  final String profileArg;
  if (!ctx.isDomainMode()) {
    profileArg=null;
  }
 else {
    profileArg=profile.getValue(ctx.getParsedArguments());
    if (profileArg == null) {
      return Collections.emptyList();
    }
  }
  return Util.getDatasources(ctx.getModelControllerClient(),profileArg,dsType);
}

Fixed version (ground truth):
@Override public List<String> getAllCandidates(CommandContext ctx){
  NewModelControllerClient client=ctx.getModelControllerClient();
  if (client == null) {
    return Collections.emptyList();
  }
  final String profileArg;
  if (!ctx.isDomainMode()) {
    profileArg=null;
  }
 else {
    profileArg=profile.getValue(ctx.getParsedArguments());
    if (profileArg == null) {
      return Collections.emptyList();
    }
  }
  return Util.getDatasources(ctx.getModelControllerClient(),profileArg,dsType);
}
Program: 167928
Project: 167928
Buggy source:
@Override public List<String> getAllCandidates(CommandContext ctx){
  ModelControllerClient client=ctx.getModelControllerClient();
  if (client == null) {
    return Collections.emptyList();
  }
  final String profileArg;
  if (!ctx.isDomainMode()) {
    profileArg=null;
  }
 else {
    profileArg=profile.getValue(ctx.getParsedArguments());
    if (profileArg == null) {
      return Collections.emptyList();
    }
  }
  return Util.getDatasources(ctx.getModelControllerClient(),profileArg,dsType);
}

Fixed version (ground truth):
@Override public List<String> getAllCandidates(CommandContext ctx){
  NewModelControllerClient client=ctx.getModelControllerClient();
  if (client == null) {
    return Collections.emptyList();
  }
  final String profileArg;
  if (!ctx.isDomainMode()) {
    profileArg=null;
  }
 else {
    profileArg=profile.getValue(ctx.getParsedArguments());
    if (profileArg == null) {
      return Collections.emptyList();
    }
  }
  return Util.getDatasources(ctx.getModelControllerClient(),profileArg,dsType);
}
Program: 167929
Project: 167929
Buggy source:
@Override public boolean canAppearNext(CommandContext ctx) throws CommandFormatException {
}

Fixed version (ground truth):
@Override public boolean canAppearNext(CommandContext ctx) throws CommandFormatException {
  if (ctx.isDomainMode() && !profile.isPresent(ctx.getParsedArguments())) {
    return false;
  }
  return super.canAppearNext(ctx);
}
Program: 167930
Project: 167930
Buggy source:
public JmsQueueAddHandler(){
}

Fixed version (ground truth):
public JmsQueueAddHandler(){
  super("String_Node_Str",true);
  profile=new ArgumentWithValue(this,new DefaultCompleter(new CandidatesProvider(){
    @Override public List<String> getAllCandidates(    CommandContext ctx){
      return Util.getNodeNames(ctx.getModelControllerClient(),null,"String_Node_Str");
    }
  }
),"String_Node_Str"){
    @Override public boolean canAppearNext(    CommandContext ctx) throws CommandFormatException {
      if (!ctx.isDomainMode()) {
        return false;
      }
      return super.canAppearNext(ctx);
    }
  }
;
  name=new ArgumentWithValue(this,"String_Node_Str"){
    @Override public boolean canAppearNext(    CommandContext ctx) throws CommandFormatException {
      if (ctx.isDomainMode() && !profile.isPresent(ctx.getParsedArguments())) {
        return false;
      }
      return super.canAppearNext(ctx);
    }
  }
;
  entries=new ArgumentWithValue(this,"String_Node_Str");
  entries.addRequiredPreceding(name);
  selector=new ArgumentWithValue(this,"String_Node_Str");
  selector.addRequiredPreceding(name);
  durable=new ArgumentWithValue(this,new SimpleTabCompleter(new String[]{"String_Node_Str","String_Node_Str"}),"String_Node_Str");
  durable.addRequiredPreceding(name);
}