Program: 174786
Project: 174786
Buggy source:
/** 
 * Gets the list of all types in the repository.
 * @param parameters repositoryId: repository Id; typeId: type Id; returnPropertyDefinitions: false (default); maxItems: 0 = Repository-default number of items(Default);skipCount: 0 = start;
 * @return collection of CmisTypeDefinitionType and boolean hasMoreItems
 * @throws RuntimeException
 * @throws InvalidArgumentException
 * @throws ObjectNotFoundException
 * @throws ConstraintViolationException
 * @throws OperationNotSupportedException
 * @throws UpdateConflictException
 * @throws PermissionDeniedException
 */
public GetTypesResponse getTypes(GetTypes parameters) throws RuntimeException, InvalidArgumentException, ObjectNotFoundException, ConstraintViolationException, OperationNotSupportedException, UpdateConflictException, PermissionDeniedException {
  if (descriptorService.getServerDescriptor().getId().equals(parameters.getRepositoryId()) == false) {
    throw new InvalidArgumentException("String_Node_Str");
  }
  Collection<CMISTypeId> typeIds;
  if (parameters.getTypeId() == null) {
    typeIds=cmisDictionaryService.getAllObjectTypeIds();
  }
 else {
    typeIds=cmisDictionaryService.getChildTypeIds(cmisDictionaryService.getCMISMapping().getCmisTypeId(parameters.getTypeId().getValue()),true);
  }
  GetTypesResponse response=new GetTypesResponse();
  if (parameters.getMaxItems() != null) {
    response.setHasMoreItems(parameters.getMaxItems().getValue().intValue() < typeIds.size());
  }
  Cursor cursor=createCursor(typeIds.size(),parameters.getSkipCount() != null ? parameters.getSkipCount().getValue() : null,parameters.getMaxItems() != null ? parameters.getMaxItems().getValue() : null);
  Iterator<CMISTypeId> iterTypeIds=typeIds.iterator();
  for (int i=0; i < cursor.getStartRow(); i++) {
    iterTypeIds.next();
  }
  boolean returnPropertyDefinitions=parameters.getReturnPropertyDefinitions() == null ? false : parameters.getReturnPropertyDefinitions().getValue();
  List<JAXBElement<? extends CmisTypeDefinitionType>> types=response.getType();
  for (int i=cursor.getStartRow(); i <= cursor.getEndRow(); i++) {
    JAXBElement<? extends CmisTypeDefinitionType> element=getCmisTypeDefinition(iterTypeIds.next().getTypeId(),returnPropertyDefinitions);
    if (element != null) {
      types.add(element);
    }
  }
  return response;
}

Fixed version (ground truth):
/** 
 * Gets the list of all types in the repository.
 * @param parameters repositoryId: repository Id; typeId: type Id; returnPropertyDefinitions: false (default); maxItems: 0 = Repository-default number of items(Default);skipCount: 0 = start;
 * @return collection of CmisTypeDefinitionType and boolean hasMoreItems
 * @throws RuntimeException
 * @throws InvalidArgumentException
 * @throws ObjectNotFoundException
 * @throws ConstraintViolationException
 * @throws OperationNotSupportedException
 * @throws UpdateConflictException
 * @throws PermissionDeniedException
 */
public GetTypesResponse getTypes(GetTypes parameters) throws RuntimeException, InvalidArgumentException, ObjectNotFoundException, ConstraintViolationException, OperationNotSupportedException, UpdateConflictException, PermissionDeniedException {
  checkRepositoryId(parameters.getRepositoryId());
  Collection<CMISTypeId> typeIds;
  if (parameters.getTypeId() == null) {
    typeIds=cmisDictionaryService.getAllObjectTypeIds();
  }
 else {
    typeIds=cmisDictionaryService.getChildTypeIds(cmisDictionaryService.getCMISMapping().getCmisTypeId(parameters.getTypeId().getValue()),true);
  }
  GetTypesResponse response=new GetTypesResponse();
  if (parameters.getMaxItems() != null) {
    response.setHasMoreItems(parameters.getMaxItems().getValue().intValue() < typeIds.size());
  }
  Cursor cursor=createCursor(typeIds.size(),parameters.getSkipCount() != null ? parameters.getSkipCount().getValue() : null,parameters.getMaxItems() != null ? parameters.getMaxItems().getValue() : null);
  Iterator<CMISTypeId> iterTypeIds=typeIds.iterator();
  for (int i=0; i < cursor.getStartRow(); i++) {
    iterTypeIds.next();
  }
  boolean returnPropertyDefinitions=parameters.getReturnPropertyDefinitions() == null ? false : parameters.getReturnPropertyDefinitions().getValue();
  List<JAXBElement<? extends CmisTypeDefinitionType>> types=response.getType();
  for (int i=cursor.getStartRow(); i <= cursor.getEndRow(); i++) {
    JAXBElement<? extends CmisTypeDefinitionType> element=getCmisTypeDefinition(iterTypeIds.next().getTypeId(),returnPropertyDefinitions);
    if (element != null) {
      types.add(element);
    }
  }
  return response;
}