On Friday 03 May 2002 06:24, Dain Sundstrom wrote: > In org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory I > have a method (convertToJavaClass) that does the name to array class > conversion. Here is the core: > > int arraySize = 0; > while(name.endsWith("[]")) { > name = name.substring(0, name.length()-2); > arraySize++; > } > > try { > // get the base class > Class c = entity.getClassLoader().loadClass(name); > > // if we have an array get the array class > if(arraySize > 0) { > int[] dimensions = new int[arraySize]; > for(int i=0; i<arraySize; i++) { > dimensions[i]=1; > } > c = Array.newInstance(c, dimensions).getClass(); > } > > return c; > } catch(ClassNotFoundException e) { > throw new DeploymentException("Parameter class not found: " + name); > } >
I think this won't work in SpyObjectMessage. It uses java.io.ObjectStreamClass.getName() to obtain the class name. When I came across this problem in SpyObjectMessage, I remember that the debugging output I inserted printed out the name of the class in the form as documented in the Class.getName() method: new Object[1][1][1].getClass().getName() would be something like that: "[[[Ljava.lang.Object;" While Dain's method might serve it's purpose in his code, I think it won't work in SpyObjectMessage directly. It must be changed to acomodate this syntax. Give me some time and I'll try to write a surogate Clazz.forName(className, classLoader) method that would take into account all possible types (including primitives and their arrays) as suggested by Dr. Christoph Jung. Regards, Peter _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development