Source:
public boolean nextKeyValue() throws IOException, InterruptedException { currentKey = new LongWritable(); currentValue = new HashMap<String, String>(); int lastNodeIndex = totalNodes - 1; String lastNode = nodes[lastNodeIndex]; StringBuilder xmlRecord = new StringBuilder(); boolean xmlRecordReady = false; boolean nodeFound = false; try { while (reader.hasNext()) { int event = reader.next(); switch (event) { case XMLStreamConstants.START_ELEMENT: String nodeNameStart = reader.getLocalName(); boolean validHierarchy = true; currentNodeLevelMap.put(nodeLevel, nodeNameStart); for (int j = nodeLevel; j >= 0; j--) { if (!currentNodeLevelMap.get(j).equals(actualNodeLevelMap.get(j))) { validHierarchy = false; } } if (validHierarchy && nodeNameStart.equals(lastNode)) { appendStartTagInformation(nodeNameStart, xmlRecord); nodeFound = true; currentKey.set(reader.getLocation().getLineNumber()); } else if (nodeFound) { appendStartTagInformation(nodeNameStart, xmlRecord); } nodeLevel++; break; case XMLStreamConstants.CHARACTERS: if (nodeFound) { xmlRecord.append(reader.getText()); } break; case XMLStreamConstants.END_ELEMENT: String nodeNameEnd = reader.getLocalName(); if (nodeFound) { xmlRecord.append(OPENING_END_TAG_DELIMITER).append(nodeNameEnd).append(CLOSING_END_TAG_DELIMITER); if (nodeNameEnd.equals(lastNode)) { nodeFound = false; xmlRecordReady = true; } } nodeLevel--; break; case XMLStreamConstants.START_DOCUMENT: break; } if (xmlRecordReady) { currentValue.put(fileName, xmlRecord.toString()); return true; } } } catch (XMLStreamException exception) { throw new IllegalArgumentException(exception.getMessage()); } actionsAfterEOF(); return false; }

Target:
public boolean nextKeyValue() throws IOException, InterruptedException { currentKey = new LongWritable(); currentValue = new HashMap<String, String>(); String lastNode = nodes[nodes.length - 1]; StringBuilder xmlRecord = new StringBuilder(); boolean xmlRecordReady = false; boolean nodeFound = false; try { while (reader.hasNext()) { int event = reader.next(); switch (event) { case XMLStreamConstants.START_ELEMENT: String nodeNameStart = reader.getLocalName(); boolean validHierarchy = true; currentNodeLevelMap.put(nodeLevel, nodeNameStart); for (int j = nodeLevel; j >= 0; j--) { if (j < nodes.length && !currentNodeLevelMap.get(j).equals(nodes[j])) { validHierarchy = false; } } if (validHierarchy && nodeNameStart.equals(lastNode)) { appendStartTagInformation(nodeNameStart, xmlRecord); nodeFound = true; currentKey.set(reader.getLocation().getLineNumber()); } else if (nodeFound) { appendStartTagInformation(nodeNameStart, xmlRecord); } nodeLevel++; break; case XMLStreamConstants.CHARACTERS: if (nodeFound) { xmlRecord.append(reader.getText()); } break; case XMLStreamConstants.END_ELEMENT: String nodeNameEnd = reader.getLocalName(); if (nodeFound) { xmlRecord.append(OPENING_END_TAG_DELIMITER).append(nodeNameEnd).append(CLOSING_END_TAG_DELIMITER); if (nodeNameEnd.equals(lastNode)) { nodeFound = false; xmlRecordReady = true; } } nodeLevel--; break; case XMLStreamConstants.START_DOCUMENT: break; } if (xmlRecordReady) { currentValue.put(fileName, xmlRecord.toString()); return true; } } } catch (XMLStreamException exception) { throw new IllegalArgumentException(exception); } updateFileTrackingInfo(); processFileAction(); return false; }