You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Ni...@hydro.qc.ca on 2004/01/16 16:13:44 UTC
RE : BasicSerializerFactory should trace exceptions
Ok, next time I'll post a bug report
Thanks!
-----Message d'origine-----
De : Davanum Srinivas [mailto:dims@yahoo.com]
Envoyé : 16 janvier, 2004 10:07
À : axis-dev@ws.apache.org
Objet : Re: BasicSerializerFactory should trace exceptions
Done. Thanks. Next time, please log a bug so that we don't lose this
request.
-- dims
--- Nisol.Fabien@hydro.qc.ca wrote:
> Sorry, I forgot a subject in last email
>
> There is a minor but anoying problem in BaseSerializerFactory.
>
> in createFactory method, all try{} catch{} blocks totally ignores
> every exception that can occurs. This can lead to an unpredictable and
> hard to understand "Null serializer factory specified" in
> TypeMappingImpl.register(...) calls
>
>
>
> try {
> Method method =
> factory.getMethod("create", CLASS_QNAME_CLASS);
> sf = (SerializerFactory)
> method.invoke(null,
> new Object[] {javaType, xmlType});
> } catch (NoSuchMethodException e) {
> } catch (IllegalAccessException e) {
> } catch (InvocationTargetException e) {}
>
> All these exception should be traced so it is possible for user to
> know why axis refuses to use his home made factory. We had the problem
> here, using the Castor (de)serializer . Adding a trace like below gave
> us immediately a clue as a java.lang.NoClassDefFoundError:
> org/exolab/castor/xml/ValidationException (meaning that our classpath
> was not correct and did not include castor classes)
>
>
> try {
> Method method =
> factory.getMethod("create", CLASS_QNAME_CLASS);
> sf = (SerializerFactory)
> method.invoke(null,
> new Object[] {javaType, xmlType});
> } catch (NoSuchMethodException e) {
> } catch (IllegalAccessException e) {
> } catch (InvocationTargetException e) {
> throw new RuntimeException(e);
> }
>
> I'm not really sure why the InvocationTargetException is trapped like
> this in this class.
> -the create method is found with the correct signature (no
> NoSuchMethodException thrown)
> -the method is accessible (no IllegalAccessException thrown)
> -but it throws an exception (via the InvocationTargetException)...
> So it is simply there but is not working as it should
>
> For me, there should be a trace at least in debug mode like this, and
> in every catch blocks:
>
> protected static Log log =
> LogFactory.getLog(BaseSerializerFactory.class.getName());
>
>
> try {
> Method method =
> factory.getMethod("create", CLASS_QNAME_CLASS);
> sf = (SerializerFactory)
> method.invoke(null,
> new Object[] {javaType, xmlType});
> } catch (NoSuchMethodException e) {
> } catch (IllegalAccessException e) {
> } catch (InvocationTargetException e) {
> if(LOG.isDebugEnabled()) LOG.debug(e,e);
> }
> or better, the InvocationTargetException should be trapped and throw
> an exception like we did to detect the problem (throw new
> RuntimeException(e) or throw new RuntimeException(e.getMessage())
>
> All this to ease developper work in debugging axis with this kind of
> problem...
>
>
>
>
=====
Davanum Srinivas - http://webservices.apache.org/~dims/