nus-yam/ex-repair huggingface dataset:
Program: 161039
Project: 161039
Buggy source:
public StreamingOutput streamVersions(final String key,final ObjectType type,final String source,final HttpServletRequest request){
  return new StreamingOutput(){
    @Override public void write(    final OutputStream output) throws IOException, WebApplicationException {
      final StreamingMarshal marshal=StreamingHelper.getStreamingMarshal(request,output);
      final VersionsStreamHandler versionsStreamHandler=new VersionsStreamHandler(marshal,source,versionObjectMapper);
      objectReferenceDao.streamVersions(key,type,versionsStreamHandler);
      if (!versionsStreamHandler.flushHasStreamedObjects()) {
        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).entity(notFoundWhoisInternalResources(request,InternalMessages.noVersion(key))).build());
      }
    }
  }
;
}

Fixed version (ground truth):
public StreamingOutput streamVersions(final String key,final ObjectType type,final String source,final HttpServletRequest request){
  return new StreamingOutput(){
    @Override public void write(    final OutputStream output) throws IOException, WebApplicationException {
      final StreamingMarshal marshal=StreamingHelper.getStreamingMarshal(request,output);
      final VersionsStreamHandler versionsStreamHandler=new VersionsStreamHandler(marshal,source,versionObjectMapper);
      objectReferenceDao.streamVersions(key,type,versionsStreamHandler);
      if (!versionsStreamHandler.flushHasStreamedObjects()) {
        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).entity(notFoundWhoisInternalResources(request,InternalMessages.noVersions(key))).build());
      }
    }
  }
;
}
Program: 161040
Project: 161040
Buggy source:
@Override public void write(final OutputStream output) throws IOException, WebApplicationException {
  final StreamingMarshal marshal=StreamingHelper.getStreamingMarshal(request,output);
  final ReferenceStreamHandler streamHandler=new ReferenceStreamHandler(marshal,source,versionObjectMapper);
  ObjectVersion version=null;
  RpslObject rpslObject=null;
  List<VersionInfo> entriesInSameVersion=null;
  try {
    version=objectReferenceDao.getVersion(type,key,revision);
    entriesInSameVersion=lookupRpslObjectByVersion(version);
    rpslObject=versionDao.getRpslObject(entriesInSameVersion.get(0));
    rpslObject=decorateRpslObject(rpslObject);
  }
 catch (  DataAccessException e) {
    throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).entity(notFoundWhoisInternalResources(request,InternalMessages.noVersion(key))).build());
  }
  streamHandler.streamWhoisObject(rpslObject);
  streamHandler.streamVersion(version);
  if (entriesInSameVersion.size() > 1) {
    streamHandler.streamErrorMessage(InternalMessages.multipleVersionsForTimestamp(entriesInSameVersion.size()));
  }
  objectReferenceDao.streamIncoming(version,streamHandler);
  streamHandler.endStreamingIncoming();
  objectReferenceDao.streamOutgoing(version,streamHandler);
  streamHandler.flush();
}

Fixed version (ground truth):
@Override public void write(final OutputStream output) throws IOException, WebApplicationException {
  final StreamingMarshal marshal=StreamingHelper.getStreamingMarshal(request,output);
  final ReferenceStreamHandler streamHandler=new ReferenceStreamHandler(marshal,source,versionObjectMapper);
  ObjectVersion version;
  RpslObject rpslObject;
  List<VersionInfo> entriesInSameVersion=null;
  try {
    version=objectReferenceDao.getVersion(type,key,revision);
    entriesInSameVersion=lookupRpslObjectByVersion(version);
    rpslObject=versionDao.getRpslObject(entriesInSameVersion.get(0));
    rpslObject=decorateRpslObject(rpslObject);
  }
 catch (  DataAccessException e) {
    throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).entity(notFoundWhoisInternalResources(request,InternalMessages.noVersion(key))).build());
  }
  streamHandler.streamWhoisObject(rpslObject);
  streamHandler.streamVersion(version);
  if (entriesInSameVersion.size() > 1) {
    streamHandler.streamErrorMessage(InternalMessages.multipleVersionsForTimestamp(entriesInSameVersion.size()));
  }
  objectReferenceDao.streamIncoming(version,streamHandler);
  streamHandler.endStreamingIncoming();
  objectReferenceDao.streamOutgoing(version,streamHandler);
  streamHandler.flush();
}
Program: 161042
Project: 161042
Buggy source:
public void flush(){
  if (!outgoingFound) {
    return;
  }
  streamObjectVersion(queue.poll());
  marshal.endArray();
  marshal.write("String_Node_Str",new Link("String_Node_Str",WhoisResources.TERMS_AND_CONDITIONS));
  marshal.end("String_Node_Str");
  marshal.close();
}

Fixed version (ground truth):
public void flush(){
  if (outgoingFound) {
    streamObjectVersion(queue.poll());
    marshal.endArray();
  }
  marshal.write("String_Node_Str",new Link("String_Node_Str",WhoisResources.TERMS_AND_CONDITIONS));
  marshal.end("String_Node_Str");
  marshal.close();
}
Program: 161043
Project: 161043
Buggy source:
@Override public int hashCode(){
  int result=type != null ? type.hashCode() : 0;
  result=31 * result + (key != null ? key.hashCode() : 0);
  result=31 * result + revision;
  result=31 * result + from.hashCode();
  result=31 * result + to.hashCode();
  result=31 * result + link.hashCode();
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=type != null ? type.hashCode() : 0;
  result=31 * result + (key != null ? key.hashCode() : 0);
  result=31 * result + revision;
  result=31 * result + (from != null ? from.hashCode() : 0);
  result=31 * result + (to != null ? to.hashCode() : 0);
  result=31 * result + (link != null ? link.hashCode() : 0);
  return result;
}
Program: 161044
Project: 161044
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (!(o instanceof WhoisVersionInternal))   return false;
  WhoisVersionInternal that=(WhoisVersionInternal)o;
  if (revision != that.revision)   return false;
  if (!from.equals(that.from))   return false;
  if (key != null ? !key.equals(that.key) : that.key != null)   return false;
  if (!link.equals(that.link))   return false;
  if (!to.equals(that.to))   return false;
  if (type != null ? !type.equals(that.type) : that.type != null)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(final Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  WhoisVersionInternal that=(WhoisVersionInternal)o;
  if (revision != that.revision)   return false;
  if (from != null ? !from.equals(that.from) : that.from != null)   return false;
  if (key != null ? !key.equals(that.key) : that.key != null)   return false;
  if (link != null ? !link.equals(that.link) : that.link != null)   return false;
  if (to != null ? !to.equals(that.to) : that.to != null)   return false;
  if (type != null ? !type.equalsIgnoreCase(that.type) : that.type != null)   return false;
  return true;
}
Program: 161045
Project: 161045
Buggy source:
@Test public void listVersions_key_does_not_exist(){
  try {
    RestTest.target(getPort(),"String_Node_Str",null,apiKey).request(MediaType.APPLICATION_JSON).get(WhoisInternalResources.class);
    fail();
  }
 catch (  ClientErrorException e) {
    final WhoisInternalResources whoisResources=e.getResponse().readEntity(WhoisInternalResources.class);
    assertThat(whoisResources.getErrorMessages().get(0).toString(),is("String_Node_Str"));
    assertThat(e.getResponse().getStatus(),is(404));
  }
}

Fixed version (ground truth):
@Test public void listVersions_key_does_not_exist(){
  try {
    RestTest.target(getPort(),"String_Node_Str",null,apiKey).request(MediaType.APPLICATION_JSON).get(WhoisInternalResources.class);
    fail();
  }
 catch (  ClientErrorException e) {
    final String str=e.getResponse().readEntity(String.class);
    System.out.println(str);
    final WhoisInternalResources whoisResources=e.getResponse().readEntity(WhoisInternalResources.class);
    assertThat(whoisResources.getErrorMessages().get(0).toString(),is("String_Node_Str"));
    assertThat(e.getResponse().getStatus(),is(404));
  }
}
Program: 161046
Project: 161046
Buggy source:
@Test public void listVersions_created_deleted_expected_json(){
  final DateTime start=new DateTime(2008,2,20,0,0,0,0);
  final DateTime end=new DateTime(2008,2,21,0,0,0,0);
  objectReferenceDao.createVersion(new ObjectVersion(1l,ObjectType.AUT_NUM,"String_Node_Str",start,end,1));
  final String response=RestTest.target(getPort(),"String_Node_Str",null,apiKey).request(MediaType.APPLICATION_JSON_TYPE).get(String.class);
  assertThat(response,is(String.format("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",dateTimeFormatter.print(start),dateTimeFormatter.print(end))));
}

Fixed version (ground truth):
@Test public void listVersions_created_deleted_expected_json(){
  final DateTime start=new DateTime(2008,2,20,0,0,0,0);
  final DateTime end=new DateTime(2008,2,21,0,0,0,0);
  objectReferenceDao.createVersion(new ObjectVersion(1l,ObjectType.AUT_NUM,"String_Node_Str",start,end,1));
  final String response=RestTest.target(getPort(),"String_Node_Str",null,apiKey).request(MediaType.APPLICATION_JSON_TYPE).get(String.class);
  System.out.println(response);
  assertThat(response,is(String.format("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",dateTimeFormatter.print(start),dateTimeFormatter.print(end))));
}
Program: 161047
Project: 161047
Buggy source:
@Before public void setUp() throws Exception {
  testDateTimeProvider.reset();
  databaseHelper.setupWhoisDatabase(new JdbcTemplate(dataSource));
  databaseHelper.insertApiKey(apiKey,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  testDateTimeProvider.reset();
  databaseHelper.setupWhoisDatabase(new JdbcTemplate(dataSource));
  databaseHelper.insertApiKey(apiKey,"String_Node_Str","String_Node_Str");
  JdbcTestUtils.deleteFromTables(whoisTemplate,"String_Node_Str");
  JdbcTestUtils.deleteFromTables(whoisTemplate,"String_Node_Str");
}
Program: 161048
Project: 161048
Buggy source:
@Test public void references_for_self_referenced_maintainer(){
  final WhoisInternalResources whoisResources=RestTest.target(getPort(),"String_Node_Str",null,apiKey).request(MediaType.APPLICATION_JSON).get(WhoisInternalResources.class);
  assertThat(whoisResources.getObject().getAttributes(),hasSize(greaterThan(1)));
  assertThat(whoisResources.getIncoming(),is(nullValue()));
  assertThat(whoisResources.getOutgoing(),is(nullValue()));
  final WhoisVersionInternal expectedMntnerVersion=new WhoisVersionInternal(1,"String_Node_Str","String_Node_Str","String_Node_Str",null,new Link("String_Node_Str","String_Node_Str" + API_REST_RND_BASEURL + "String_Node_Str"));
  assertThat(whoisResources.getOutgoing().get(0),is(expectedMntnerVersion));
  assertThat(whoisResources.getIncoming(),containsInAnyOrder(expectedMntnerVersion,new WhoisVersionInternal(1,"String_Node_Str","String_Node_Str","String_Node_Str",null,new Link("String_Node_Str","String_Node_Str" + API_REST_RND_BASEURL + "String_Node_Str")),new WhoisVersionInternal(1,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new Link("String_Node_Str","String_Node_Str" + API_REST_RND_BASEURL + "String_Node_Str")),new WhoisVersionInternal(2,"String_Node_Str","String_Node_Str","String_Node_Str",null,new Link("String_Node_Str","String_Node_Str" + API_REST_RND_BASEURL + "String_Node_Str"))));
}

Fixed version (ground truth):
@Test public void references_for_self_referenced_maintainer(){
  final WhoisInternalResources whoisResources=RestTest.target(getPort(),"String_Node_Str",null,apiKey).request(MediaType.APPLICATION_JSON).get(WhoisInternalResources.class);
  assertThat(whoisResources.getObject().getAttributes(),hasSize(greaterThan(1)));
  final WhoisVersionInternal expectedMntnerVersion=new WhoisVersionInternal(1,"String_Node_Str","String_Node_Str","String_Node_Str",null,new Link("String_Node_Str","String_Node_Str" + API_REST_RND_BASEURL + "String_Node_Str"));
  assertThat(whoisResources.getOutgoing().get(0),is(expectedMntnerVersion));
  assertThat(whoisResources.getIncoming(),containsInAnyOrder(expectedMntnerVersion,new WhoisVersionInternal(1,"String_Node_Str","String_Node_Str","String_Node_Str",null,new Link("String_Node_Str","String_Node_Str" + API_REST_RND_BASEURL + "String_Node_Str")),new WhoisVersionInternal(1,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new Link("String_Node_Str","String_Node_Str" + API_REST_RND_BASEURL + "String_Node_Str")),new WhoisVersionInternal(2,"String_Node_Str","String_Node_Str","String_Node_Str",null,new Link("String_Node_Str","String_Node_Str" + API_REST_RND_BASEURL + "String_Node_Str"))));
}
Program: 161049
Project: 161049
Buggy source:
@Before public void setUp() throws Exception {
  testDateTimeProvider.reset();
  databaseHelper.setupWhoisDatabase(whoisTemplate);
  databaseHelper.insertApiKey(apiKey,"String_Node_Str","String_Node_Str");
  whoisTemplate.execute("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  whoisTemplate.execute("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  whoisTemplate.execute("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  whoisTemplate.execute("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  whoisTemplate.execute("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");
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  testDateTimeProvider.reset();
  databaseHelper.insertApiKey(apiKey,"String_Node_Str","String_Node_Str");
  JdbcTestUtils.deleteFromTables(whoisTemplate,"String_Node_Str");
  JdbcTestUtils.deleteFromTables(whoisTemplate,"String_Node_Str");
  JdbcTestUtils.deleteFromTables(whoisTemplate,"String_Node_Str");
  JdbcTestUtils.deleteFromTables(whoisTemplate,"String_Node_Str");
  JdbcTestUtils.deleteFromTables(whoisTemplate,"String_Node_Str");
  whoisTemplate.execute("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  whoisTemplate.execute("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  whoisTemplate.execute("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  whoisTemplate.execute("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  whoisTemplate.execute("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");
}
Program: 161050
Project: 161050
Buggy source:
@Override public void processRow(final ResultSet rs) throws SQLException {
  handler.streamReference(isIncoming,new ObjectVersionRowMapper().mapRow(rs,rs.getRow()));
}

Fixed version (ground truth):
@Override public void processRow(final ResultSet rs) throws SQLException {
  handler.streamReference(isIncoming,createObjectVersion(rs));
}
Program: 161051
Project: 161051
Buggy source:
@Override public void streamVersions(final String pkey,final ObjectType objectType,final VersionsStreamHandler versionsStreamHandler){
  JdbcStreamingHelper.executeStreaming(jdbcTemplate,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",new PreparedStatementSetter(){
    @Override public void setValues(    final PreparedStatement ps) throws SQLException {
      ps.setString(1,pkey);
      ps.setInt(2,ObjectTypeIds.getId(objectType));
    }
  }
,new RowCallbackHandler(){
    @Override public void processRow(    final ResultSet rs) throws SQLException {
      versionsStreamHandler.streamObjectVersion(new ObjectVersionRowMapper().mapRow(rs,rs.getRow()));
    }
  }
);
}

Fixed version (ground truth):
@Override public void streamVersions(final String pkey,final ObjectType objectType,final VersionsStreamHandler versionsStreamHandler){
  JdbcStreamingHelper.executeStreaming(jdbcTemplate,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",new PreparedStatementSetter(){
    @Override public void setValues(    final PreparedStatement ps) throws SQLException {
      ps.setString(1,pkey);
      ps.setInt(2,ObjectTypeIds.getId(objectType));
    }
  }
,new RowCallbackHandler(){
    @Override public void processRow(    final ResultSet rs) throws SQLException {
      versionsStreamHandler.streamObjectVersion(createObjectVersion(rs));
    }
  }
);
}
Program: 161052
Project: 161052
Buggy source:
private void streamReference(final boolean isIncoming,final String query,final ObjectVersion objectVersion,final ReferenceStreamHandler handler){
  JdbcStreamingHelper.executeStreaming(jdbcTemplate,query,new PreparedStatementSetter(){
    @Override public void setValues(    final PreparedStatement ps) throws SQLException {
      ps.setLong(1,objectVersion.getVersionId());
    }
  }
,new RowCallbackHandler(){
    @Override public void processRow(    final ResultSet rs) throws SQLException {
      handler.streamReference(isIncoming,new ObjectVersionRowMapper().mapRow(rs,rs.getRow()));
    }
  }
);
}

Fixed version (ground truth):
private void streamReference(final boolean isIncoming,final String query,final ObjectVersion objectVersion,final ReferenceStreamHandler handler){
  JdbcStreamingHelper.executeStreaming(jdbcTemplate,query,new PreparedStatementSetter(){
    @Override public void setValues(    final PreparedStatement ps) throws SQLException {
      ps.setLong(1,objectVersion.getVersionId());
    }
  }
,new RowCallbackHandler(){
    @Override public void processRow(    final ResultSet rs) throws SQLException {
      handler.streamReference(isIncoming,createObjectVersion(rs));
    }
  }
);
}
Program: 161053
Project: 161053
Buggy source:
@Override public ObjectVersion mapRow(final ResultSet rs,final int rowNum) throws SQLException {
  return new ObjectVersion(rs.getLong(1),ObjectTypeIds.getType(rs.getInt(2)),rs.getString(3),rs.getLong(4),rs.getLong(5),rs.getInt(6));
}

Fixed version (ground truth):
@Override public ObjectVersion mapRow(final ResultSet rs,final int rowNum) throws SQLException {
  return createObjectVersion(rs);
}
Program: 161054
Project: 161054
Buggy source:
public static void main(final String[] argv) throws Exception {
  final OptionParser parser=new OptionParser();
  parser.accepts(PASSWORD_OPTION).withRequiredArg().required();
  parser.accepts(DBURL_OPTION).withRequiredArg().required();
  parser.accepts(TO_DB_OPTION);
  parser.accepts(START).withRequiredArg().ofType(Long.class);
  final OptionSet options=parser.parse(argv);
  final RndRetrieveReferenceAndReferencedBy app=new RndRetrieveReferenceAndReferencedBy(options.valueOf(PASSWORD_OPTION).toString(),options.valueOf(DBURL_OPTION).toString());
  if (options.has(START)) {
    app.run((Long)options.valueOf(START),options.has(TO_DB_OPTION));
  }
 else {
    app.run(FROM_BEGINNING,options.has(TO_DB_OPTION));
  }
}

Fixed version (ground truth):
public static void main(final String[] argv) throws Exception {
  final OptionParser parser=new OptionParser();
  parser.accepts(PASSWORD_OPTION).withRequiredArg().required();
  parser.accepts(DBURL_OPTION).withRequiredArg().required();
  parser.accepts(TO_DB_OPTION);
  parser.accepts(START).withRequiredArg().ofType(Long.class);
  parser.accepts(MAX_TIMESTAMP_OPTION).withRequiredArg().ofType(Integer.class);
  final OptionSet options=parser.parse(argv);
  if (options.has(MAX_TIMESTAMP_OPTION)) {
    MAX_TIMESTAMP=(Integer)options.valueOf(MAX_TIMESTAMP_OPTION);
  }
  final RndRetrieveReferenceAndReferencedBy app=new RndRetrieveReferenceAndReferencedBy(options.valueOf(PASSWORD_OPTION).toString(),options.valueOf(DBURL_OPTION).toString());
  if (options.has(START)) {
    app.run((Long)options.valueOf(START),options.has(TO_DB_OPTION));
  }
 else {
    app.run(FROM_BEGINNING,options.has(TO_DB_OPTION));
  }
}
Program: 161055
Project: 161055
Buggy source:
private Set<RpslObjectReference> getReferencingObjects(final RpslObject rpslObject){
  final Set<RpslObjectReference> referencing=Sets.newHashSet();
  for (  final RpslAttribute attribute : rpslObject.findAttributes(RELATED_TO_ATTRIBUTES)) {
    for (    final CIString referenceValue : attribute.getReferenceValues()) {
      Set<ObjectType> objectTypes=attribute.getType().getReferences(referenceValue);
      if (attribute.getType() == AttributeType.SPONSORING_ORG) {
        objectTypes=Sets.newHashSet(ObjectType.ORGANISATION);
      }
      if (objectTypes.size() == 1) {
        referencing.add(new RpslObjectReference(new RpslObjectKey(ObjectTypeIds.getId(objectTypes.iterator().next()),referenceValue.toString()),new ArrayList<Integer>()));
      }
 else {
switch (attribute.getType()) {
case AUTH:
          break;
default :
        referencing.add(new RpslObjectReference(new RpslObjectKey(DUMMY_OBJECT_TYPE_ID,referenceValue.toUpperCase()),new ArrayList<Integer>()));
    }
  }
}
}
return referencing;
}

Fixed version (ground truth):
private Set<RpslObjectReference> getReferencingObjects(final RpslObject rpslObject){
  final Set<RpslObjectReference> referencing=Sets.newHashSet();
  for (  final RpslAttribute attribute : rpslObject.findAttributes(OBJECT_REFERENCE_ATTRIBUTES)) {
    for (    final CIString referenceValue : attribute.getReferenceValues()) {
      Set<ObjectType> objectTypes=attribute.getType().getReferences(referenceValue);
      if (attribute.getType() == AttributeType.SPONSORING_ORG) {
        objectTypes=Sets.newHashSet(ObjectType.ORGANISATION);
      }
      if (objectTypes.size() == 1) {
        referencing.add(new RpslObjectReference(new RpslObjectKey(ObjectTypeIds.getId(objectTypes.iterator().next()),referenceValue.toString()),new ArrayList<Integer>()));
      }
 else {
switch (attribute.getType()) {
case AUTH:
          break;
default :
        referencing.add(new RpslObjectReference(new RpslObjectKey(DUMMY_OBJECT_TYPE_ID,referenceValue.toUpperCase()),new ArrayList<Integer>()));
    }
  }
}
}
return referencing;
}
Program: 161056
Project: 161056
Buggy source:
private Set<RpslObjectReference> getReferencingObjects(final RpslObject rpslObject){
  final Set<RpslObjectReference> referencing=Sets.newHashSet();
  for (  final RpslAttribute attribute : rpslObject.findAttributes(RELATED_TO_ATTRIBUTES)) {
    for (    final CIString referenceValue : attribute.getReferenceValues()) {
      Set<ObjectType> objectTypes=attribute.getType().getReferences(referenceValue);
      if (attribute.getType() == AttributeType.SPONSORING_ORG) {
        objectTypes=Sets.newHashSet(ObjectType.ORGANISATION);
      }
      if (objectTypes.size() == 1) {
        referencing.add(new RpslObjectReference(new RpslObjectKey(ObjectTypeIds.getId(objectTypes.iterator().next()),referenceValue.toString()),new ArrayList<Integer>()));
      }
 else {
switch (attribute.getType()) {
case AUTH:
          break;
default :
        referencing.add(new RpslObjectReference(new RpslObjectKey(DUMMY_OBJECT_TYPE_ID,referenceValue.toString()),new ArrayList<Integer>()));
    }
  }
}
}
return referencing;
}

Fixed version (ground truth):
private Set<RpslObjectReference> getReferencingObjects(final RpslObject rpslObject){
  final Set<RpslObjectReference> referencing=Sets.newHashSet();
  for (  final RpslAttribute attribute : rpslObject.findAttributes(RELATED_TO_ATTRIBUTES)) {
    for (    final CIString referenceValue : attribute.getReferenceValues()) {
      Set<ObjectType> objectTypes=attribute.getType().getReferences(referenceValue);
      if (attribute.getType() == AttributeType.SPONSORING_ORG) {
        objectTypes=Sets.newHashSet(ObjectType.ORGANISATION);
      }
      if (objectTypes.size() == 1) {
        referencing.add(new RpslObjectReference(new RpslObjectKey(ObjectTypeIds.getId(objectTypes.iterator().next()),referenceValue.toString()),new ArrayList<Integer>()));
      }
 else {
switch (attribute.getType()) {
case AUTH:
          break;
default :
        referencing.add(new RpslObjectReference(new RpslObjectKey(DUMMY_OBJECT_TYPE_ID,referenceValue.toUpperCase()),new ArrayList<Integer>()));
    }
  }
}
}
return referencing;
}
Program: 161057
Project: 161057
Buggy source:
private void writeJson(final Jedis jedis){
  try {
    final JsonWriter writer=new JsonWriter(new OutputStreamWriter(new FileOutputStream("String_Node_Str"),"String_Node_Str"));
    writer.beginArray();
    for (    String key : jedis.keys("String_Node_Str")) {
      JsonElement element=gson.fromJson(jedis.get(key),JsonElement.class);
      gson.toJson(element,writer);
    }
    writer.endArray();
    writer.close();
  }
 catch (  IOException ex) {
    LOGGER.error("String_Node_Str",ex.getMessage());
  }
}

Fixed version (ground truth):
private void writeJson(final Jedis jedis){
  try {
    final JsonWriter writer=new JsonWriter(new OutputStreamWriter(new FileOutputStream("String_Node_Str"),"String_Node_Str"));
    writer.beginArray();
    for (    String key : jedis.keys("String_Node_Str")) {
      LOGGER.info("String_Node_Str",key);
      JsonElement element=gson.fromJson(jedis.get(key),JsonElement.class);
      gson.toJson(element,writer);
    }
    writer.endArray();
    writer.close();
  }
 catch (  IOException ex) {
    LOGGER.error("String_Node_Str",ex.getMessage());
  }
}
Program: 161058
Project: 161058
Buggy source:
private Map<Interval,RpslObjectWithReferences> constructTimeLine(final String key,final List<DatabaseRpslObject> allEvents){
  final Map<Interval,RpslObjectWithReferences> rpslObjectTimeline=new HashMap<>();
  int revision=0;
  for (int i=0; i < allEvents.size(); i++) {
    final DatabaseRpslObject databaseRpslObject=allEvents.get(i);
    Interval interval;
    if (i == (allEvents.size() - 1)) {
      interval=new Interval(databaseRpslObject.getEventDate(),INFINITE_END_DATE);
    }
 else {
      interval=new Interval(databaseRpslObject.getEventDate(),allEvents.get(i + 1).getEventDate());
    }
    if (!interval.getEnd().equals(interval.getStart())) {
      if (databaseRpslObject instanceof LastEvent && ((LastEvent)databaseRpslObject).isDeleteEvent()) {
        rpslObjectTimeline.put(interval,new RpslObjectWithReferences(true,null,revision++));
      }
 else {
        try {
          final RpslObject rpslObject=(databaseRpslObject instanceof LastEvent ? ((LastEvent)databaseRpslObject).getRpslObject() : RpslObject.parse(((HistoricRpslObject)databaseRpslObject).getObjectBytes()));
          rpslObjectTimeline.put(interval,new RpslObjectWithReferences(false,getReferencingObjects(rpslObject),revision++));
        }
 catch (        Exception ex) {
          LOGGER.error("String_Node_Str",key);
          LOGGER.error("String_Node_Str",key);
          rpslObjectTimeline.put(interval,new RpslObjectWithReferences(false,null,revision++));
        }
      }
    }
  }
  return rpslObjectTimeline;
}

Fixed version (ground truth):
private Map<Interval,RpslObjectWithReferences> constructTimeLine(final String key,final List<DatabaseRpslObject> allEvents){
  final Map<Interval,RpslObjectWithReferences> rpslObjectTimeline=new HashMap<>();
  int revision=0;
  for (int i=0; i < allEvents.size(); i++) {
    final DatabaseRpslObject databaseRpslObject=allEvents.get(i);
    Interval interval;
    if (i == (allEvents.size() - 1)) {
      interval=new Interval(databaseRpslObject.getEventDate(),INFINITE_END_DATE);
    }
 else {
      interval=new Interval(databaseRpslObject.getEventDate(),allEvents.get(i + 1).getEventDate());
    }
    if (!interval.getEnd().equals(interval.getStart())) {
      if (databaseRpslObject instanceof LastEvent && ((LastEvent)databaseRpslObject).isDeleteEvent()) {
        revision++;
        rpslObjectTimeline.put(interval,new RpslObjectWithReferences(true,null,revision));
      }
 else {
        try {
          final RpslObject rpslObject=(databaseRpslObject instanceof LastEvent ? ((LastEvent)databaseRpslObject).getRpslObject() : RpslObject.parse(((HistoricRpslObject)databaseRpslObject).getObjectBytes()));
          revision++;
          rpslObjectTimeline.put(interval,new RpslObjectWithReferences(false,getReferencingObjects(rpslObject),revision));
        }
 catch (        Exception ex) {
          LOGGER.error("String_Node_Str",key);
          LOGGER.error("String_Node_Str",key);
          revision++;
          rpslObjectTimeline.put(interval,new RpslObjectWithReferences(false,null,revision));
        }
      }
    }
  }
  return rpslObjectTimeline;
}
Program: 161059
Project: 161059
Buggy source:
@Test public void get_versions_for_existing_object(){
  final LocalDateTime localDateTime=new LocalDateTime();
  final RpslObjectUpdateInfo objectInfo=updateDao.createObject(RpslObject.parse("String_Node_Str"));
  updateDao.updateObject(objectInfo.getObjectId(),RpslObject.parse("String_Node_Str"));
  updateDao.updateObject(objectInfo.getObjectId(),RpslObject.parse("String_Node_Str"));
  final List<VersionInfo> versions=subject.getVersionsBeforeTimestamp(ObjectType.DOMAIN,"String_Node_Str",localDateTime.toDateTime().getMillis());
  assertThat(versions,hasSize(3));
}

Fixed version (ground truth):
@Test public void get_versions_for_existing_object(){
  final LocalDateTime localDateTime=new LocalDateTime();
  final RpslObjectUpdateInfo objectInfo=updateDao.createObject(RpslObject.parse("String_Node_Str"));
  updateDao.updateObject(objectInfo.getObjectId(),RpslObject.parse("String_Node_Str"));
  updateDao.updateObject(objectInfo.getObjectId(),RpslObject.parse("String_Node_Str"));
  final List<VersionInfo> versions=subject.getVersionsBeforeTimestamp(ObjectType.DOMAIN,"String_Node_Str",localDateTime.plusDays(1).toDateTime().getMillis());
  assertThat(versions,hasSize(3));
}
Program: 161060
Project: 161060
Buggy source:
@Test public void get_versions_for_deleted_object(){
  final LocalDateTime localDateTime=new LocalDateTime();
  final RpslObjectUpdateInfo objectInfo=updateDao.createObject(RpslObject.parse("String_Node_Str"));
  updateDao.updateObject(objectInfo.getObjectId(),RpslObject.parse("String_Node_Str"));
  updateDao.deleteObject(objectInfo.getObjectId(),objectInfo.getKey());
  final List<VersionInfo> versions=subject.getVersionsBeforeTimestamp(ObjectType.DOMAIN,"String_Node_Str",localDateTime.toDateTime().getMillis());
  assertThat(versions,hasSize(3));
}

Fixed version (ground truth):
@Test public void get_versions_for_deleted_object(){
  final LocalDateTime localDateTime=new LocalDateTime();
  final RpslObjectUpdateInfo objectInfo=updateDao.createObject(RpslObject.parse("String_Node_Str"));
  updateDao.updateObject(objectInfo.getObjectId(),RpslObject.parse("String_Node_Str"));
  updateDao.deleteObject(objectInfo.getObjectId(),objectInfo.getKey());
  final List<VersionInfo> versions=subject.getVersionsBeforeTimestamp(ObjectType.DOMAIN,"String_Node_Str",localDateTime.plusDays(1).toDateTime().getMillis());
  assertThat(versions,hasSize(3));
}
Program: 161061
Project: 161061
Buggy source:
private Iterable<? extends ResponseObject> getResponseObjects(final Query query){
  final List<ResponseObject> results=new ArrayList<>();
  final List<ObjectVersion> versions=objectReferenceDao.getObjectVersion(query.getObjectTypes().iterator().next(),query.getSearchValue(),query.getObjectTimestamp() / 1000);
  if (CollectionUtils.isEmpty(versions)) {
    return makeListWithNoResultsMessage(query.getSearchValue());
  }
  final ObjectVersion latestVersion=versions.get(0);
  if (versions.size() > 2) {
    results.add(new MessageObject(InternalMessages.multipleVersionsForTimestamp(versions.size())));
  }
  final RpslObject rpslObject=lookupRpslObjectByVersion(latestVersion);
  final List<ObjectReference> referencing=objectReferenceDao.getReferencing(latestVersion.getVersionId());
  final List<ObjectReference> referencedBy=objectReferenceDao.getReferencedBy(latestVersion.getVersionId());
  final RpslObjectWithTimestamp rpslObjectWithTimestamp=new RpslObjectWithTimestamp(decorateRpslObject(rpslObject),versions.size(),new VersionDateTime(latestVersion.getInterval().getStartMillis()),referencing,referencedBy);
  results.add(rpslObjectWithTimestamp);
  return results;
}

Fixed version (ground truth):
private Iterable<? extends ResponseObject> getResponseObjects(final Query query){
  final List<ResponseObject> results=new ArrayList<>();
  final List<ObjectVersion> versions=objectReferenceDao.getObjectVersion(query.getObjectTypes().iterator().next(),query.getSearchValue(),query.getObjectTimestamp() / 1000);
  if (CollectionUtils.isEmpty(versions)) {
    return makeListWithNoResultsMessage(query.getSearchValue());
  }
  final ObjectVersion latestVersion=versions.get(0);
  if (versions.size() > 2) {
    results.add(new MessageObject(InternalMessages.multipleVersionsForTimestamp(versions.size())));
  }
  final RpslObject rpslObject=lookupRpslObjectByVersion(latestVersion);
  final List<ObjectReference> referencing=objectReferenceDao.getReferencing(latestVersion.getVersionId());
  final List<ObjectReference> referencedBy=objectReferenceDao.getReferencedBy(latestVersion.getVersionId());
  final RpslObjectWithTimestamp rpslObjectWithTimestamp=new RpslObjectWithTimestamp(decorateRpslObject(rpslObject),versions.size(),new VersionDateTime(latestVersion.getInterval().getStartMillis() / 1000L),referencing,referencedBy);
  results.add(rpslObjectWithTimestamp);
  return results;
}
Program: 161063
Project: 161063
Buggy source:
@Nullable @Override public List<VersionInfo> getVersionsBeforeTimestamp(ObjectType type,String searchKey,long timestamp){
  final List<Integer> objectIds=getObjectIds(type,searchKey);
  if (objectIds.isEmpty()) {
    return null;
  }
  final List<VersionInfo> versionInfos=Lists.newArrayList();
  versionInfos.addAll(getJdbcTemplate().query("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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",new VersionInfoRowMapper(),Joiner.on(',').join(objectIds),timestamp));
  return versionInfos;
}

Fixed version (ground truth):
@Nullable @Override public List<VersionInfo> getVersionsBeforeTimestamp(ObjectType type,String searchKey,long timestamp){
  final List<Integer> objectIds=getObjectIds(type,searchKey);
  if (objectIds.isEmpty()) {
    return null;
  }
  final List<VersionInfo> versionInfos=Lists.newArrayList();
  versionInfos.addAll(getJdbcTemplate().query("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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",new VersionInfoRowMapper(),Joiner.on(',').join(objectIds),timestamp / 1000L));
  return versionInfos;
}
Program: 161064
Project: 161064
Buggy source:
private long validateDateTimeAndConvertToTimestamp(final HttpServletRequest request,final String timestamp){
  try {
    return VersionDateTime.formatter.parseDateTime(timestamp).getMillis();
  }
 catch (  IllegalArgumentException e) {
    throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(whoisService.createErrorEntity(request,RestMessages.invalidTimestampFormat(timestamp))).build());
  }
}

Fixed version (ground truth):
private long validateDateTimeAndConvertToTimestamp(final HttpServletRequest request,final String timestamp){
  try {
    return new LocalDateTime(VersionDateTime.formatter.parseDateTime(timestamp)).withSecondOfMinute(59).withMillisOfSecond(999).toDateTime().getMillis();
  }
 catch (  IllegalArgumentException e) {
    throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(whoisService.createErrorEntity(request,RestMessages.invalidTimestampFormat(timestamp))).build());
  }
}
Program: 161065
Project: 161065
Buggy source:
@Test public void lookupFirstVersion(){
  final RpslObject mntner=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");
  final RpslObjectUpdateInfo objectInfo=updateDao.createObject(mntner);
  final LocalDateTime localDateTime=new LocalDateTime();
  testDateTimeProvider.setTime(localDateTime.plusDays(1));
  updateDao.updateObject(objectInfo.getObjectId(),new RpslObjectBuilder(mntner).removeAttribute(new RpslAttribute(AttributeType.AUTH,"String_Node_Str")).get());
  final String creationTimestamp=DEFAULT_DATE_TIME_FORMATTER.print(localDateTime);
  final WhoisResources result=RestTest.target(getPort(),String.format("String_Node_Str",creationTimestamp),null,apiKey).request(MediaType.APPLICATION_JSON_TYPE).get(WhoisResources.class);
  assertThat(result,not(is(nullValue())));
  assertThat(result.getWhoisObjects(),hasSize(1));
  assertThat(result.getWhoisObjects().get(0).getVersionDateTime(),is(creationTimestamp));
}

Fixed version (ground truth):
@Test public void lookupFirstVersion(){
  final RpslObject mntner=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");
  final RpslObjectUpdateInfo objectInfo=updateDao.createObject(mntner);
  final LocalDateTime localDateTime=new LocalDateTime();
  testDateTimeProvider.setTime(localDateTime.plusDays(1));
  updateDao.updateObject(objectInfo.getObjectId(),new RpslObjectBuilder(mntner).removeAttribute(new RpslAttribute(AttributeType.AUTH,"String_Node_Str")).get());
  final String creationTimestamp=DEFAULT_DATE_TIME_FORMATTER.print(localDateTime);
  final WhoisResources result=RestTest.target(getPort(),String.format("String_Node_Str",creationTimestamp),null,apiKey).request(MediaType.APPLICATION_JSON_TYPE).get(WhoisResources.class);
  assertThat(result,not(is(nullValue())));
  assertThat(result.getWhoisObjects(),hasSize(1));
  final WhoisObject whoisObject=result.getWhoisObjects().get(0);
  assertThat(whoisObject.getVersionDateTime(),is(creationTimestamp));
  assertThat(whoisObject.getAttributes(),hasItems(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)));
  assertThat(whoisObject.getAttributes(),not(hasItems(new Attribute("String_Node_Str","String_Node_Str"),new Attribute("String_Node_Str","String_Node_Str"))));
}
Program: 161066
Project: 161066
Buggy source:
@Override public boolean apply(@Nullable VersionInfo input){
  return input.getTimestamp() != maxTimestamp && input.getOperation() != Operation.DELETE;
}

Fixed version (ground truth):
@Override public boolean apply(@Nullable VersionInfo input){
  return input.getTimestamp().equals(maxTimestamp) || input.getOperation() != Operation.DELETE;
}
Program: 161067
Project: 161067
Buggy source:
private Iterable<? extends ResponseObject> getResponseObjects(final Query query){
  final List<ResponseObject> results=new ArrayList<>();
  final List<VersionInfo> versionInfos=versionDao.getVersionsBeforeTimestamp(query.getObjectTypes().iterator().next(),query.getSearchValue(),query.getObjectTimestamp());
  if (CollectionUtils.isEmpty(versionInfos)) {
    return makeListWithNoResultsMessage();
  }
  final VersionDateTime maxTimestamp=versionInfos.get(0).getTimestamp();
  final List<VersionInfo> latestVersionInfos=Lists.newArrayList(Iterables.filter(versionInfos,new Predicate<VersionInfo>(){
    @Override public boolean apply(    @Nullable VersionInfo input){
      return input.getTimestamp() != maxTimestamp && input.getOperation() != Operation.DELETE;
    }
  }
));
  Collections.sort(latestVersionInfos);
  if (latestVersionInfos.isEmpty()) {
    return makeListWithNoResultsMessage();
  }
  if (latestVersionInfos.size() > 1) {
    results.add(new MessageObject(multipleVersionsForTimestamp(latestVersionInfos.size())));
  }
  final RpslObject rpslObject=versionDao.getRpslObject(Iterables.getLast(latestVersionInfos));
  results.add(new RpslObjectWithTimestamp(decorateRpslObject(rpslObject),latestVersionInfos.size(),Iterables.getLast(latestVersionInfos).getTimestamp()));
  return results;
}

Fixed version (ground truth):
private Iterable<? extends ResponseObject> getResponseObjects(final Query query){
  final List<ResponseObject> results=new ArrayList<>();
  final List<VersionInfo> versionInfos=versionDao.getVersionsBeforeTimestamp(query.getObjectTypes().iterator().next(),query.getSearchValue(),query.getObjectTimestamp());
  if (CollectionUtils.isEmpty(versionInfos)) {
    return makeListWithNoResultsMessage();
  }
  final VersionDateTime maxTimestamp=versionInfos.get(0).getTimestamp();
  final List<VersionInfo> latestVersionInfos=Lists.newArrayList(Iterables.filter(versionInfos,new Predicate<VersionInfo>(){
    @Override public boolean apply(    @Nullable VersionInfo input){
      return input.getTimestamp().equals(maxTimestamp) || input.getOperation() != Operation.DELETE;
    }
  }
));
  Collections.sort(latestVersionInfos);
  if (latestVersionInfos.isEmpty()) {
    return makeListWithNoResultsMessage();
  }
  if (latestVersionInfos.size() > 1) {
    results.add(new MessageObject(multipleVersionsForTimestamp(latestVersionInfos.size())));
  }
  final RpslObject rpslObject=versionDao.getRpslObject(Iterables.getLast(latestVersionInfos));
  results.add(new RpslObjectWithTimestamp(decorateRpslObject(rpslObject),latestVersionInfos.size(),Iterables.getLast(latestVersionInfos).getTimestamp()));
  return results;
}
Program: 161068
Project: 161068
Buggy source:
@Test public void sameOrVeryNearlyTheSameTimestamp(){
  final RpslObject before=RpslObject.parse("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  final RpslObject after=RpslObject.parse("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  final RpslObjectUpdateInfo objectInfo=updateDao.createObject(before);
  updateDao.updateObject(objectInfo.getObjectId(),after);
  final WhoisResources result=RestTest.target(getPort(),String.format("String_Node_Str",new LocalDateTime()),null,apiKey).request(MediaType.APPLICATION_JSON_TYPE).get(WhoisResources.class);
  assertThat(result.getWhoisObjects().get(0).getAttributes().get(1).getValue(),is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void sameOrVeryNearlyTheSameTimestamp(){
  final RpslObject before=RpslObject.parse("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  final RpslObject after=RpslObject.parse("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  final RpslObjectUpdateInfo objectInfo=updateDao.createObject(before);
  updateDao.updateObject(objectInfo.getObjectId(),after);
  final WhoisResources result=RestTest.target(getPort(),String.format("String_Node_Str",DEFAULT_DATE_TIME_FORMATTER.print(new LocalDateTime())),null,apiKey).request(MediaType.APPLICATION_JSON_TYPE).get(WhoisResources.class);
  assertThat(result.getWhoisObjects().get(0).getAttributes().get(1).getValue(),is("String_Node_Str"));
}
Program: 161069
Project: 161069
Buggy source:
@Test public void listVersions_created_deleted(){
  final RpslObjectUpdateInfo add=updateDao.createObject(RpslObject.parse("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
  LocalDateTime deleteDate=new LocalDateTime().plusDays(3);
  testDateTimeProvider.setTime(deleteDate);
  updateDao.deleteObject(add.getObjectId(),"String_Node_Str");
  final WhoisResources result=RestTest.target(getPort(),"String_Node_Str",null,apiKey).request(MediaType.APPLICATION_JSON_TYPE).get(WhoisResources.class);
  assertThat(result.getErrorMessages(),hasSize(0));
  final List<WhoisVersionInternal> versions=result.getVersionsInternal().getVersions();
  assertThat(versions,hasSize(1));
  LocalDateTime fromDate=parse(versions.get(0).getFrom(),DEFAULT_DATE_TIME_FORMATTER);
  LocalDateTime toDate=parse(versions.get(0).getTo(),DEFAULT_DATE_TIME_FORMATTER);
  assertThat(versions.get(0).getOperation(),is(Operation.UPDATE.toString()));
  assertThat(Period.fieldDifference(fromDate,toDate).getDays(),is(3));
}

Fixed version (ground truth):
@Test public void listVersions_created_deleted(){
  final RpslObjectUpdateInfo add=updateDao.createObject(RpslObject.parse("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
  LocalDateTime deleteDate=new LocalDateTime().plusDays(3);
  testDateTimeProvider.setTime(deleteDate);
  updateDao.deleteObject(add.getObjectId(),"String_Node_Str");
  final WhoisResources result=RestTest.target(getPort(),"String_Node_Str",null,apiKey).request(MediaType.APPLICATION_JSON_TYPE).get(WhoisResources.class);
  assertThat(result.getErrorMessages(),hasSize(0));
  final List<WhoisVersionInternal> versions=result.getVersionsInternal().getVersions();
  assertThat(versions,hasSize(1));
  LocalDateTime fromDate=parse(versions.get(0).getFrom(),DEFAULT_DATE_TIME_FORMATTER);
  LocalDateTime toDate=parse(versions.get(0).getTo(),DEFAULT_DATE_TIME_FORMATTER);
  assertThat(versions.get(0).getOperation(),is(Operation.UPDATE.toString()));
  assertThat(new Period(fromDate,toDate).getDays(),is(3));
}