private Vector decodeEvents()

in src/main/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java [304:444]


    private Vector<ChainsawLoggingEvent> decodeEvents(final Document document) {
        Vector<ChainsawLoggingEvent> events = new Vector<>();

        NodeList eventList = document.getElementsByTagName("record");

        for (int eventIndex = 0; eventIndex < eventList.getLength();
             eventIndex++) {
            Node eventNode = eventList.item(eventIndex);

            String logger = null;
            long timeStamp = 0L;
            String level = null;
            String threadName = null;
            String message = null;
            String ndc = null;
            String[] exception = null;
            String className = null;
            String methodName = null;
            String fileName = null;
            String lineNumber = null;
            Hashtable properties = new Hashtable();

            //format of date: 2003-05-04T11:04:52
            //ignore date or set as a property? using millis in constructor instead
            NodeList list = eventNode.getChildNodes();
            int listLength = list.getLength();

            if (listLength == 0) {
                continue;
            }

            for (int y = 0; y < listLength; y++) {
                String tagName = list.item(y).getNodeName();

                if (tagName.equalsIgnoreCase("logger")) {
                    logger = getCData(list.item(y));
                }

                if (tagName.equalsIgnoreCase("millis")) {
                    timeStamp = Long.parseLong(getCData(list.item(y)));
                }

                if (tagName.equalsIgnoreCase("level")) {
                    level = getCData(list.item(y));
                }

                if (tagName.equalsIgnoreCase("thread")) {
                    threadName = getCData(list.item(y));
                }

                if (tagName.equalsIgnoreCase("sequence")) {
                    properties.put("log4jid", getCData(list.item(y)));
                }

                if (tagName.equalsIgnoreCase("message")) {
                    message = getCData(list.item(y));
                }

                if (tagName.equalsIgnoreCase("class")) {
                    className = getCData(list.item(y));
                }

                if (tagName.equalsIgnoreCase("method")) {
                    methodName = getCData(list.item(y));
                }

                if (tagName.equalsIgnoreCase("exception")) {
                    ArrayList<String> exceptionList = new ArrayList<>();
                    NodeList exList = list.item(y).getChildNodes();
                    int exlistLength = exList.getLength();

                    for (int i2 = 0; i2 < exlistLength; i2++) {
                        Node exNode = exList.item(i2);
                        String exName = exList.item(i2).getNodeName();

                        if (exName.equalsIgnoreCase("message")) {
                            exceptionList.add(getCData(exList.item(i2)));
                        }

                        if (exName.equalsIgnoreCase("frame")) {
                            NodeList exList2 = exNode.getChildNodes();
                            int exlist2Length = exList2.getLength();

                            for (int i3 = 0; i3 < exlist2Length; i3++) {
                                exceptionList.add(getCData(exList2.item(i3)) + "\n");
                            }
                        }
                    }
                    if (exceptionList.size() > 0) {
                        exception =
                            (String[]) exceptionList.toArray(new String[exceptionList.size()]);
                    }
                }
            }

            /**
             * We add all the additional properties to the properties
             * hashtable. Override properties that already exist
             */
            if (additionalProperties.size() > 0) {
                if (properties == null) {
                    properties = new Hashtable(additionalProperties);
                }
                for (Object o : additionalProperties.entrySet()) {
                    Map.Entry e = (Map.Entry) o;
                    properties.put(e.getKey(), e.getValue());
                }
            }

            LocationInfo info;
            if ((fileName != null)
                || (className != null)
                || (methodName != null)
                || (lineNumber != null)) {
                info = new LocationInfo(fileName, className, methodName, 
                        Integer.parseInt(lineNumber));
            } else {
                info = null;
            }

//            ThrowableInformation throwableInfo = null;
//            if (exception != null) {
//                throwableInfo = new ThrowableInformation(exception);
//            }

            builder.clear();
            builder.setLogger(logger)
                    .setTimestamp(Instant.ofEpochMilli(timeStamp))
                    .setLevelFromString(level)
                    .setMessage(message)
                    .setThreadName(threadName)
                    .setMDC(properties)
                    .setNDC(ndc)
                    .setLocationInfo(info);


            events.add(builder.create());

        }
        return events;
    }