Source:
<code>private Integer parseRepeatsForInstance(InstanceData instanceData, Sheet repSheet, int currentRowIndex, Map<String, Integer> metadataColumnHeaderIdx, Map<Long, QuestionDto> questionIdToQuestionDto, Map<Integer, Long> columnIndexToQuestionId, Map<Long, List<QuestionOptionDto>> optionNodes, List<Row> checksumRows) { int identifierColumnIndex = metadataColumnHeaderIdx.get(DATAPOINT_IDENTIFIER_COLUMN_KEY); int repeatIterationColumnIndex = metadataColumnHeaderIdx.get(REPEAT_COLUMN_KEY); <START> String DataPointIdentifier = instanceData.surveyInstanceDto.getSurveyedLocaleIdentifier(); <END> int rowIx = currentRowIndex; Row row; while (true) { row = repSheet.getRow(rowIx); if (row != null && row.getCell(identifierColumnIndex) != null && row.getCell(identifierColumnIndex).getStringCellValue().equals(DataPointIdentifier)) { break; } else { if (isEmptyRow(row)) { rowIx = 1; } rowIx++; if (rowIx == currentRowIndex) { return rowIx; } } } Map<Long, Map<Long, String>> responseMap = new HashMap<>(); while (row != null && row.getCell(identifierColumnIndex) != null && row.getCell(identifierColumnIndex).getStringCellValue().equals(DataPointIdentifier) && row.getCell(repeatIterationColumnIndex) != null && row.getCell(repeatIterationColumnIndex).getCellType() == Cell.CELL_TYPE_NUMERIC) { Long rep = (long) row.getCell(repeatIterationColumnIndex).getNumericCellValue(); if (rep < 1) { break;} checksumRows.add(row); for (Entry<Integer, Long> m : columnIndexToQuestionId.entrySet()) { int columnIndex = m.getKey(); long questionId = m.getValue(); QuestionDto questionDto = questionIdToQuestionDto.get(questionId); QuestionType questionType = questionDto.getType(); getIterationResponse(row, columnIndex, responseMap, questionType, questionId, questionDto, rep, optionNodes); } rowIx++; row = repSheet.getRow(rowIx); } if (!instanceData.addResponses(responseMap)) { log.warn("Some questions have answers on more than one sheet!"); } return rowIx; }</code><technical_language>Do akvo java formatting profile setup? auto format variable names start lowercase..</technical_language>

Target:
private Integer parseRepeatsForInstance(InstanceData instanceData, Sheet repSheet, int currentRowIndex, Map<String, Integer> metadataColumnHeaderIdx, Map<Long, QuestionDto> questionIdToQuestionDto, Map<Integer, Long> columnIndexToQuestionId, Map<Long, List<QuestionOptionDto>> optionNodes, List<Row> checksumRows) { int identifierColumnIndex = metadataColumnHeaderIdx.get(DATAPOINT_IDENTIFIER_COLUMN_KEY); int repeatIterationColumnIndex = metadataColumnHeaderIdx.get(REPEAT_COLUMN_KEY); String dataPointIdentifier = instanceData.surveyInstanceDto.getSurveyedLocaleIdentifier(); int rowIx = currentRowIndex; Row row; while (true) { row = repSheet.getRow(rowIx); if (row != null && row.getCell(identifierColumnIndex) != null && row.getCell(identifierColumnIndex).getStringCellValue().equals(dataPointIdentifier)) { break; } else { if (rowIx > repSheet.getLastRowNum()) { rowIx = 1; } } rowIx++; if (rowIx == currentRowIndex) { return rowIx; } } Map<Long, Map<Long, String>> responseMap = new HashMap<>(); while (row != null && row.getCell(identifierColumnIndex) != null && row.getCell(identifierColumnIndex).getStringCellValue().equals(dataPointIdentifier) && row.getCell(repeatIterationColumnIndex) != null && row.getCell(repeatIterationColumnIndex).getCellType() == Cell.CELL_TYPE_NUMERIC) { Long rep = (long) row.getCell(repeatIterationColumnIndex).getNumericCellValue(); if (rep < 1) { continue;} checksumRows.add(row); for (Entry<Integer, Long> m : columnIndexToQuestionId.entrySet()) { int columnIndex = m.getKey(); long questionId = m.getValue(); QuestionDto questionDto = questionIdToQuestionDto.get(questionId); QuestionType questionType = questionDto.getType(); getIterationResponse(row, columnIndex, responseMap, questionType, questionId, questionDto, rep, optionNodes); } rowIx++; row = repSheet.getRow(rowIx); } if (!instanceData.addResponses(responseMap)) { log.warn("Some questions have answers on more than one sheet!"); } return rowIx; }