Source:
<code>private List<String> optionCellValues(Long questionId, String value, boolean useQuestionId, List<QuestionOptionDto> options, Boolean allowOther) { List<String> cells = new ArrayList<>(); List<Map<String,String>> optionNodes = getNodes(value); String optionString = buildOptionString(optionNodes); cells.add(optionString); if (useQuestionId){ String text; String code; String cacheId; String other = null; boolean found; int numOptions = options.size(); boolean[] optionFound = new boolean[numOptions]; String qId = questionId.toString(); for (Map<String,String> optAnswer : optionNodes){ text = optAnswer.get("text") != null ? optAnswer.get("text") : ""; code = optAnswer.get("code") != null ? optAnswer.get("code") : ""; found = false; cacheId = qId + text + code; if (optionCache.containsKey(cacheId)){ optionFound[optionCache.get(cacheId)] = true; found = true; } if (!found){ for (int i = 0; i < numOptions; i++){ if (text != null && text.equalsIgnoreCase(options.get(i).getText()) && text.length() > 0){ optionFound[i] = true; found = true; optionCache.put(cacheId, i); break; } } } if (!found){ for (int i = 0; i < numOptions; i++){ <START> if (code != null && code.equalsIgnoreCase(options.get(i).getCode()) && code.length() > 0){ <END> optionFound[i] = true; found = true; optionCache.put(cacheId, i); break; } } } if (!found){ other = text; } } for (int i = 0; i < numOptions; i++){ cells.add(optionFound[i] ? "1" : "0"); } if (allowOther){ cells.add(other != null ? other : ""); } } return cells; }</code><technical_language>I more secure flip conditions check code.length() > 0 code.equalsIgnoreCase(options...)</technical_language>

Target:
private List<String> optionCellValues(Long questionId, String value, boolean useQuestionId, List<QuestionOptionDto> options, Boolean allowOther) { List<String> cells = new ArrayList<>(); List<Map<String, String>> optionNodes = getNodes(value); String optionString = buildOptionString(optionNodes); cells.add(optionString); if (useQuestionId) { String text; String code; String cacheId; String other = null; boolean found; int numOptions = options.size(); boolean[] optionFound = new boolean[numOptions]; String qId = questionId.toString(); for (Map<String, String> optAnswer : optionNodes) { text = optAnswer.get("text") != null ? optAnswer.get("text") : ""; code = optAnswer.get("code") != null ? optAnswer.get("code") : ""; found = false; cacheId = qId + text + code; if (optionsPositionCache.containsKey(cacheId)) { optionFound[optionsPositionCache.get(cacheId)] = true; found = true; } if (!found) { for (int i = 0; i < numOptions; i++) { if (text != null && text.length() > 0 && text.equalsIgnoreCase(options.get(i).getText())) { optionFound[i] = true; found = true; optionsPositionCache.put(cacheId, i); break; } } } if (!found) { for (int i = 0; i < numOptions; i++) { if (code != null && code.length() > 0 && code.equalsIgnoreCase(options.get(i).getCode())) { optionFound[i] = true; found = true; optionsPositionCache.put(cacheId, i); break; } } } if (!found) { other = text; } } for (int i = 0; i < numOptions; i++) { cells.add(optionFound[i] ? "1" : "0"); } if (allowOther) { cells.add(other != null ? other : ""); } } return cells; }