axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nisol.Fab...@hydro.qc.ca
Subject RE : BasicSerializerFactory should trace exceptions
Date Fri, 16 Jan 2004 15:13:44 GMT
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/

Mime
View raw message