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

com.lone.common.util.ExceptionUtil Maven / Gradle / Ivy

The newest version!
package com.lone.common.util;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * Exception工具类
 */
public class ExceptionUtil {

	/**
	 * 返回错误信息字符串
	 * 
	 * @param ex
	 *            Exception
	 * @return 错误信息字符串
	 */
	public static String getExceptionMessage(Exception ex) {
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		ex.printStackTrace(pw);
		return sw.toString();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy