Mantis - Hessian
Viewing Issue Advanced Details
4320 minor always 12-08-10 01:44 12-08-10 01:47
ccampo  
 
normal  
new 3.2.0  
open  
none    
none  
0004320: Catching ClassNotFoundException and continue in SerializerFactory
I recently fell over a piece of code in the SerializerFactory that looks like this

try {
        Class cl = Class.forName(type, false, loader);
        derserializer = getDeserializer(cl);
    } catch (Exception e) {
       log.warning("Hessian/Burlap: '" + type + "' is an unknown class in " + loader +":\n" + e);
       log.log(LEVEL.FINER, e.toString(), e);
       }

I am a little puzzeled about this piece of code. So a class cannot be found and the code prints out a log and continues as if nothing happens so it'll be only harder to find 3 steps later when interpreting the hessian protocol will fail with some other exception ?

Who would do something like this ?

Wouldnt it be way better and really the only way to deal with this, to pack the Exception into a RuntimeException that you throw ?

This problem is also in version 4.0.7 (the current one)

Notes
(0004867)
ccampo   
12-08-10 01:47   
I believe the code should be replaced with

try {
        Class cl = Class.forName(type, false, loader);
        derserializer = getDeserializer(cl);
    } catch (Exception e) {
                 throw new HessianRuntimeException("Hessian/Burlap: '" + type + "' is an unknown class in " + loader, e);
}