Campo, Christian wrote: > Hi, > > 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 ? >
That's not a general code pattern; it's an issue with Hessian managing the mapping between Java and scripting languages. Hessian mostly tries to be forgiving for type/field changes. A PHP client, for example, can read a Hessian response even if it doesn't understand the Java class. In that case, the behavior is sensible. The corresponding Java behavior is a bit more questionable. If a PHP client is sending data to a Java server, the Java server should try to understand the Hessian even though PHP isn't a typed system. But a Java to Java system would generally want to check the types, which is the issue you're bringing up. In other words, that behavior is an artifact of the loose script to Java/compiled language mapping for Hessian. -- Scott > Wouldnt it be way better and really the only way to deal with this, to pack > the Exception into a RuntimeException that you throw ? I think there a more > places in Hessian where Exceptions are caught and not passed on but this one > really really bothers me. > > What do others think about this ? > > thanks > > christian campo > ------------------------------------------------------------- > compeople AG > Untermainanlage 8 > 60329 Frankfurt/Main > fon: +49 (0) 69 / 27 22 18 0 > fax: +49 (0) 69 / 27 22 18 22 > web: http://www.compeople.de/ > > Vorstand: Jürgen Wiesmaier > Aufsichtsratsvorsitzender: Christian Glanz > > Sitz der Gesellschaft: Frankfurt/Main > Handelsregister Frankfurt HRB 56759 > Ust-Ident.-Nr: DE207665352 > ------------------------------------------------------------- > > > > _______________________________________________ > hessian-interest mailing list > hessian-interest@caucho.com > http://maillist.caucho.com/mailman/listinfo/hessian-interest > > _______________________________________________ hessian-interest mailing list hessian-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/hessian-interest