日期:2014-05-20  浏览次数:20772 次

有没有什么配置在调用一个类方法的同时调用另一个方法
package com.lc.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.Clob;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.Hashtable;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

@SuppressWarnings("unchecked")
public class SystemFun {

public static Log log = LogFactory.getLog(SystemFun.class);

public static String logError(Throwable e) {
StackTraceElement[] stack = e.getStackTrace();
StringBuffer msg = new StringBuffer();
msg.append(e.getMessage());
for (int i = 0; i < stack.length; i++) {
String temp = stack[i].getClassName();
if ((temp.indexOf("com.lc.") >= 0) ||(temp.indexOf("sytjad.") >= 0)|| (temp.indexOf("_jsp") >= 0)) {
msg.append("\n\tat ").append(stack[i].getClassName()).append(
".").append(stack[i].getMethodName()).append("(")
.append(stack[i].getFileName()).append(":").append(
stack[i].getLineNumber()).append(")");
}
}

log.error(msg.toString());
// return msg.toString();
return e.getMessage();
}


private static ArrayList getParaValue(String paraname, int timecount) {
ArrayList result = new ArrayList();
String defulat[] = { "", "" };
if ((paraname == null) || (paraname.trim().equals(""))) {
result.add(defulat);
} else
try {

Hashtable para = (Hashtable) SystemFun.paraData.get("para");
Enumeration paraKeys = para.keys();
while (paraKeys.hasMoreElements()) {
String paras[] = new String[2];
paras[0] = (String) paraKeys.nextElement();
if (paras[0].startsWith(paraname)) {
paras[1] = (String) para.get(paras[0]);
result.add(paras);
}
}
} catch (Exception e) {
if (timecount > 0) {
SystemFun.logError(e);
result.add(defulat);
}
}
if ((result.size() == 0) && (timecount == 0))
result = reload("0", paraname, "");
sortArrayList(result);
result.add(defulat);
return result;
}


public static double getFileMaxSize = 10;
}
我自定义throw new 一个错误然后用拦截器拦截在我调用SystemFun.logError 系统先自动调用SystemFun.getParaValue
这是为什么呀我都要疯了!!!

------解决方案--------------------
调用的地方贴出来看看