?? icexceptionhandler.java
字號:
package com.jysy.taxcore.comm.exception;
import java.util.Properties;
import java.io.InputStream;
import java.io.*;
import java.net.URL;
/**
* 異常信息處理類
*
* <p>Title: ICExceptionHandler</p>
* <p>Description: 南京地稅稅控機IC卡編程接口</p>
* <p>Copyright: Copyright (c) 2004 廣東京粵商用技術(shù)有限公司</p>
* <p>Company: 廣東京粵商用技術(shù)有限公司</p>
* @author 李志毅
* @version 1.0
*/
public class ICExceptionHandler {
/**
* 根據(jù)異常對象,取出異常描述信息
* @param e 異常對象, 封裝了異常信息
* @return 該異常的描述信息
*/
public static String toChinese(String strvalue)
{
try {
if (strvalue == null)
return null;
else {
strvalue = new String(strvalue.getBytes("ISO8859_1"), "GB2312");
return strvalue;
}
}
catch (Exception e) {
return null;
}
}
public static String getErrorMsg(TaxBaseICException e) {
Properties props = new Properties();
String errInfoResources = e.getErrorInfoResources();
InputStream is = null;
try {
String prefix = ".properties";
errInfoResources = errInfoResources.trim();
errInfoResources = errInfoResources.substring(0,
errInfoResources.length() - prefix.length());
errInfoResources = errInfoResources.replace('.', '/');
if (!errInfoResources.startsWith("/")) {
errInfoResources = "/" + errInfoResources;
}
errInfoResources += prefix;
props.load(props.getClass().getResourceAsStream(errInfoResources));
}
catch (Exception ex) {
props = null;
ex.printStackTrace();
}
finally {
try {
if (is != null) {
is.close();
}
}
catch (Exception ex) {}
}
System.out.println(e.getMessage());
String errMsg = null;
if (props == null || (errMsg = toChinese(props.getProperty(e.getMessage()))) == null) {
errMsg = "未知異常!";
}
return errMsg;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -