for(int i=0; i < mapping.length; i++) {
m=new Short(mapping[i].getMagicNumber());
try {
Class clazz=mapping[i].getClassForMap();
if(magicMap.containsKey(m)) {
throw new ChannelException("magic key " + m + " (" + clazz.getName() + ')' +
" is already in map; please make sure that " +
"all magic keys are unique");
}
else {
magicMap.put(m, clazz);
classMap.put(clazz, m);
}
}
catch(ClassNotFoundException cnf) {
throw new ChannelException("failed loading class", cnf);
}
}
if(log.isDebugEnabled()) log.debug("mapping is:\n" + printMagicMap());
}
}
catch(ChannelException ex) {
throw ex;
}
catch(Throwable x) {
throw new ChannelException("failed reading the magic number mapping file", x);
}
}