This one time, at band camp, Werner Guttmann said:

WG>On Thu, 15 Apr 2004 11:52:49 +0200, Werner Guttmann wrote:
WG>
WG>>
WG>>On Tue, 13 Apr 2004 08:23:33 -0600 (MDT), Bruce Snyder wrote:
WG>>
WG>>>
WG>>>This one time, at band camp, Werner Guttmann said:
WG>>>
WG>>>WG>after a litztle bit of debugging, I've traced this exception to the following 
code fragementin Types.java:
WG>>>WG>
WG>>>WG>    public static Class typeFromName( ClassLoader loader, String typeName )
WG>>>WG>        throws ClassNotFoundException
WG>>>WG>    {
WG>>>WG>        for ( int i = 0 ; i < _typeInfos.length ; ++i ) {
WG>>>WG>            if ( typeName.equals( _typeInfos[ i ].shortName ) )
WG>>>WG>                return ( _typeInfos[ i ].primitive != null ? _typeInfos[ i 
].primitive :
WG>>>WG>                         _typeInfos[ i ].javaType );
WG>>>WG>        }
WG>>>WG>        if ( loader != null )
WG>>>WG>            return loader.loadClass( typeName );
WG>>>WG>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
WG>>>WG>        else
WG>>>WG>            return Class.forName( typeName );
WG>>>WG>
WG>>>WG>The exception occurs at the line marked with '°'. Any idea why ? 
'org.exolab.castor.types.Duration' is on the classpath, afai can tell.
WG>>>
WG>>>I'm not sure why this is happening. I would suggest breaking the
WG>>>line apart into the following for debugging:
WG>>>
WG>>>    Class clazz = loader.laodClass( typeName );
WG>>>    _log.debug( "Loading class" + clazz.getName() );
WG>>>    return clazz;
WG>>
WG>>That does not really help, either. It's the call to loader.loadClass() that throws 
the ClassNotFoundException. Question: is Duration meant to be a
WG>'simple'
WG>>type, as enlisted in Types.java through the static array typesInfo (of type 
TypeInfo[]) ? Iow, should there be an entry similar to
WG>>
WG>>        new TypeInfo( "string", null, java.lang.String.class,     true,     null ),
WG>>
WG>>Werner
WG>
WG>Sorry, but I just figured out that above is not the problem anymore. Iow, the code 
progresses past this very problem of loading the class. I am not getting
WG>a new MappingException in DatingService.resolve() where
WG>
WG>        if ( needFieldClass != null ) {
WG>            e = needFieldClass.elements();
WG>            while ( e.hasMoreElements() ) {
WG>                Pair pair = (Pair)e.nextElement();
WG>                initiateFm = (FieldMolder) pair.value;
WG>                targetCm = (ClassMolder) clsMolders.get( pair.key );
WG>                if ( targetCm == null )
WG>                    throw new MappingException("Field element, \""+pair.key+"\"  
not found!");
WG>                initiateFm.setFieldClassMolder( targetCm );
WG>            }
WG>        }
WG>
WG>obviously a MappingException is thrown if a ClassMolder cannot be found for the 
Duration type. Which brings me again to my last question. Should
WG>Duration be included as simple type ?

I think you're correct here, Werner. Which leads to an even larger
question. If we're going to support Duration, we should support all
the other org.exolab.castor.types which means we need to create a
general mechism to handle the instantiation of all of these types.
Do you agree?

Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

The Castor Project
http://www.castor.org/

Apache Geronimo
http://incubator.apache.org/projects/geronimo.html

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to