<commit_before>package org.tigris.subversion.svnclientadapter.javahl;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

import org.tigris.subversion.javahl.ChangePath;
import org.tigris.subversion.javahl.LogMessageCallback;
import org.tigris.subversion.javahl.Revision;

public class JhlLogMessageCallback implements LogMessageCallback {
	
	private List messages = new ArrayList();
	private Stack stack = new Stack();

	public void singleMessage(ChangePath[] changedPaths, long revision,
			String author, long timeMicros, String message, boolean hasChildren) {
		if (revision == Revision.SVN_INVALID_REVNUM) {
			stack.pop();
			return;
		}
		JhlLogMessage msg = new JhlLogMessage(changedPaths, revision, author, timeMicros, message, hasChildren);
		if (stack.empty()) {
				messages.add(msg);
		} else {
			JhlLogMessage current = (JhlLogMessage) stack.peek();
			current.addChild(msg);
		}
		if (hasChildren)
			stack.push(msg);
	}
	
	public JhlLogMessage[] getLogMessages() {
		JhlLogMessage[] array = new JhlLogMessage[messages.size()];
		return (JhlLogMessage[]) messages.toArray(array);
	}
<commit_msg>Check if stack is empty before popping off a message.<commit_after>package org.tigris.subversion.svnclientadapter.javahl;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

import org.tigris.subversion.javahl.ChangePath;
import org.tigris.subversion.javahl.LogMessageCallback;
import org.tigris.subversion.javahl.Revision;

public class JhlLogMessageCallback implements LogMessageCallback {
	
	private List messages = new ArrayList();
	private Stack stack = new Stack();

	public void singleMessage(ChangePath[] changedPaths, long revision,
			String author, long timeMicros, String message, boolean hasChildren) {
		if (revision == Revision.SVN_INVALID_REVNUM) {
			if (!stack.empty())
				stack.pop();
			return;
		}
		JhlLogMessage msg = new JhlLogMessage(changedPaths, revision, author, timeMicros, message, hasChildren);
		if (stack.empty()) {
				messages.add(msg);
		} else {
			JhlLogMessage current = (JhlLogMessage) stack.peek();
			current.addChild(msg);
		}
		if (hasChildren)
			stack.push(msg);
	}
	
	public JhlLogMessage[] getLogMessages() {
		JhlLogMessage[] array = new JhlLogMessage[messages.size()];
		return (JhlLogMessage[]) messages.toArray(array);
	}

{'fraction_non_alphanumeric': 0.11087328767123288, 'fraction_numerical': 0.0, 'mean_word_length': 5.15, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5632282', 'n_tokens_mistral': 794, 'n_tokens_neox': 721, 'n_words': 169}