nus-yam/ex-repair huggingface dataset:
Program: 161149
Project: 161149
Buggy source:
@Test public void lookup_mntner(){
  final WhoisResources whoisResources=RestTest.target(getPort(),"String_Node_Str").request().get(WhoisResources.class);
  assertThat(whoisResources.getErrorMessages(),is(nullValue()));
  assertThat(whoisResources.getWhoisObjects(),hasSize(1));
  final WhoisObject whoisObject=whoisResources.getWhoisObjects().get(0);
  assertThat(whoisObject.getAttributes(),contains(new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null)));
}

Fixed version (ground truth):
@Test public void lookup_mntner(){
  final WhoisResources whoisResources=RestTest.target(getPort(),"String_Node_Str").request().get(WhoisResources.class);
  assertThat(whoisResources.getErrorMessages(),is(nullValue()));
  assertThat(whoisResources.getWhoisObjects(),hasSize(1));
  final WhoisObject whoisObject=whoisResources.getWhoisObjects().get(0);
  assertThat(whoisObject.getAttributes(),contains(new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null)));
}
Program: 161151
Project: 161151
Buggy source:
@Test public void lookup_mntner_correct_password_filtered(){
  final WhoisResources whoisResources=RestTest.target(getPort(),"String_Node_Str").request().get(WhoisResources.class);
  assertThat(whoisResources.getErrorMessages(),is(nullValue()));
  assertThat(whoisResources.getWhoisObjects(),hasSize(1));
  final WhoisObject whoisObject=whoisResources.getWhoisObjects().get(0);
  assertThat(whoisObject.getAttributes(),contains(new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null)));
}

Fixed version (ground truth):
@Test public void lookup_mntner_correct_password_filtered(){
  final WhoisResources whoisResources=RestTest.target(getPort(),"String_Node_Str").request().get(WhoisResources.class);
  assertThat(whoisResources.getErrorMessages(),is(nullValue()));
  assertThat(whoisResources.getWhoisObjects(),hasSize(1));
  final WhoisObject whoisObject=whoisResources.getWhoisObjects().get(0);
  assertThat(whoisObject.getAttributes(),contains(new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null),new Attribute("String_Node_Str","String_Node_Str",null,null,null),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null)));
}
Program: 161152
Project: 161152
Buggy source:
@Test public void lookup_mntner_correct_password(){
  final WhoisResources whoisResources=RestTest.target(getPort(),"String_Node_Str").request().get(WhoisResources.class);
  assertThat(whoisResources.getErrorMessages(),is(nullValue()));
  assertThat(whoisResources.getWhoisObjects(),hasSize(1));
  final WhoisObject whoisObject=whoisResources.getWhoisObjects().get(0);
  assertThat(whoisObject.getAttributes(),contains(new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,null,null),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,null,null),new Attribute("String_Node_Str","String_Node_Str",null,null,null)));
}

Fixed version (ground truth):
@Test public void lookup_mntner_correct_password(){
  final WhoisResources whoisResources=RestTest.target(getPort(),"String_Node_Str").request().get(WhoisResources.class);
  assertThat(whoisResources.getErrorMessages(),is(nullValue()));
  assertThat(whoisResources.getWhoisObjects(),hasSize(1));
  final WhoisObject whoisObject=whoisResources.getWhoisObjects().get(0);
  assertThat(whoisObject.getAttributes(),contains(new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,null,null),new Attribute("String_Node_Str","String_Node_Str","String_Node_Str",null,null),new Attribute("String_Node_Str","String_Node_Str",null,null,null),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,"String_Node_Str",new Link("String_Node_Str","String_Node_Str")),new Attribute("String_Node_Str","String_Node_Str",null,null,null),new Attribute("String_Node_Str","String_Node_Str",null,null,null)));
}
Program: 161153
Project: 161153
Buggy source:
public String toString(){
  if (StringUtils.isBlank(comment)) {
    return String.format("String_Node_Str",name,value);
  }
 else {
    return String.format("String_Node_Str",name,value,comment);
  }
}

Fixed version (ground truth):
public String toString(){
  StringBuilder builder=new StringBuilder();
  builder.append(name).append("String_Node_Str").append(value);
  if (!StringUtils.isBlank(comment)) {
    builder.append("String_Node_Str").append(comment);
  }
  if (!StringUtils.isBlank(referencedType)) {
    builder.append("String_Node_Str").append(referencedType).append("String_Node_Str");
  }
  if (link != null) {
    builder.append("String_Node_Str").append(link).append("String_Node_Str");
  }
  return builder.toString();
}
Program: 161154
Project: 161154
Buggy source:
public FilterAuthFunction(){
  passwords=Collections.emptyList();
  cookie=null;
}

Fixed version (ground truth):
public FilterAuthFunction(){
}
Program: 161155
Project: 161155
Buggy source:
@Override public RpslObject apply(RpslObject rpslObject){
  if (!rpslObject.containsAttribute(AttributeType.AUTH)) {
    return rpslObject;
  }
  Map<RpslAttribute,RpslAttribute> replace=Maps.newHashMap();
  for (  RpslAttribute auth : rpslObject.findAttributes(AttributeType.AUTH)) {
    CIString authValue=auth.getCleanValue();
    Iterator<String> authIterator=SPACE_SPLITTER.split(authValue).iterator();
    String passwordType=authIterator.next().toUpperCase();
    if (passwordType.endsWith("String_Node_Str")) {
      if (passwords.isEmpty() || !passwordType.startsWith("String_Node_Str") || !PasswordHelper.authenticateMd5Passwords(authValue.toString(),passwords)) {
        replace.put(auth,new RpslAttribute(auth.getKey(),passwordType + FILTERED_APPENDIX));
      }
    }
 else     if (passwordType.equals("String_Node_Str")) {
      String replacement=FILTERED_APPENDIX;
      if (cookie != null) {
        final String username=checkCookieAgainstUuidAndReturnUsername(cookie,authIterator.next());
        if (username != null) {
          replacement=username;
        }
      }
      replace.put(auth,new RpslAttribute(auth.getKey(),passwordType + replacement));
    }
  }
  if (replace.isEmpty()) {
    return rpslObject;
  }
 else {
    RpslObjectFilter.addFilteredSourceReplacement(rpslObject,replace);
    return new RpslObjectBuilder(rpslObject).replaceAttributes(replace).get();
  }
}

Fixed version (ground truth):
@Override public RpslObject apply(RpslObject rpslObject){
  if (!rpslObject.containsAttribute(AttributeType.AUTH)) {
    return rpslObject;
  }
  Map<RpslAttribute,RpslAttribute> replace=Maps.newHashMap();
  List<RpslAttribute> authAttributes=rpslObject.findAttributes(AttributeType.AUTH);
  boolean authenticated=passwordAuthentication(passwords,authAttributes) || ssoAuthentication(cookie,authAttributes);
  for (  RpslAttribute authAttribute : authAttributes) {
    Iterator<String> authIterator=SPACE_SPLITTER.split(authAttribute.getCleanValue()).iterator();
    String passwordType=authIterator.next().toUpperCase();
    if (authenticated) {
      if (passwordType.equals("String_Node_Str")) {
        final String username=crowdClient.getUsername(authIterator.next());
        replace.put(authAttribute,new RpslAttribute(authAttribute.getKey(),"String_Node_Str" + username));
      }
    }
 else {
      if (passwordType.endsWith("String_Node_Str") || passwordType.equals("String_Node_Str")) {
        replace.put(authAttribute,new RpslAttribute(authAttribute.getKey(),passwordType + FILTERED_APPENDIX));
      }
    }
  }
  if (replace.isEmpty()) {
    return rpslObject;
  }
 else {
    if (!authenticated) {
      RpslObjectFilter.addFilteredSourceReplacement(rpslObject,replace);
    }
    return new RpslObjectBuilder(rpslObject).replaceAttributes(replace).get();
  }
}
Program: 161156
Project: 161156
Buggy source:
public Map<RpslObject,RpslObjectUpdateInfo> addObjects(final Collection<RpslObject> rpslObjects){
  final Map<RpslObject,RpslObjectUpdateInfo> transformedInfoMap=Maps.newHashMap();
  final Map<RpslObject,RpslObjectUpdateInfo> updateInfoMap=Maps.newHashMap();
  for (  final RpslObject rpslObject : rpslObjects) {
    RpslObject transformedObject=attributeSanitizer.sanitize(rpslObject,new ObjectMessages());
    final RpslObjectUpdateInfo updateInfo=addObjectWithoutReferences(transformedObject,rpslObjectUpdateDao);
    updateInfoMap.put(rpslObject,updateInfo);
    transformedInfoMap.put(transformedObject,updateInfo);
  }
  for (  RpslObject transformedObject : transformedInfoMap.keySet()) {
    rpslObjectUpdateDao.updateObject(transformedInfoMap.get(transformedObject).getObjectId(),transformedObject);
  }
  return updateInfoMap;
}

Fixed version (ground truth):
public Map<RpslObject,RpslObjectUpdateInfo> addObjects(final Collection<RpslObject> rpslObjects){
  final Map<RpslObject,RpslObjectUpdateInfo> transformedInfoMap=Maps.newHashMap();
  final Map<RpslObject,RpslObjectUpdateInfo> updateInfoMap=Maps.newHashMap();
  for (  final RpslObject rpslObject : rpslObjects) {
    RpslObject transformedObject=attributeSanitizer.sanitize(rpslObject,new ObjectMessages());
    transformedObject=translateAuth(transformedObject);
    final RpslObjectUpdateInfo updateInfo=addObjectWithoutReferences(transformedObject,rpslObjectUpdateDao);
    updateInfoMap.put(rpslObject,updateInfo);
    transformedInfoMap.put(transformedObject,updateInfo);
  }
  for (  RpslObject transformedObject : transformedInfoMap.keySet()) {
    rpslObjectUpdateDao.updateObject(transformedInfoMap.get(transformedObject).getObjectId(),transformedObject);
  }
  return updateInfoMap;
}
Program: 161157
Project: 161157
Buggy source:
public RpslObject addObject(final RpslObject rpslObject){
  final RpslObjectUpdateInfo objectUpdateInfo=rpslObjectUpdateDao.createObject(rpslObject);
  return RpslObject.parse(objectUpdateInfo.getObjectId(),rpslObject.toByteArray());
}

Fixed version (ground truth):
public RpslObject addObject(final RpslObject rpslObject){
  final RpslObjectUpdateInfo objectUpdateInfo=rpslObjectUpdateDao.createObject(translateAuth(rpslObject));
  return RpslObject.parse(objectUpdateInfo.getObjectId(),rpslObject.toByteArray());
}
Program: 161158
Project: 161158
Buggy source:
private StreamingMarshal getStreamingMarshal(final HttpServletRequest request){
  final String acceptHeader=request.getHeader(HttpHeaders.ACCEPT);
  for (  final String accept : Splitter.on(',').split(acceptHeader)) {
    try {
      final MediaType mediaType=MediaType.valueOf(accept);
      final String subtype=mediaType.getSubtype().toLowerCase();
      if (subtype.equals("String_Node_Str") || subtype.endsWith("String_Node_Str")) {
        return new StreamingMarshalJson();
      }
 else       if (subtype.equals("String_Node_Str") || subtype.endsWith("String_Node_Str")) {
        return new StreamingMarshalXml();
      }
    }
 catch (    IllegalArgumentException ignored) {
    }
  }
  return new StreamingMarshalXml();
}

Fixed version (ground truth):
StreamingMarshal getStreamingMarshal(final HttpServletRequest request){
  final String acceptHeader=request.getHeader(HttpHeaders.ACCEPT);
  if (acceptHeader != null) {
    for (    final String accept : Splitter.on(',').split(acceptHeader)) {
      try {
        final MediaType mediaType=MediaType.valueOf(accept);
        final String subtype=mediaType.getSubtype().toLowerCase();
        if (subtype.equals("String_Node_Str") || subtype.endsWith("String_Node_Str")) {
          return new StreamingMarshalJson();
        }
 else         if (subtype.equals("String_Node_Str") || subtype.endsWith("String_Node_Str")) {
          return new StreamingMarshalXml();
        }
      }
 catch (      IllegalArgumentException ignored) {
      }
    }
  }
  return new StreamingMarshalXml();
}
Program: 161159
Project: 161159
Buggy source:
public void setErrorMessages(List<ErrorMessage> errorMessages){
  this.errorMessages=new ErrorMessages(errorMessages);
}

Fixed version (ground truth):
public void setErrorMessages(List<ErrorMessage> errorMessages){
  if (!CollectionUtils.isEmpty(errorMessages)) {
    this.errorMessages=new ErrorMessages(errorMessages);
  }
}
Program: 161160
Project: 161160
Buggy source:
@Override public RpslObject apply(RpslObject rpslObject){
  if (!rpslObject.containsAttribute(AttributeType.AUTH)) {
    return rpslObject;
  }
  Map<RpslAttribute,RpslAttribute> replace=Maps.newHashMap();
  for (  RpslAttribute auth : rpslObject.findAttributes(AttributeType.AUTH)) {
    CIString authValue=auth.getCleanValue();
    Iterator<String> authIterator=SPACE_SPLITTER.split(authValue.toUpperCase()).iterator();
    String passwordType=authIterator.next();
    if (passwordType.endsWith("String_Node_Str")) {
      if (passwords.isEmpty() || !passwordType.startsWith("String_Node_Str") || !PasswordHelper.authenticateMd5Passwords(authValue.toString(),passwords)) {
        replace.put(auth,new RpslAttribute(auth.getKey(),passwordType + FILTERED_APPENDIX));
      }
    }
 else     if (passwordType.equals("String_Node_Str")) {
      String replacement=FILTERED_APPENDIX;
      if (cookie != null) {
        final String username=checkCookieAgainstUuidAndReturnUsername(cookie,authIterator.next());
        if (username != null) {
          replacement=username;
        }
      }
      replace.put(auth,new RpslAttribute(auth.getKey(),passwordType + replacement));
    }
  }
  if (replace.isEmpty()) {
    return rpslObject;
  }
 else {
    RpslObjectFilter.addFilteredSourceReplacement(rpslObject,replace);
    return new RpslObjectBuilder(rpslObject).replaceAttributes(replace).get();
  }
}

Fixed version (ground truth):
@Override public RpslObject apply(RpslObject rpslObject){
  if (!rpslObject.containsAttribute(AttributeType.AUTH)) {
    return rpslObject;
  }
  Map<RpslAttribute,RpslAttribute> replace=Maps.newHashMap();
  for (  RpslAttribute auth : rpslObject.findAttributes(AttributeType.AUTH)) {
    CIString authValue=auth.getCleanValue();
    Iterator<String> authIterator=SPACE_SPLITTER.split(authValue).iterator();
    String passwordType=authIterator.next().toUpperCase();
    if (passwordType.endsWith("String_Node_Str")) {
      if (passwords.isEmpty() || !passwordType.startsWith("String_Node_Str") || !PasswordHelper.authenticateMd5Passwords(authValue.toString(),passwords)) {
        replace.put(auth,new RpslAttribute(auth.getKey(),passwordType + FILTERED_APPENDIX));
      }
    }
 else     if (passwordType.equals("String_Node_Str")) {
      String replacement=FILTERED_APPENDIX;
      if (cookie != null) {
        final String username=checkCookieAgainstUuidAndReturnUsername(cookie,authIterator.next());
        if (username != null) {
          replacement=username;
        }
      }
      replace.put(auth,new RpslAttribute(auth.getKey(),passwordType + replacement));
    }
  }
  if (replace.isEmpty()) {
    return rpslObject;
  }
 else {
    RpslObjectFilter.addFilteredSourceReplacement(rpslObject,replace);
    return new RpslObjectBuilder(rpslObject).replaceAttributes(replace).get();
  }
}
Program: 161161
Project: 161161
Buggy source:
public void populate(Update update,UpdateContext updateContext){
  RpslObject submittedObject=update.getSubmittedObject();
  if (!ObjectType.MNTNER.equals(submittedObject.getType())) {
    return;
  }
  for (  RpslAttribute auth : submittedObject.findAttributes(AttributeType.AUTH)) {
    CIString authValue=auth.getCleanValue();
    Iterator<String> authIterator=SPACE_SPLITTER.split(authValue.toUpperCase()).iterator();
    String passwordType=authIterator.next();
    if (passwordType.equals("String_Node_Str")) {
      getUuidForUsername(updateContext,authIterator.next());
    }
  }
}

Fixed version (ground truth):
public void populate(Update update,UpdateContext updateContext){
  RpslObject submittedObject=update.getSubmittedObject();
  if (!ObjectType.MNTNER.equals(submittedObject.getType())) {
    return;
  }
  for (  RpslAttribute auth : submittedObject.findAttributes(AttributeType.AUTH)) {
    CIString authValue=auth.getCleanValue();
    Iterator<String> authIterator=SPACE_SPLITTER.split(authValue).iterator();
    String passwordType=authIterator.next();
    if (passwordType.equalsIgnoreCase("String_Node_Str")) {
      getUuidForUsername(updateContext,authIterator.next());
    }
  }
}
Program: 161162
Project: 161162
Buggy source:
private WhoisResources createResponse(final HttpServletRequest request,UpdateContext updateContext,Update update,RpslObject responseObject){
  final WhoisResources whoisResources=new WhoisResources();
  List<ErrorMessage> errorMessages=Lists.newArrayList();
  for (  Message message : updateContext.getGlobalMessages().getAllMessages()) {
    errorMessages.add(new ErrorMessage(message));
  }
  for (  Message message : updateContext.getMessages(update).getMessages().getAllMessages()) {
    errorMessages.add(new ErrorMessage(message));
  }
  for (  Map.Entry<RpslAttribute,Messages> entry : updateContext.getMessages(update).getAttributeMessages().entrySet()) {
    RpslAttribute rpslAttribute=entry.getKey();
    for (    Message message : entry.getValue().getAllMessages()) {
      errorMessages.add(new ErrorMessage(message,rpslAttribute));
    }
  }
  whoisResources.setErrorMessages(errorMessages);
  whoisResources.setWhoisObjects(Collections.singletonList(whoisObjectMapper.map(responseObject)));
  whoisResources.setLink(new Link("String_Node_Str",RestServiceHelper.getRequestURL(request).replaceFirst("String_Node_Str","String_Node_Str")));
  whoisResources.includeTermsAndConditions();
  return whoisResources;
}

Fixed version (ground truth):
private WhoisResources createResponse(final HttpServletRequest request,UpdateContext updateContext,Update update,RpslObject responseObject){
  final WhoisResources whoisResources=new WhoisResources();
  List<ErrorMessage> errorMessages=Lists.newArrayList();
  for (  Message message : updateContext.getGlobalMessages().getAllMessages()) {
    errorMessages.add(new ErrorMessage(message));
  }
  for (  Message message : updateContext.getMessages(update).getMessages().getAllMessages()) {
    errorMessages.add(new ErrorMessage(message));
  }
  for (  Map.Entry<RpslAttribute,Messages> entry : updateContext.getMessages(update).getAttributeMessages().entrySet()) {
    RpslAttribute rpslAttribute=entry.getKey();
    for (    Message message : entry.getValue().getAllMessages()) {
      errorMessages.add(new ErrorMessage(message,rpslAttribute));
    }
  }
  if (!errorMessages.isEmpty()) {
    whoisResources.setErrorMessages(errorMessages);
  }
  whoisResources.setWhoisObjects(Collections.singletonList(whoisObjectMapper.map(responseObject)));
  whoisResources.setLink(new Link("String_Node_Str",RestServiceHelper.getRequestURL(request).replaceFirst("String_Node_Str","String_Node_Str")));
  whoisResources.includeTermsAndConditions();
  return whoisResources;
}
Program: 161163
Project: 161163
Buggy source:
@Test public void lookup_person_acl_denied() throws Exception {
  try {
    databaseHelper.insertAclIpDenied(LOCALHOST_WITH_PREFIX);
    ipResourceConfiguration.reload();
    try {
      RestTest.target(getPort(),"String_Node_Str").request().get(String.class);
      fail();
    }
 catch (    ClientErrorException e) {
      assertThat(e.getResponse().getStatus(),is(429));
      assertThat(e.getResponse().readEntity(String.class),containsString("String_Node_Str"));
    }
  }
  finally {
    databaseHelper.unban(LOCALHOST_WITH_PREFIX);
    ipResourceConfiguration.reload();
    testPersonalObjectAccounting.resetAccounting();
  }
}

Fixed version (ground truth):
@Test public void lookup_person_acl_denied() throws Exception {
  try {
    databaseHelper.insertAclIpDenied(LOCALHOST_WITH_PREFIX);
    ipResourceConfiguration.reload();
    try {
      RestTest.target(getPort(),"String_Node_Str").request().get(String.class);
      fail();
    }
 catch (    ClientErrorException e) {
      assertThat(e.getResponse().getStatus(),is(429));
      WhoisRestServiceTestIntegration.assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
    }
  }
  finally {
    databaseHelper.unban(LOCALHOST_WITH_PREFIX);
    ipResourceConfiguration.reload();
    testPersonalObjectAccounting.resetAccounting();
  }
}
Program: 161164
Project: 161164
Buggy source:
private void assertErrorMessage(final ClientErrorException e,final String severity,final String text,final String... argument){
  WhoisResources whoisResources=e.getResponse().readEntity(WhoisResources.class);
  assertThat(whoisResources.getErrorMessages(),hasSize(1));
  assertThat(whoisResources.getErrorMessages().get(0).getText(),is(text));
  assertThat(whoisResources.getErrorMessages().get(0).getSeverity(),is(severity));
  assertThat(whoisResources.getErrorMessages().get(0).getArgs(),hasSize(argument.length));
  for (int i=0; i < argument.length; i++) {
    assertThat(whoisResources.getErrorMessages().get(0).getArgs().get(i).getValue(),is(argument[i]));
  }
}

Fixed version (ground truth):
static void assertErrorMessage(final WhoisResources whoisResources,final int number,final String severity,final String text,final String... argument){
  assertThat(whoisResources.getErrorMessages().get(number).getText(),is(text));
  assertThat(whoisResources.getErrorMessages().get(number).getSeverity(),is(severity));
  if (argument.length > 0) {
    assertThat(whoisResources.getErrorMessages().get(number).getArgs(),hasSize(argument.length));
    for (int i=0; i < argument.length; i++) {
      assertThat(whoisResources.getErrorMessages().get(number).getArgs().get(i).getValue(),is(argument[i]));
    }
  }
}
Program: 161165
Project: 161165
Buggy source:
@Test public void create_already_exists(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(OWNER_MNT)),MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  ClientErrorException e) {
    assertThat(e.getResponse().getStatus(),is(HttpURLConnection.HTTP_CONFLICT));
    assertThat(e.getResponse().readEntity(String.class),containsString("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void create_already_exists(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(OWNER_MNT)),MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str");
  }
}
Program: 161166
Project: 161166
Buggy source:
@Test public void create_invalid_source_in_request_body(){
  final RpslObject rpslObject=RpslObject.parse("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(rpslObject)),MediaType.APPLICATION_XML),String.class);
    fail("String_Node_Str");
  }
 catch (  BadRequestException e) {
    assertThat(e.getResponse().readEntity(String.class),containsString("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void create_invalid_source_in_request_body(){
  final RpslObject rpslObject=RpslObject.parse("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(rpslObject)),MediaType.APPLICATION_XML),String.class);
    fail("String_Node_Str");
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161167
Project: 161167
Buggy source:
@Test public void create_invalid_password(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(PAULETH_PALTHEN)),MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void create_invalid_password(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(PAULETH_PALTHEN)),MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161168
Project: 161168
Buggy source:
@Test public void grs_lookup_object_wrong_source(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().get(String.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void grs_lookup_object_wrong_source(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().get(String.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161169
Project: 161169
Buggy source:
@Test public void delete_invalid_password(){
  try {
    databaseHelper.addObject(PAULETH_PALTHEN);
    RestTest.target(getPort(),"String_Node_Str").request().delete(String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertThat(e.getResponse().readEntity(String.class),containsString("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void delete_invalid_password(){
  try {
    databaseHelper.addObject(PAULETH_PALTHEN);
    RestTest.target(getPort(),"String_Node_Str").request().delete(String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161170
Project: 161170
Buggy source:
@Test public void create_no_password(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(PAULETH_PALTHEN)),MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertThat(e.getResponse().readEntity(String.class),containsString("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void create_no_password(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(PAULETH_PALTHEN)),MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161171
Project: 161171
Buggy source:
@Test public void delete_no_password(){
  try {
    databaseHelper.addObject(PAULETH_PALTHEN);
    RestTest.target(getPort(),"String_Node_Str").request().delete(String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertThat(e.getResponse().readEntity(String.class),containsString("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void delete_no_password(){
  try {
    databaseHelper.addObject(PAULETH_PALTHEN);
    RestTest.target(getPort(),"String_Node_Str").request().delete(String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161172
Project: 161172
Buggy source:
@Test public void search_invalid_flag(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void search_invalid_flag(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161173
Project: 161173
Buggy source:
@Test public void delete_referenced_from_other_objects(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().delete(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void delete_referenced_from_other_objects(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().delete(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161174
Project: 161174
Buggy source:
@Test public void search_invalid_source(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void search_invalid_source(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161175
Project: 161175
Buggy source:
@Test public void create_invalid_reference(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertThat(e.getResponse().readEntity(String.class),containsString("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void create_invalid_reference(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  BadRequestException e) {
    WhoisResources whoisResources=mapClientException(e);
    assertErrorMessage(whoisResources,0,"String_Node_Str","String_Node_Str","String_Node_Str");
    assertErrorMessage(whoisResources,1,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161176
Project: 161176
Buggy source:
@Test public void search_with_short_and_long_options_together(){
  databaseHelper.addObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertThat(e.getResponse().readEntity(String.class),is("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void search_with_short_and_long_options_together(){
  databaseHelper.addObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161177
Project: 161177
Buggy source:
@Test public void search_multiple_sources(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void search_multiple_sources(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161178
Project: 161178
Buggy source:
@Test public void search_invalid_flags(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertThat(e.getResponse().readEntity(String.class),is("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void search_invalid_flags(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertOnlyErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161181
Project: 161181
Buggy source:
public Response performUpdate(final Origin origin,final Update update,final String content,final Keyword keyword,final LoggerContext loggerContext,final HttpServletRequest request){
  loggerContext.init(getRequestId(origin.getFrom()));
  try {
    final UpdateContext updateContext=new UpdateContext(loggerContext);
    final boolean notificationsEnabled=true;
    logHttpHeaders(loggerContext,request);
    final UpdateRequest updateRequest=new UpdateRequest(origin,keyword,content,Lists.newArrayList(update),notificationsEnabled);
    final UpdateResponse response=updateRequestHandler.handle(updateRequest,updateContext);
    final RpslObject responseObject=updateContext.getPreparedUpdate(update).getUpdatedObject();
    Response.ResponseBuilder responseBuilder=response.getStatus() != UpdateStatus.SUCCESS ? Response.status(Response.Status.BAD_REQUEST) : Response.status(Response.Status.OK);
    responseBuilder.entity(createResponse(request,updateContext,update,responseObject));
    return responseBuilder.build();
  }
  finally {
    loggerContext.remove();
  }
}

Fixed version (ground truth):
public Response performUpdate(final Origin origin,final Update update,final String content,final Keyword keyword,final LoggerContext loggerContext,final HttpServletRequest request){
  loggerContext.init(getRequestId(origin.getFrom()));
  try {
    final UpdateContext updateContext=new UpdateContext(loggerContext);
    final boolean notificationsEnabled=true;
    logHttpHeaders(loggerContext,request);
    final UpdateRequest updateRequest=new UpdateRequest(origin,keyword,content,Lists.newArrayList(update),notificationsEnabled);
    updateRequestHandler.handle(updateRequest,updateContext);
    final RpslObject responseObject=updateContext.getPreparedUpdate(update).getUpdatedObject();
    Response.ResponseBuilder responseBuilder;
    UpdateStatus status=updateContext.getStatus(update);
    if (status == UpdateStatus.FAILED_AUTHENTICATION) {
      responseBuilder=Response.status(Response.Status.UNAUTHORIZED);
    }
 else     if (status == UpdateStatus.EXCEPTION) {
      responseBuilder=Response.status(Response.Status.INTERNAL_SERVER_ERROR);
    }
 else     if (status != UpdateStatus.SUCCESS) {
      responseBuilder=Response.status(Response.Status.BAD_REQUEST);
    }
 else {
      responseBuilder=Response.status(Response.Status.OK);
    }
    responseBuilder.entity(createResponse(request,updateContext,update,responseObject));
    return responseBuilder.build();
  }
  finally {
    loggerContext.remove();
  }
}
Program: 161182
Project: 161182
Buggy source:
private void assertErrorMessage(final WhoisResources whoisResources,final String text,final String severity,final String... argument){
  assertThat(whoisResources.getErrorMessages(),hasSize(1));
  assertThat(whoisResources.getErrorMessages().get(0).getText(),is(text));
  assertThat(whoisResources.getErrorMessages().get(0).getSeverity(),is(severity));
  assertThat(whoisResources.getErrorMessages().get(0).getArgs(),hasSize(argument.length));
  for (int i=0; i < argument.length; i++) {
    assertThat(whoisResources.getErrorMessages().get(0).getArgs().get(i).getValue(),is(argument[i]));
  }
}

Fixed version (ground truth):
private void assertErrorMessage(final ClientErrorException e,final String severity,final String text,final String... argument){
  WhoisResources whoisResources=e.getResponse().readEntity(WhoisResources.class);
  assertThat(whoisResources.getErrorMessages(),hasSize(1));
  assertThat(whoisResources.getErrorMessages().get(0).getText(),is(text));
  assertThat(whoisResources.getErrorMessages().get(0).getSeverity(),is(severity));
  assertThat(whoisResources.getErrorMessages().get(0).getArgs(),hasSize(argument.length));
  for (int i=0; i < argument.length; i++) {
    assertThat(whoisResources.getErrorMessages().get(0).getArgs().get(i).getValue(),is(argument[i]));
  }
}
Program: 161183
Project: 161183
Buggy source:
@Test public void create_invalid_password(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(PAULETH_PALTHEN)),MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertThat(e.getResponse().readEntity(String.class),containsString("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void create_invalid_password(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().post(Entity.entity(whoisObjectMapper.mapRpslObjects(Arrays.asList(PAULETH_PALTHEN)),MediaType.APPLICATION_XML),String.class);
    fail();
  }
 catch (  NotAuthorizedException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161184
Project: 161184
Buggy source:
@Test public void grs_lookup_object_wrong_source(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().get(String.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e.getResponse().readEntity(WhoisResources.class),"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void grs_lookup_object_wrong_source(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().get(String.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161185
Project: 161185
Buggy source:
@Test public void search_invalid_flag(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e.getResponse().readEntity(WhoisResources.class),"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void search_invalid_flag(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161186
Project: 161186
Buggy source:
@Test public void delete_referenced_from_other_objects(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().delete(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e.getResponse().readEntity(WhoisResources.class),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void delete_referenced_from_other_objects(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request().delete(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161187
Project: 161187
Buggy source:
@Test public void search_invalid_source(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e.getResponse().readEntity(WhoisResources.class),"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void search_invalid_source(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161188
Project: 161188
Buggy source:
@Test public void search_multiple_sources(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e.getResponse().readEntity(WhoisResources.class),"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void search_multiple_sources(){
  try {
    RestTest.target(getPort(),"String_Node_Str").request(MediaType.APPLICATION_XML).get(WhoisResources.class);
    fail();
  }
 catch (  BadRequestException e) {
    assertErrorMessage(e,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 161189
Project: 161189
Buggy source:
private WhoisResources createResponse(final HttpServletRequest request,UpdateContext updateContext,Update update,RpslObject responseObject){
  final WhoisResources whoisResources=new WhoisResources();
  ErrorMessages errorMessages=new ErrorMessages();
  for (  Message message : updateContext.getGlobalMessages().getAllMessages()) {
    errorMessages.addErrorMessage(new ErrorMessage(message));
  }
  for (  Map.Entry<RpslAttribute,Messages> entry : updateContext.getMessages(update).getAttributeMessages().entrySet()) {
    RpslAttribute rpslAttribute=entry.getKey();
    for (    Message message : entry.getValue().getAllMessages()) {
      errorMessages.addErrorMessage(new ErrorMessage(message,rpslAttribute));
    }
  }
  whoisResources.setErrorMessages(errorMessages);
  whoisResources.setWhoisObjects(Collections.singletonList(whoisObjectMapper.map(responseObject)));
  whoisResources.setLink(new Link("String_Node_Str",RestServiceHelper.getRequestURL(request).replaceFirst("String_Node_Str","String_Node_Str")));
  whoisResources.includeTermsAndConditions();
  return whoisResources;
}

Fixed version (ground truth):
private WhoisResources createResponse(final HttpServletRequest request,UpdateContext updateContext,Update update,RpslObject responseObject){
  final WhoisResources whoisResources=new WhoisResources();
  ErrorMessages errorMessages=new ErrorMessages();
  for (  Message message : updateContext.getGlobalMessages().getAllMessages()) {
    errorMessages.addErrorMessage(new ErrorMessage(message));
  }
  for (  Message message : updateContext.getMessages(update).getMessages().getAllMessages()) {
    errorMessages.addErrorMessage(new ErrorMessage(message));
  }
  for (  Map.Entry<RpslAttribute,Messages> entry : updateContext.getMessages(update).getAttributeMessages().entrySet()) {
    RpslAttribute rpslAttribute=entry.getKey();
    for (    Message message : entry.getValue().getAllMessages()) {
      errorMessages.addErrorMessage(new ErrorMessage(message,rpslAttribute));
    }
  }
  whoisResources.setErrorMessages(errorMessages);
  whoisResources.setWhoisObjects(Collections.singletonList(whoisObjectMapper.map(responseObject)));
  whoisResources.setLink(new Link("String_Node_Str",RestServiceHelper.getRequestURL(request).replaceFirst("String_Node_Str","String_Node_Str")));
  whoisResources.includeTermsAndConditions();
  return whoisResources;
}