{
long startTime = System.currentTimeMillis();
ipFilterAutoLoader.loadOtherFilters(allowAsyncDownloading, loadOldWhileAsyncDownloading);
if (getNbRanges() > 0) {
Logger.log(new LogEvent(LOGID, (System.currentTimeMillis() - startTime)
+ "ms for " + getNbRanges() + ". now loading norm"));
}
try{
class_mon.enter();
List new_ipRanges = new ArrayList(1024);
FileInputStream fin = null;
BufferedInputStream bin = null;
try {
//open the file
File filtersFile = FileUtil.getUserFile("filters.config");
if (filtersFile.exists()) {
fin = new FileInputStream(filtersFile);
bin = new BufferedInputStream(fin, 16384);
Map map = BDecoder.decode(bin);
List list = (List) map.get("ranges");
Iterator iter = list.listIterator();
while(iter.hasNext()) {
Map range = (Map) iter.next();
String description = new String((byte[])range.get("description"), "UTF-8");
String startIp = new String((byte[])range.get("start"));
String endIp = new String((byte[])range.get("end"));
IpRangeImpl ipRange = new IpRangeImpl(description,startIp,endIp,false);
ipRange.setAddedToRangeList(true);
new_ipRanges.add( ipRange );
}
}
}finally{
if ( bin != null ){
try{
bin.close();
}catch( Throwable e ){
}
}
if ( fin != null ){
try{
fin.close();
}catch( Throwable e ){
}
}
Iterator it = new_ipRanges.iterator();
while( it.hasNext()){
((IpRange)it.next()).checkValid();
}
markAsUpToDate();
}
}finally{
class_mon.exit();
}
Logger.log(new LogEvent(LOGID, (System.currentTimeMillis() - startTime)
+ "ms to load all IP Filters"));
}