for(Tuple<Short,String> tuple: mapping) {
short m=tuple.getVal1();
try {
Class clazz=Util.loadClass(tuple.getVal2(), ClassConfigurator.class);
if(magicMap.containsKey(m))
throw new ChannelException("key " + m + " (" + clazz.getName() + ')' +
" is already in magic map; please make sure that all keys are unique");
magicMap.put(m, clazz);
classMap.put(clazz, m);
}
catch(ClassNotFoundException cnf) {
throw new ChannelException("failed loading class", cnf);
}
}
// Read jg-protocol-ids.xml
mapping=readMappings(protocol_id_file);
for(Tuple<Short,String> tuple: mapping) {
short m=tuple.getVal1();
try {
Class clazz=Util.loadClass(tuple.getVal2(), ClassConfigurator.class);
if(protocol_ids.containsKey(clazz))
throw new ChannelException("ID " + m + " (" + clazz.getName() + ')' +
" is already in protocol-ID map; please make sure that all protocol IDs are unique");
protocol_ids.put(clazz, m);
protocol_names.put(m, clazz);
}
catch(ClassNotFoundException cnf) {
throw new ChannelException("failed loading class", cnf);
}
}
}
catch(ChannelException ex) {
throw ex;
}
catch(Throwable x) {
throw new ChannelException("failed reading the magic number mapping file", x);
}
}