nus-yam/ex-repair huggingface dataset:
Program: 161231
Project: 161231
Buggy source:
@Test public void refresh(){
  when(dailyScheduler.getDailyTaskFinishTime(any(Class.class))).thenReturn(new Long(10));
  final AuthoritativeResource unknown=AuthoritativeResource.unknown(logger);
  when(resourceDataDao.load(any(Logger.class),any(String.class))).thenReturn(unknown);
  subject.init();
  verify(resourceDataDao).load(any(Logger.class),eq("String_Node_Str"));
  assertThat(subject.getAuthoritativeResource(ciString("String_Node_Str")),isA(AuthoritativeResource.class));
}

Fixed version (ground truth):
@Test public void refresh(){
  when(dailySchedulerDao.getDailyTaskFinishTime(any(LocalDate.class),any(Class.class))).thenReturn(new Long(10));
  final AuthoritativeResource unknown=AuthoritativeResource.unknown(logger);
  when(resourceDataDao.load(any(Logger.class),any(String.class))).thenReturn(unknown);
  subject.init();
  verify(resourceDataDao).load(any(Logger.class),eq("String_Node_Str"));
  assertThat(subject.getAuthoritativeResource(ciString("String_Node_Str")),isA(AuthoritativeResource.class));
}
Program: 161232
Project: 161232
Buggy source:
private int getResultLimit(final int maxResults,final int numDocs){
  return (maxResults <= 0) ? numDocs : Math.max(Math.min(maxResults,numDocs),1);
}

Fixed version (ground truth):
private int getResultLimit(final int maxResults,final int numDocs){
  return Math.max(Math.min(maxResults,numDocs),1);
}
Program: 161234
Project: 161234
Buggy source:
public static IpInterval<?> parseReverseDomain(String reverse){
  reverse=removeTrailingDot(reverse);
  if (reverse.endsWith(Ipv4Resource.IPV4_REVERSE_DOMAIN)) {
    return Ipv4Resource.parseReverseDomain(reverse);
  }
  return Ipv6Resource.parseReverseDomain(reverse);
}

Fixed version (ground truth):
public static IpInterval<?> parseReverseDomain(String reverse){
  reverse=removeTrailingDot(reverse).toLowerCase();
  if (reverse.endsWith(Ipv4Resource.IPV4_REVERSE_DOMAIN)) {
    return Ipv4Resource.parseReverseDomain(reverse);
  }
  return Ipv6Resource.parseReverseDomain(reverse);
}
Program: 161235
Project: 161235
Buggy source:
@Test public void personQueryWithoutSearchKey() throws Exception {
  final String response=DummyWhoisClient.query(QueryServer.port,"String_Node_Str");
  assertThat(response,containsString("String_Node_Str"));
  assertThat(response,not(containsString(QueryMessages.internalErrorOccured().toString())));
}

Fixed version (ground truth):
@Test public void personQueryWithoutSearchKey() throws Exception {
  final String response=DummyWhoisClient.query(QueryServer.port,"String_Node_Str");
  assertThat(response,containsString(QueryMessages.noSearchKeySpecified().toString()));
  assertThat(response,not(containsString(QueryMessages.internalErrorOccured().toString())));
}
Program: 161236
Project: 161236
Buggy source:
public RegExpMatcher(final String pattern){
  this.pattern=Pattern.compile("String_Node_Str" + pattern);
}

Fixed version (ground truth):
public RegExpMatcher(final String pattern){
  this.pattern=Pattern.compile(pattern,Pattern.CASE_INSENSITIVE);
}
Program: 161237
Project: 161237
Buggy source:
private Set<ObjectType> parseObjectTypes(){
  final Set<String> objectTypes=getOptionValues(QueryFlag.SELECT_TYPES);
  final Set<ObjectType> response=Sets.newTreeSet(ObjectType.COMPARATOR);
  if (objectTypes.isEmpty()) {
    if (isLookupInBothDirections()) {
      response.addAll(DEFAULT_TYPES_LOOKUP_IN_BOTH_DIRECTIONS);
    }
 else {
      response.addAll(DEFAULT_TYPES_ALL);
    }
  }
 else {
    for (    final String objectType : objectTypes) {
      try {
        response.add(ObjectType.getByName(objectType));
      }
 catch (      IllegalArgumentException e) {
        throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.invalidObjectType(objectType));
      }
    }
  }
  if (hasOption(QueryFlag.NO_PERSONAL)) {
    response.remove(ObjectType.PERSON);
    response.remove(ObjectType.ROLE);
  }
  if (hasOption(QueryFlag.RESOURCE)) {
    response.retainAll(GRS_LIMIT_TYPES);
  }
  nextObjectType:   for (Iterator<ObjectType> it=response.iterator(); it.hasNext(); ) {
    ObjectType objectType=it.next();
    for (    final AttributeType attribute : ObjectTemplate.getTemplate(objectType).getLookupAttributes()) {
      if (AttributeMatcher.fetchableBy(attribute,this)) {
        continue nextObjectType;
      }
    }
    it.remove();
  }
  return Collections.unmodifiableSet(response);
}

Fixed version (ground truth):
private Set<ObjectType> parseObjectTypes(){
  final Set<String> objectTypes=getOptionValues(QueryFlag.SELECT_TYPES);
  final Set<ObjectType> response=Sets.newTreeSet(ObjectType.COMPARATOR);
  if (objectTypes.isEmpty()) {
    if (isLookupInBothDirections()) {
      response.addAll(DEFAULT_TYPES_LOOKUP_IN_BOTH_DIRECTIONS);
    }
 else {
      response.addAll(DEFAULT_TYPES_ALL);
    }
  }
 else {
    for (    final String objectType : objectTypes) {
      try {
        response.add(ObjectType.getByName(objectType));
      }
 catch (      IllegalArgumentException e) {
        throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.invalidObjectType(objectType));
      }
    }
  }
  if (hasOption(QueryFlag.NO_PERSONAL)) {
    response.remove(ObjectType.PERSON);
    response.remove(ObjectType.ROLE);
  }
  if (hasOption(QueryFlag.RESOURCE)) {
    response.retainAll(GRS_LIMIT_TYPES);
  }
  if (!isInverse()) {
    nextObjectType:     for (Iterator<ObjectType> it=response.iterator(); it.hasNext(); ) {
      ObjectType objectType=it.next();
      for (      final AttributeType attribute : ObjectTemplate.getTemplate(objectType).getLookupAttributes()) {
        if (AttributeMatcher.fetchableBy(attribute,this)) {
          continue nextObjectType;
        }
      }
      it.remove();
    }
  }
  return Collections.unmodifiableSet(response);
}
Program: 161238
Project: 161238
Buggy source:
@Autowired public UpdateObjectHandlerImpl(final RpslObjectUpdateDao rpslObjectUpdateDao,final List<BusinessRuleValidator> businessRuleValidators,final DateTimeProvider dateTimeProvider){
  this.rpslObjectUpdateDao=rpslObjectUpdateDao;
  this.dateTimeProvider=dateTimeProvider;
  validatorsByActionAndType=Maps.newEnumMap(Action.class);
  for (  final Action action : Action.values()) {
    final Map<ObjectType,List<BusinessRuleValidator>> validatorsByType=Maps.newEnumMap(ObjectType.class);
    for (    final ObjectType objectType : ObjectType.values()) {
      validatorsByType.put(objectType,Lists.<BusinessRuleValidator>newArrayList());
    }
    validatorsByActionAndType.put(action,validatorsByType);
  }
  for (  final BusinessRuleValidator businessRuleValidator : businessRuleValidators) {
    final List<Action> actions=businessRuleValidator.getActions();
    for (    final Action action : actions) {
      for (      final ObjectType objectType : businessRuleValidator.getTypes()) {
        validatorsByActionAndType.get(action).get(objectType).add(businessRuleValidator);
      }
    }
  }
}

Fixed version (ground truth):
@Autowired public UpdateObjectHandlerImpl(final RpslObjectUpdateDao rpslObjectUpdateDao,final List<BusinessRuleValidator> businessRuleValidators,final DateTimeProvider dateTimeProvider){
  Collections.sort(businessRuleValidators,new Comparator<BusinessRuleValidator>(){
    public int compare(    BusinessRuleValidator b1,    BusinessRuleValidator b2){
      return b1.getClass().getName().compareToIgnoreCase(b2.getClass().getName());
    }
  }
);
  this.rpslObjectUpdateDao=rpslObjectUpdateDao;
  this.dateTimeProvider=dateTimeProvider;
  validatorsByActionAndType=Maps.newEnumMap(Action.class);
  for (  final Action action : Action.values()) {
    final Map<ObjectType,List<BusinessRuleValidator>> validatorsByType=Maps.newEnumMap(ObjectType.class);
    for (    final ObjectType objectType : ObjectType.values()) {
      validatorsByType.put(objectType,Lists.<BusinessRuleValidator>newArrayList());
    }
    validatorsByActionAndType.put(action,validatorsByType);
  }
  for (  final BusinessRuleValidator businessRuleValidator : businessRuleValidators) {
    final List<Action> actions=businessRuleValidator.getActions();
    for (    final Action action : actions) {
      for (      final ObjectType objectType : businessRuleValidator.getTypes()) {
        validatorsByActionAndType.get(action).get(objectType).add(businessRuleValidator);
      }
    }
  }
}
Program: 161239
Project: 161239
Buggy source:
@RetryFor(value=Exception.class) private Server createAndStartServer(int port,HandlerList handlers,Audience audience) throws Exception {
  int tryPort=(port <= 0) ? ServerHelper.getAvailablePort() : port;
  LOGGER.debug("String_Node_Str",tryPort);
  final Server server=new Server(tryPort);
  server.setHandler(handlers);
  server.setStopAtShutdown(true);
  server.start();
  jettyConfig.setPort(audience,tryPort);
  LOGGER.info("String_Node_Str",tryPort,audience);
  return server;
}

Fixed version (ground truth):
@RetryFor(attempts=5,value=Exception.class) private Server createAndStartServer(int port,HandlerList handlers,Audience audience) throws Exception {
  int tryPort=(port <= 0) ? ServerHelper.getAvailablePort() : port;
  LOGGER.debug("String_Node_Str",tryPort);
  final Server server=new Server(tryPort);
  server.setHandler(handlers);
  server.setStopAtShutdown(true);
  server.start();
  jettyConfig.setPort(audience,tryPort);
  LOGGER.info("String_Node_Str",tryPort,audience);
  return server;
}
Program: 161240
Project: 161240
Buggy source:
@Nullable @Override public String apply(@Nullable String input){
  return QueryFlag.getValidLongFlags().contains(input) ? "String_Node_Str" + input : "String_Node_Str" + input;
}

Fixed version (ground truth):
@Override public String apply(String input){
  return input.length() > 1 ? "String_Node_Str" + input : "String_Node_Str" + input;
}
Program: 161242
Project: 161242
Buggy source:
private Response handleVersionQuery(final Query query,final String source,final String key,final InetAddress remoteAddress,final int contextId){
  final ApiResponseHandlerVersions apiResponseHandlerVersions=new ApiResponseHandlerVersions();
  queryHandler.streamResults(query,remoteAddress,contextId,apiResponseHandlerVersions);
  final VersionWithRpslResponseObject versionResponseObject=apiResponseHandlerVersions.getVersionWithRpslResponseObject();
  final List<DeletedVersionResponseObject> deleted=apiResponseHandlerVersions.getDeletedObjects();
  final List<VersionResponseObject> versions=apiResponseHandlerVersions.getVersionObjects();
  if (versionResponseObject == null && deleted.isEmpty() && versions.isEmpty()) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  final WhoisResources whoisResources=new WhoisResources();
  if (versionResponseObject != null) {
    final WhoisObject whoisObject=WhoisObjectMapper.map(versionResponseObject.getRpslObject());
    whoisObject.setVersion(versionResponseObject.getVersion());
    whoisResources.setWhoisObjects(Collections.singletonList(whoisObject));
  }
 else {
    final String type=(versions.size() > 0) ? versions.get(0).getType().getName() : deleted.size() > 0 ? deleted.get(0).getType().getName() : null;
    final WhoisVersions whoisVersions=new WhoisVersions(source,type,key,WhoisObjectMapper.mapVersions(deleted,versions));
    whoisResources.setVersions(whoisVersions);
  }
  return Response.ok(whoisResources).build();
}

Fixed version (ground truth):
private Response handleVersionQuery(final Query query,final String source,final String key,final InetAddress remoteAddress,final int contextId){
  final ApiResponseHandlerVersions apiResponseHandlerVersions=new ApiResponseHandlerVersions();
  queryHandler.streamResults(query,remoteAddress,contextId,apiResponseHandlerVersions);
  final VersionWithRpslResponseObject versionResponseObject=apiResponseHandlerVersions.getVersionWithRpslResponseObject();
  final List<DeletedVersionResponseObject> deleted=apiResponseHandlerVersions.getDeletedObjects();
  final List<VersionResponseObject> versions=apiResponseHandlerVersions.getVersionObjects();
  if (versionResponseObject == null && versions.isEmpty()) {
    if (deleted.isEmpty() || query.isObjectVersion()) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
  }
  final WhoisResources whoisResources=new WhoisResources();
  if (versionResponseObject != null) {
    final WhoisObject whoisObject=WhoisObjectMapper.map(versionResponseObject.getRpslObject());
    whoisObject.setVersion(versionResponseObject.getVersion());
    whoisResources.setWhoisObjects(Collections.singletonList(whoisObject));
  }
 else {
    final String type=(versions.size() > 0) ? versions.get(0).getType().getName() : deleted.size() > 0 ? deleted.get(0).getType().getName() : null;
    final WhoisVersions whoisVersions=new WhoisVersions(source,type,key,WhoisObjectMapper.mapVersions(deleted,versions));
    whoisResources.setVersions(whoisVersions);
  }
  return Response.ok(whoisResources).build();
}
Program: 161243
Project: 161243
Buggy source:
private Iterable<? extends ResponseObject> getVersion(final VersionLookupResult res,final Query query){
  final List<VersionInfo> versionInfos=res.getVersionInfos();
  final int version=query.getObjectVersion();
  if (version < 1 || version > versionInfos.size()) {
    return Collections.singletonList(new MessageObject(QueryMessages.versionOutOfRange(versionInfos.size())));
  }
  final VersionInfo info=versionInfos.get(version - 1);
  final RpslObject rpslObject=versionDao.getRpslObject(info);
  return Lists.newArrayList(new MessageObject(QueryMessages.versionInformation(version,(version == versionInfos.size()),rpslObject.getKey(),info.getOperation(),info.getTimestamp())),rpslObject);
}

Fixed version (ground truth):
private Iterable<? extends ResponseObject> getVersion(final VersionLookupResult res,final int version){
  final List<VersionInfo> versionInfos=res.getVersionInfos();
  final VersionInfo info=versionInfos.get(version - 1);
  final RpslObject rpslObject=versionDao.getRpslObject(info);
  return Lists.newArrayList(new MessageObject(QueryMessages.versionInformation(version,(version == versionInfos.size()),rpslObject.getKey(),info.getOperation(),info.getTimestamp())),rpslObject);
}
Program: 161244
Project: 161244
Buggy source:
private Iterable<? extends ResponseObject> getAllVersions(final VersionLookupResult res,final Query query){
  final ObjectType objectType=res.getObjectType();
  final List<ResponseObject> messages=Lists.newArrayList();
  messages.add(new MessageObject(QueryMessages.versionListHeader(objectType.getName().toUpperCase(),query.getCleanSearchValue())));
  final VersionDateTime lastDeletionTimestamp=res.getLastDeletionTimestamp();
  final String pkey=res.getPkey();
  if (lastDeletionTimestamp != null) {
    messages.add(new DeletedVersionResponseObject(lastDeletionTimestamp,objectType,pkey));
  }
  final List<VersionInfo> versionInfos=res.getVersionInfos();
  int versionPadding=getPadding(versionInfos);
  messages.add(new MessageObject(String.format("String_Node_Str" + versionPadding + "String_Node_Str",VERSION_HEADER,DATE_HEADER,OPERATION_HEADER)));
  for (int i=0; i < versionInfos.size(); i++) {
    final VersionInfo versionInfo=versionInfos.get(i);
    messages.add(new VersionResponseObject(versionPadding,versionInfo.getOperation(),i + 1,versionInfo.getTimestamp(),objectType,pkey));
  }
  messages.add(new MessageObject("String_Node_Str"));
  return messages;
}

Fixed version (ground truth):
private Iterable<? extends ResponseObject> getAllVersions(final VersionLookupResult res,final String searchKey){
  final ObjectType objectType=res.getObjectType();
  final List<ResponseObject> messages=Lists.newArrayList();
  messages.add(new MessageObject(QueryMessages.versionListHeader(objectType.getName().toUpperCase(),searchKey)));
  final VersionDateTime lastDeletionTimestamp=res.getLastDeletionTimestamp();
  final String pkey=res.getPkey();
  if (lastDeletionTimestamp != null) {
    messages.add(new DeletedVersionResponseObject(lastDeletionTimestamp,objectType,pkey));
  }
  final List<VersionInfo> versionInfos=res.getVersionInfos();
  int versionPadding=getPadding(versionInfos);
  messages.add(new MessageObject(String.format("String_Node_Str" + versionPadding + "String_Node_Str",VERSION_HEADER,DATE_HEADER,OPERATION_HEADER)));
  for (int i=0; i < versionInfos.size(); i++) {
    final VersionInfo versionInfo=versionInfos.get(i);
    messages.add(new VersionResponseObject(versionPadding,versionInfo.getOperation(),i + 1,versionInfo.getTimestamp(),objectType,pkey));
  }
  messages.add(new MessageObject("String_Node_Str"));
  return messages;
}
Program: 161245
Project: 161245
Buggy source:
private Iterable<? extends ResponseObject> getResponseObjects(final Query query){
  VersionLookupResult res=getVersionInfo(query);
  if (res == null) {
    return Collections.emptyList();
  }
  final ObjectType objectType=res.getObjectType();
  if (objectType == ObjectType.PERSON || objectType == ObjectType.ROLE) {
    return Collections.singletonList(new MessageObject(QueryMessages.versionPersonRole(objectType.getName().toUpperCase(),query.getSearchValue())));
  }
  final List<VersionInfo> versionInfos=res.getVersionInfos();
  final VersionDateTime lastDeletionTimestamp=res.getLastDeletionTimestamp();
  if (versionInfos.isEmpty() && lastDeletionTimestamp != null) {
    return Collections.singletonList(new MessageObject(QueryMessages.versionDeleted(lastDeletionTimestamp.toString())));
  }
  if (query.isVersionList()) {
    return getAllVersions(res,query);
  }
 else   if (query.isVersionDiff()) {
    return getVersionDiffs(res,query);
  }
 else {
    return getVersion(res,query);
  }
}

Fixed version (ground truth):
private Iterable<? extends ResponseObject> getResponseObjects(final Query query){
  VersionLookupResult res=getVersionInfo(query);
  if (res == null) {
    return Collections.emptyList();
  }
  final ObjectType objectType=res.getObjectType();
  final String searchKey=query.getCleanSearchValue();
  if (objectType == ObjectType.PERSON || objectType == ObjectType.ROLE) {
    return Collections.singletonList(new MessageObject(QueryMessages.versionPersonRole(objectType.getName().toUpperCase(),searchKey)));
  }
  final List<VersionInfo> versionInfos=res.getVersionInfos();
  final VersionDateTime lastDeletionTimestamp=res.getLastDeletionTimestamp();
  if (versionInfos.isEmpty() && lastDeletionTimestamp != null) {
    return Collections.singletonList(new DeletedVersionResponseObject(lastDeletionTimestamp,objectType,searchKey));
  }
  final int version=query.getObjectVersion();
  final int[] versions=query.getObjectVersions();
  if (version > versionInfos.size() || versions[0] > versionInfos.size() || versions[1] > versionInfos.size()) {
    return Collections.singletonList(new MessageObject(QueryMessages.versionOutOfRange(versionInfos.size())));
  }
  if (query.isVersionList()) {
    return getAllVersions(res,searchKey);
  }
 else   if (query.isVersionDiff()) {
    return getVersionDiffs(res,versions);
  }
 else {
    return getVersion(res,version);
  }
}
Program: 161246
Project: 161246
Buggy source:
private Iterable<? extends ResponseObject> getVersionDiffs(final VersionLookupResult res,final Query query){
  final List<VersionInfo> versionInfos=res.getVersionInfos();
  final int[] versions=query.getObjectVersions();
  if ((versions[0] < 1 || versions[0] > versionInfos.size()) || (versions[1] < 1 || versions[1] > versionInfos.size())) {
    return Collections.singletonList(new MessageObject(QueryMessages.versionOutOfRange(versionInfos.size())));
  }
  final VersionInfo firstInfo=versionInfos.get(versions[0] - 1);
  final RpslObject firstObject=filter(versionDao.getRpslObject(firstInfo));
  final VersionInfo secondInfo=versionInfos.get(versions[1] - 1);
  final RpslObject secondObject=filter(versionDao.getRpslObject(secondInfo));
  return Lists.newArrayList(new MessageObject(QueryMessages.versionDifferenceHeader(versions[0],versions[1],firstObject.getKey())),new MessageObject(secondObject.diff(firstObject)));
}

Fixed version (ground truth):
private Iterable<? extends ResponseObject> getVersionDiffs(final VersionLookupResult res,final int[] versions){
  final List<VersionInfo> versionInfos=res.getVersionInfos();
  final RpslObject firstObject=filter(versionDao.getRpslObject(versionInfos.get(versions[0] - 1)));
  final RpslObject secondObject=filter(versionDao.getRpslObject(versionInfos.get(versions[1] - 1)));
  return Lists.newArrayList(new MessageObject(QueryMessages.versionDifferenceHeader(versions[0],versions[1],firstObject.getKey())),new MessageObject(secondObject.diff(firstObject)));
}
Program: 161247
Project: 161247
Buggy source:
public int[] getObjectVersions(){
  try {
    if (hasOption(QueryFlag.DIFF_VERSIONS)) {
      final String[] values=StringUtils.split(getOptionValue(QueryFlag.DIFF_VERSIONS),':');
      if (values.length != 2) {
        throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery("String_Node_Str"));
      }
      final int firstValue=Integer.parseInt(values[0]);
      final int secondValue=Integer.parseInt(values[1]);
      if (firstValue < 1 || secondValue < 1) {
        throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery("String_Node_Str"));
      }
      if (secondValue == firstValue) {
        throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery("String_Node_Str"));
      }
      return new int[]{firstValue,secondValue};
    }
  }
 catch (  OptionException ignored) {
  }
  throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery());
}

Fixed version (ground truth):
public int[] getObjectVersions(){
  if (hasOption(QueryFlag.DIFF_VERSIONS)) {
    final String[] values=StringUtils.split(getOptionValue(QueryFlag.DIFF_VERSIONS),':');
    if (values.length != 2) {
      throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery("String_Node_Str"));
    }
    final int firstValue=Integer.parseInt(values[0]);
    final int secondValue=Integer.parseInt(values[1]);
    if (firstValue < 1 || secondValue < 1) {
      throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery("String_Node_Str"));
    }
    if (secondValue == firstValue) {
      throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery("String_Node_Str"));
    }
    return new int[]{firstValue,secondValue};
  }
  return new int[]{-1,-1};
}
Program: 161248
Project: 161248
Buggy source:
public int getObjectVersion(){
  try {
    if (hasOption(QueryFlag.SHOW_VERSION)) {
      int version=Integer.parseInt(getOptionValue(QueryFlag.SHOW_VERSION));
      if (version < 1) {
        throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery("String_Node_Str"));
      }
      return version;
    }
    return -1;
  }
 catch (  OptionException e) {
    throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery());
  }
}

Fixed version (ground truth):
public int getObjectVersion(){
  if (hasOption(QueryFlag.SHOW_VERSION)) {
    int version=Integer.parseInt(getOptionValue(QueryFlag.SHOW_VERSION));
    if (version < 1) {
      throw new QueryException(QueryCompletionInfo.PARAMETER_ERROR,QueryMessages.malformedQuery("String_Node_Str"));
    }
    return version;
  }
  return -1;
}
Program: 161249
Project: 161249
Buggy source:
public int getNrUpdate(){
  return getCount(Action.MODIFY,succeededUpdates);
}

Fixed version (ground truth):
public int getNrUpdate(){
  return Iterables.size(Iterables.filter(succeededUpdates,new Predicate<UpdateResult>(){
    @Override public boolean apply(    @Nullable UpdateResult input){
      return Action.MODIFY.equals(input.getAction()) && UpdateStatus.SUCCESS.equals(input.getStatus());
    }
  }
));
}
Program: 161250
Project: 161250
Buggy source:
public Ack(final List<UpdateResult> updateResults,final List<Paragraph> ignoredParagraphs){
  final List<UpdateResult> succeeded=Lists.newArrayList();
  final List<UpdateResult> failed=Lists.newArrayList();
  for (  final UpdateResult updateResult : updateResults) {
switch (updateResult.getStatus()) {
case SUCCESS:
      succeeded.add(updateResult);
    break;
case PENDING_AUTHENTICATION:
  break;
default :
failed.add(updateResult);
}
}
this.succeededUpdates=Collections.unmodifiableList(succeeded);
this.failedUpdates=Collections.unmodifiableList(failed);
this.ignoredParagraphs=Collections.unmodifiableList(ignoredParagraphs);
}

Fixed version (ground truth):
public Ack(final List<UpdateResult> updateResults,final List<Paragraph> ignoredParagraphs){
  final List<UpdateResult> succeeded=Lists.newArrayList();
  final List<UpdateResult> failed=Lists.newArrayList();
  for (  final UpdateResult updateResult : updateResults) {
switch (updateResult.getStatus()) {
case SUCCESS:
case PENDING_AUTHENTICATION:
      succeeded.add(updateResult);
    break;
default :
  failed.add(updateResult);
}
}
this.succeededUpdates=Collections.unmodifiableList(succeeded);
this.failedUpdates=Collections.unmodifiableList(failed);
this.ignoredParagraphs=Collections.unmodifiableList(ignoredParagraphs);
}
Program: 161251
Project: 161251
Buggy source:
public int getNrDelete(){
  return getCount(Action.DELETE,succeededUpdates);
}

Fixed version (ground truth):
public int getNrDelete(){
  return Iterables.size(Iterables.filter(succeededUpdates,new Predicate<UpdateResult>(){
    @Override public boolean apply(    @Nullable UpdateResult input){
      return Action.DELETE.equals(input.getAction()) && UpdateStatus.SUCCESS.equals(input.getStatus());
    }
  }
));
}
Program: 161252
Project: 161252
Buggy source:
public int getNrNoop(){
  return getCount(Action.NOOP,succeededUpdates);
}

Fixed version (ground truth):
public int getNrNoop(){
  return Iterables.size(Iterables.filter(succeededUpdates,new Predicate<UpdateResult>(){
    @Override public boolean apply(    @Nullable UpdateResult input){
      return Action.NOOP.equals(input.getAction()) || UpdateStatus.PENDING_AUTHENTICATION.equals(input.getStatus());
    }
  }
));
}
Program: 161253
Project: 161253
Buggy source:
public int getNrDeleteErrors(){
  return getCount(Action.DELETE,failedUpdates);
}

Fixed version (ground truth):
public int getNrDeleteErrors(){
  return Iterables.size(Iterables.filter(failedUpdates,new Predicate<UpdateResult>(){
    @Override public boolean apply(    @Nullable UpdateResult input){
      return Action.DELETE.equals(input.getAction());
    }
  }
));
}
Program: 161254
Project: 161254
Buggy source:
public int getNrCreateErrors(){
  return getCount(Action.CREATE,failedUpdates);
}

Fixed version (ground truth):
public int getNrCreateErrors(){
  return Iterables.size(Iterables.filter(failedUpdates,new Predicate<UpdateResult>(){
    @Override public boolean apply(    @Nullable UpdateResult input){
      return Action.CREATE.equals(input.getAction());
    }
  }
));
}
Program: 161255
Project: 161255
Buggy source:
public int getNrUpdateErrors(){
  return getCount(Action.MODIFY,failedUpdates);
}

Fixed version (ground truth):
public int getNrUpdateErrors(){
  return Iterables.size(Iterables.filter(failedUpdates,new Predicate<UpdateResult>(){
    @Override public boolean apply(    @Nullable UpdateResult input){
      return Action.MODIFY.equals(input.getAction());
    }
  }
));
}
Program: 161256
Project: 161256
Buggy source:
public int getNrCreate(){
  return getCount(Action.CREATE,succeededUpdates);
}

Fixed version (ground truth):
public int getNrCreate(){
  return Iterables.size(Iterables.filter(succeededUpdates,new Predicate<UpdateResult>(){
    @Override public boolean apply(    @Nullable UpdateResult input){
      return Action.CREATE.equals(input.getAction()) && UpdateStatus.SUCCESS.equals(input.getStatus());
    }
  }
));
}
Program: 161259
Project: 161259
Buggy source:
@Override @RetryFor(value=MailSendException.class,attempts=20,intervalMs=10000) public void sendEmail(final String to,final String subject,final String text){
  if (!outgoingMailEnabled) {
    LOGGER.warn("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",to,subject,text);
    return;
  }
  try {
    sendEmailAttempt(to,subject,text);
  }
 catch (  MailSendException e) {
    loggerContext.log(new Message(Messages.Type.ERROR,"String_Node_Str",to,subject),e);
    throw e;
  }
catch (  MailParseException e) {
    loggerContext.log(new Message(Messages.Type.ERROR,"String_Node_Str",to,subject),e);
  }
catch (  MailException e) {
    LOGGER.error("String_Node_Str",to,e);
  }
}

Fixed version (ground truth):
@Override public void sendEmail(final String to,final String subject,final String text){
  if (!outgoingMailEnabled) {
    LOGGER.warn("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",to,subject,text);
    return;
  }
  try {
    sendEmailAttempt(to,subject,text);
  }
 catch (  MailException e) {
    loggerContext.log(new Message(Messages.Type.ERROR,"String_Node_Str",to,subject),e);
    LOGGER.error("String_Node_Str",to,e);
  }
}
Program: 161260
Project: 161260
Buggy source:
private void sendEmailAttempt(final String to,final String subject,final String text){
  mailSender.send(new MimeMessagePreparator(){
    @Override public void prepare(    final MimeMessage mimeMessage) throws MessagingException {
      final MimeMessageHelper message=new MimeMessageHelper(mimeMessage,MimeMessageHelper.MULTIPART_MODE_NO,"String_Node_Str");
      message.setFrom(mailConfiguration.getFrom());
      message.setTo(to);
      message.setSubject(subject);
      message.setText(text);
      mimeMessage.addHeader("String_Node_Str","String_Node_Str");
      mimeMessage.addHeader("String_Node_Str","String_Node_Str");
      loggerContext.log("String_Node_Str",new MailMessageLogCallback(mimeMessage));
    }
  }
);
}

Fixed version (ground truth):
@RetryFor(value=MailSendException.class,attempts=20,intervalMs=10000) private void sendEmailAttempt(final String to,final String subject,final String text){
  mailSender.send(new MimeMessagePreparator(){
    @Override public void prepare(    final MimeMessage mimeMessage) throws MessagingException {
      final MimeMessageHelper message=new MimeMessageHelper(mimeMessage,MimeMessageHelper.MULTIPART_MODE_NO,"String_Node_Str");
      message.setFrom(mailConfiguration.getFrom());
      message.setTo(to);
      message.setSubject(subject);
      message.setText(text);
      mimeMessage.addHeader("String_Node_Str","String_Node_Str");
      mimeMessage.addHeader("String_Node_Str","String_Node_Str");
      loggerContext.log("String_Node_Str",new MailMessageLogCallback(mimeMessage));
    }
  }
);
}
Program: 161261
Project: 161261
Buggy source:
private void createOrUpdate(final RpslObject importedObject){
  final GrsObjectInfo grsObjectInfo=grsSource.getDao().find(importedObject.getKey().toString(),importedObject.getType());
  if (grsObjectInfo == null) {
    create(importedObject);
  }
 else {
    currentObjectIds.remove(grsObjectInfo.getObjectId());
    if (!grsObjectInfo.getRpslObject().equals(importedObject)) {
      update(importedObject,grsObjectInfo);
    }
  }
}

Fixed version (ground truth):
private void createOrUpdate(final RpslObject importedObject){
  final String pkey=importedObject.getKey().toString();
  final ObjectType type=importedObject.getType();
  final GrsObjectInfo grsObjectInfo=grsSource.getDao().find(pkey,type);
  if (grsObjectInfo == null) {
    if (type == ObjectType.PERSON && grsSource.getDao().find(pkey,ObjectType.ROLE) != null) {
      return;
    }
    if (type == ObjectType.ROLE && grsSource.getDao().find(pkey,ObjectType.PERSON) != null) {
      return;
    }
    create(importedObject);
  }
 else {
    currentObjectIds.remove(grsObjectInfo.getObjectId());
    if (!grsObjectInfo.getRpslObject().equals(importedObject)) {
      update(importedObject,grsObjectInfo);
    }
  }
}
Program: 161264
Project: 161264
Buggy source:
private Set<Principal> performAuthentication(final PreparedUpdate update,final UpdateContext updateContext){
  final Set<Message> authenticationMessages=Sets.newLinkedHashSet();
  final Set<RpslObject> authenticatedObjects=Sets.newLinkedHashSet();
  if (update.getCredentials().ofType(PasswordCredential.class).size() > 20) {
    authenticationMessages.add(UpdateMessages.tooManyPasswordsSpecified());
  }
 else {
    for (    final AuthenticationStrategy authenticationStrategy : authenticationStrategies) {
      if (authenticationStrategy.supports(update)) {
        try {
          authenticatedObjects.addAll(authenticationStrategy.authenticate(update,updateContext));
        }
 catch (        AuthenticationFailedException e) {
          authenticationMessages.addAll(e.getAuthenticationMessages());
        }
      }
    }
  }
  if (!authenticationMessages.isEmpty()) {
    authenticationFailed(update,updateContext,authenticationMessages);
  }
  final Set<Principal> principals=Sets.newLinkedHashSet();
  for (  final RpslObject authenticatedObject : authenticatedObjects) {
    principals.addAll(getPrincipals(authenticatedObject));
  }
  return principals;
}

Fixed version (ground truth):
private Set<Principal> performAuthentication(Origin origin,final PreparedUpdate update,final UpdateContext updateContext){
  final Set<Message> authenticationMessages=Sets.newLinkedHashSet();
  final Set<RpslObject> authenticatedObjects=Sets.newLinkedHashSet();
  if (update.getCredentials().ofType(PasswordCredential.class).size() > 20) {
    authenticationMessages.add(UpdateMessages.tooManyPasswordsSpecified());
  }
 else {
    for (    final AuthenticationStrategy authenticationStrategy : authenticationStrategies) {
      if (authenticationStrategy.supports(update)) {
        try {
          authenticatedObjects.addAll(authenticationStrategy.authenticate(update,updateContext));
        }
 catch (        AuthenticationFailedException e) {
          authenticationMessages.addAll(e.getAuthenticationMessages());
        }
      }
    }
  }
  final Set<Principal> principals=Sets.newLinkedHashSet();
  for (  final RpslObject authenticatedObject : authenticatedObjects) {
    principals.addAll(getPrincipals(authenticatedObject));
  }
  if (!principals.isEmpty() && !origin.isDefaultOverride() && WhoisProfile.isDeployed()) {
    if (!origin.allowAdminOperations() || !ipRanges.isInRipeRange(IpInterval.parse(origin.getFrom()))) {
      authenticationMessages.add(UpdateMessages.ripeMntnerUpdatesOnlyAllowedFromWithinNetwork());
    }
  }
  if (!authenticationMessages.isEmpty()) {
    authenticationFailed(update,updateContext,authenticationMessages);
  }
  return principals;
}
Program: 161265
Project: 161265
Buggy source:
public void authenticate(final Origin origin,final PreparedUpdate update,final UpdateContext updateContext){
  final Set<Principal> principals;
  if (origin.isDefaultOverride()) {
    principals=Collections.singleton(Principal.OVERRIDE_MAINTAINER);
  }
 else   if (update.isOverride()) {
    principals=performOverrideAuthentication(origin,update,updateContext);
  }
 else {
    principals=performAuthentication(update,updateContext);
  }
  final Subject subject=new Subject(principals);
  updateContext.subject(update,subject);
}

Fixed version (ground truth):
public void authenticate(final Origin origin,final PreparedUpdate update,final UpdateContext updateContext){
  final Set<Principal> principals;
  if (origin.isDefaultOverride()) {
    principals=Collections.singleton(Principal.OVERRIDE_MAINTAINER);
  }
 else   if (update.isOverride()) {
    principals=performOverrideAuthentication(origin,update,updateContext);
  }
 else {
    principals=performAuthentication(origin,update,updateContext);
  }
  final Subject subject=new Subject(principals);
  updateContext.subject(update,subject);
}
Program: 161266
Project: 161266
Buggy source:
@Autowired JpirrGrsSource(@Value("String_Node_Str") final String source,@Value("String_Node_Str") final String resourceDataUrl,final SourceContext sourceContext,final DateTimeProvider dateTimeProvider){
  super(source,resourceDataUrl,sourceContext,dateTimeProvider);
}

Fixed version (ground truth):
@Autowired JpirrGrsSource(@Value("String_Node_Str") final String source,@Value("String_Node_Str") final String resourceDataUrl,@Value("String_Node_Str") final String download,final SourceContext sourceContext,final DateTimeProvider dateTimeProvider){
  super(source,resourceDataUrl,sourceContext,dateTimeProvider);
  this.download=download;
}
Program: 161267
Project: 161267
Buggy source:
@Autowired RadbGrsSource(@Value("String_Node_Str") final String source,@Value("String_Node_Str") final String resourceDataUrl,final SourceContext sourceContext,final DateTimeProvider dateTimeProvider){
  super(source,resourceDataUrl,sourceContext,dateTimeProvider);
}

Fixed version (ground truth):
@Autowired RadbGrsSource(@Value("String_Node_Str") final String source,@Value("String_Node_Str") final String resourceDataUrl,@Value("String_Node_Str") final String download,final SourceContext sourceContext,final DateTimeProvider dateTimeProvider){
  super(source,resourceDataUrl,sourceContext,dateTimeProvider);
  this.download=download;
}
Program: 161268
Project: 161268
Buggy source:
@Before public void setUp() throws Exception {
  objectHandler=new CaptureInputObjectHandler();
  subject=new JpirrGrsSource("String_Node_Str","String_Node_Str",sourceContext,dateTimeProvider);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  objectHandler=new CaptureInputObjectHandler();
  subject=new JpirrGrsSource("String_Node_Str","String_Node_Str","String_Node_Str",sourceContext,dateTimeProvider);
}
Program: 161269
Project: 161269
Buggy source:
@Test public void acquire() throws IOException {
  final String download="String_Node_Str";
  subject=spy(subject);
  subject.setDownload(download);
  doNothing().when(subject).downloadToFile(any(URL.class),any(File.class));
  final File file=File.createTempFile("String_Node_Str","String_Node_Str");
  subject.acquireDump(file);
  verify(subject).downloadToFile(new URL(download),file);
}

Fixed version (ground truth):
@Test public void acquire() throws IOException {
  final String download="String_Node_Str";
  subject=spy(subject);
  doNothing().when(subject).downloadToFile(any(URL.class),any(File.class));
  final File file=File.createTempFile("String_Node_Str","String_Node_Str");
  subject.acquireDump(file);
  verify(subject).downloadToFile(new URL(download),file);
}
Program: 161270
Project: 161270
Buggy source:
@Before public void setUp() throws Exception {
  objectHandler=new CaptureInputObjectHandler();
  subject=new RadbGrsSource("String_Node_Str","String_Node_Str",sourceContext,dateTimeProvider);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  objectHandler=new CaptureInputObjectHandler();
  subject=new RadbGrsSource("String_Node_Str","String_Node_Str","String_Node_Str",sourceContext,dateTimeProvider);
}
Program: 161271
Project: 161271
Buggy source:
@Test public void acquire() throws IOException {
  final String download="String_Node_Str";
  subject=spy(subject);
  subject.setDownload(download);
  doNothing().when(subject).downloadToFile(any(URL.class),any(File.class));
  final File file=File.createTempFile("String_Node_Str","String_Node_Str");
  subject.acquireDump(file);
  verify(subject).downloadToFile(new URL(download),file);
}

Fixed version (ground truth):
@Test public void acquire() throws IOException {
  final String download="String_Node_Str";
  subject=spy(subject);
  doNothing().when(subject).downloadToFile(any(URL.class),any(File.class));
  final File file=File.createTempFile("String_Node_Str","String_Node_Str");
  subject.acquireDump(file);
  verify(subject).downloadToFile(new URL(download),file);
}
Program: 161274
Project: 161274
Buggy source:
@Test public void testVcfTrap() throws IOException {
  final File dbFile=new File(TEST_RESULTS_DIR,"String_Node_Str");
  PrintWriter pw=new PrintWriter(dbFile);
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  pw.flush();
  pw.close();
  final File indexFile=new File(TEST_RESULTS_DIR,"String_Node_Str");
  Assert.assertEquals(0,new TrapIndexer().instanceMain(new String[]{"String_Node_Str",indexFile.getPath(),dbFile.getPath()}));
  final File manifestFile=new File(TEST_RESULTS_DIR,"String_Node_Str");
  pw=new PrintWriter(manifestFile);
  pw.println("String_Node_Str" + indexFile.getPath());
  pw.flush();
  pw.close();
  final File outvcf=new File(TEST_RESULTS_DIR,"String_Node_Str");
  Assert.assertEquals(0,new VcfTrap().instanceMain(new String[]{"String_Node_Str",outvcf.getPath(),"String_Node_Str","String_Node_Str","String_Node_Str",manifestFile.getPath(),"String_Node_Str"}));
  Assert.assertTrue(streamVcf(outvcf).anyMatch(V -> V.hasAttribute("String_Node_Str")));
  Assert.assertTrue(manifestFile.delete());
  Assert.assertTrue(indexFile.delete());
  Assert.assertTrue(dbFile.delete());
  Assert.assertTrue(outvcf.delete());
}

Fixed version (ground truth):
@Test public void testVcfTrap() throws IOException {
  final File dbFile=new File(TEST_RESULTS_DIR,"String_Node_Str");
  PrintWriter pw=new PrintWriter(dbFile);
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  pw.flush();
  pw.close();
  final File indexFile=new File(TEST_RESULTS_DIR,"String_Node_Str");
  Assert.assertEquals(0,new TrapIndexer().instanceMain(new String[]{"String_Node_Str",indexFile.getPath(),dbFile.getPath()}));
  final File manifestFile=new File(TEST_RESULTS_DIR,"String_Node_Str");
  pw=new PrintWriter(manifestFile);
  pw.println("String_Node_Str" + indexFile.getPath());
  pw.flush();
  pw.close();
  final File outvcf=new File(TEST_RESULTS_DIR,"String_Node_Str");
  Assert.assertEquals(0,new VcfTrap().instanceMain(new String[]{"String_Node_Str",outvcf.getPath(),"String_Node_Str","String_Node_Str","String_Node_Str",manifestFile.getPath(),"String_Node_Str"}));
  Assert.assertTrue(streamVcf(outvcf).anyMatch(V -> V.hasAttribute("String_Node_Str")));
  Assert.assertTrue(manifestFile.delete());
  Assert.assertTrue(indexFile.delete());
  Assert.assertTrue(dbFile.delete());
  Assert.assertTrue(outvcf.delete());
}
Program: 161280
Project: 161280
Buggy source:
@Override protected VariantContext mapVariant(final VariantContext ctx,final RefMetaDataTracker tracker,final ReferenceContext ref,final AlignmentContext context){
  final Map<String,Object> m=annotator.getAnnotations(ctx);
  if (m == null || m.isEmpty()) {
    return ctx;
  }
 else {
    final VariantContextBuilder vcb=new VariantContextBuilder(ctx);
    for (    final String key : m.keySet()) {
      vcb.attribute(key,m.get(key));
    }
    return vcb.make();
  }
}

Fixed version (ground truth):
@Override protected VariantContext mapVariant(final VariantContext ctx,final RefMetaDataTracker tracker,final ReferenceContext ref,final AlignmentContext context){
  final Map<String,Object> m=this.annotator.getAnnotations(ctx);
  if (m == null || m.isEmpty()) {
    return ctx;
  }
 else {
    final VariantContextBuilder vcb=new VariantContextBuilder(ctx);
    for (    final String key : m.keySet()) {
      vcb.attribute(key,m.get(key));
    }
    return vcb.make();
  }
}
Program: 161282
Project: 161282
Buggy source:
protected abstract B getThis();

Fixed version (ground truth):
protected abstract BUILDER getThis();
Program: 161283
Project: 161283
Buggy source:
protected B shortOpt(final String s){
  this.instance.shortopt=s;
  return getThis();
}

Fixed version (ground truth):
public BUILDER shortOpt(final String s){
  this.get().shortArg=s;
  return getThis();
}
Program: 161284
Project: 161284
Buggy source:
protected B longOpt(final String s){
  this.instance.longOpt=s;
  return getThis();
}

Fixed version (ground truth):
public BUILDER longOpt(final String s){
  this.get().longArg=s;
  return getThis();
}
Program: 161285
Project: 161285
Buggy source:
private TrioGenotype(final Genotype children,final Genotype father,final Genotype mother){
  this.children=children;
  this.father=father;
  this.mother=father;
}

Fixed version (ground truth):
private TrioGenotype(final Genotype children,final Genotype father,final Genotype mother){
  this.children=children;
  this.father=father;
  this.mother=mother;
}
Program: 161286
Project: 161286
Buggy source:
public boolean isMendelianIncompatibility(){
  if (children == null || children.isNoCall())   return false;
  if (father == null || father.isNoCall()) {
    return this._isMendelianIncompatibility(children,mother);
  }
  if (mother == null || mother.isNoCall()) {
    return this._isMendelianIncompatibility(children,father);
  }
  final Allele alleles[]=new Allele[2];
  for (  final Allele af : father.getAlleles()) {
    alleles[0]=af;
    for (    final Allele am : mother.getAlleles()) {
      alleles[1]=am;
      final Genotype sim=new GenotypeBuilder(children.getSampleName()).alleles(Arrays.asList(alleles)).make();
      if (sim.sameGenotype(sim,true))       return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean isMendelianIncompatibility(){
  if (children == null || children.isNoCall())   return false;
  if (father == null || father.isNoCall()) {
    return this._isMendelianIncompatibility(children,mother);
  }
  if (mother == null || mother.isNoCall()) {
    return this._isMendelianIncompatibility(children,father);
  }
  final Allele alleles[]=new Allele[2];
  for (  final Allele af : father.getAlleles()) {
    alleles[0]=af;
    for (    final Allele am : mother.getAlleles()) {
      alleles[1]=am;
      final Genotype sim=new GenotypeBuilder(children.getSampleName()).alleles(Arrays.asList(alleles)).make();
      if (children.sameGenotype(sim,true))       return false;
    }
  }
  return true;
}
Program: 161287
Project: 161287
Buggy source:
public boolean isMendelianIncompatibility(final Genotype child,final Genotype father,final Genotype mother){
  if (child == null || child.isNoCall())   return false;
  if (father == null || father.isNoCall()) {
    return this.isMendelianIncompatibility(child,mother);
  }
  if (mother == null || mother.isNoCall()) {
    return this.isMendelianIncompatibility(child,father);
  }
  final Allele alleles[]=new Allele[2];
  for (  final Allele af : father.getAlleles()) {
    alleles[0]=af;
    for (    final Allele am : mother.getAlleles()) {
      alleles[1]=am;
      final Genotype sim=new GenotypeBuilder(child.getSampleName()).alleles(Arrays.asList(alleles)).make();
      if (sim.sameGenotype(sim,true))       return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean isMendelianIncompatibility(final Genotype child,final Genotype father,final Genotype mother){
  if (child == null || child.isNoCall())   return false;
  if (father == null || father.isNoCall()) {
    return this.isMendelianIncompatibility(child,mother);
  }
  if (mother == null || mother.isNoCall()) {
    return this.isMendelianIncompatibility(child,father);
  }
  final Allele alleles[]=new Allele[2];
  for (  final Allele af : father.getAlleles()) {
    alleles[0]=af;
    for (    final Allele am : mother.getAlleles()) {
      alleles[1]=am;
      final Genotype sim=new GenotypeBuilder(child.getSampleName()).alleles(Arrays.asList(alleles)).make();
      if (child.sameGenotype(sim,true))       return false;
    }
  }
  return true;
}