All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.stamp.botsing.preprocessing.ErrorMessage Maven / Gradle / Ivy

The newest version!
package eu.stamp.botsing.preprocessing;

import java.util.List;

public class ErrorMessage implements STProcessor {
	private final static String EXCEPTION_PREFIX = "Exception in thread";

	private static ErrorMessage instance = new ErrorMessage();

	public static ErrorMessage get() {
		return instance;
	}

	private ErrorMessage() {
	}

	@Override
	public List preprocess(List lines, String regexp) {
		if (lines.size() < 1) {
			return lines;
		}
		String head = lines.get(0);
        // remove thread info
		if (head.startsWith(EXCEPTION_PREFIX)) {
			head = head.replaceAll(EXCEPTION_PREFIX + " \".*\" ", "");
		}
		if (head.contains(":")) {
			head = head.replaceAll("\\:.*", "");
		}
		lines.set(0, head);
		return lines;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy