exceptionhandle.java

来自「导出ORACLE数据库对象DDL语句的程序」· Java 代码 · 共 35 行

JAVA
35
字号
package com.icbcsdc.ddlexp.pub.util;

/**
 * @author zhangyc
 *	处理异常信息的类
 */
public class ExceptionHandle {

	/**
	 * Constructor for ExceptionHandle.
	 */
	public ExceptionHandle() {
		super();
	}
	
	/**
	 * 该方法去掉Exception中的嵌套信息,即“** BEGIN NESTED EXCEPTION **” 
	 * 和“** END NESTED EXCEPTION **”之间的信息。
	 * */
	public static String getMessage(Exception e){
		String errMsg=null;
		String oldMsg=e.getMessage();
		int pos=oldMsg.indexOf("**");
		//System.out.println(oldMsg);
		//System.out.println("pos:"+pos);
		if(pos>=0)	errMsg=oldMsg.substring(0,pos);
		else errMsg=oldMsg;
		return errMsg.trim();
	}
	
	
	public static void main(String[] args) {
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?