利用eclipse的调试工具,发现在应用自己的内部对象的时候,报空对象异常,
private static final int LARGE_HASH_CAPACITY = 300;
private static final FAlarmFilterListChanger instance = new FAlarmFilterListChanger();
/*
* 告警过滤规则列表配置
*/
private static Hashtable<Integer,FAlarmFilterList> alarmFilterHash = new Hashtable<Integer,FAlarmFilterList>(LARGE_HASH_CAPACITY); //告警过滤规则整体
private boolean InitialFilterList()
{
boolean isSuccess = true;
try{
/*
* 清除所有的过滤器
*/
FAlarmFilterListChanger.getAlarmFilterHash().clear();
FAlarmFilterListChanger.getAlmLevFilterHash().clear();
FAlarmFilterListChanger.getAlmObjFilterHash().clear();
在调用初始化时总是出错,
想起java类的初始化顺序的问题,修改如下,问题就解决了
private static final int LARGE_HASH_CAPACITY = 300;
/*
* 告警过滤规则列表配置
*/
private static Hashtable<Integer,FAlarmFilterList> alarmFilterHash = new Hashtable<Integer,FAlarmFilterList>(LARGE_HASH_CAPACITY); //告警过滤规则整体
//放在所有static 方法的最后
private static final FAlarmFilterListChanger instance = new FAlarmFilterListChanger();
private boolean InitialFilterList()
{
boolean isSuccess = true;
try{
/*
* 清除所有的过滤器
*/
FAlarmFilterListChanger.getAlarmFilterHash().clear();
FAlarmFilterListChanger.getAlmLevFilterHash().clear();
FAlarmFilterListChanger.getAlmObjFilterHash().clear();