geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r344267 - /geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
Date Mon, 14 Nov 2005 23:44:07 GMT
Author: djencks
Date: Mon Nov 14 15:44:05 2005
New Revision: 344267

URL: http://svn.apache.org/viewcvs?rev=344267&view=rev
Log:
provide detailed information on missing constructors.

Modified:
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=344267&r1=344266&r2=344267&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
Mon Nov 14 15:44:05 2005
@@ -292,7 +292,28 @@
         try {
             constructor = type.getConstructor(parameterTypes);
         } catch (NoSuchMethodException e) {
-            throw new InvalidConfigurationException("Could not find a valid constructor for
GBean: " + gbeanInfo.getName());
+            StringBuffer buf = new StringBuffer("Could not find a valid constructor for GBean:
").append(gbeanInfo.getName()).append("\n");
+            Constructor[] constructors = type.getConstructors();
+            for (int i = 0; i < constructors.length; i++) {
+                Constructor testConstructor = constructors[i];
+                buf.append("constructor types: " + testConstructor.getParameterTypes() +
"\n");
+                if (testConstructor.getParameterTypes().length == parameterTypes.length)
{
+                    Class[] testParameterTypes = testConstructor.getParameterTypes();
+                    for (int k = 0; k < testParameterTypes.length; k++) {
+                        Class testParameterType = testParameterTypes[k];
+                        if (parameterTypes[k].getName().equals(testParameterType.getName()))
{
+                            if (parameterTypes[k].getClassLoader() != testParameterType.getClassLoader())
{
+                                buf.append("different classloaders in position: ").append(k).append("
class name: ").append(testParameterType.getName()).append("\n");
+                                buf.append("parameter type classloader: ").append(parameterTypes[k].getClassLoader()).append("\n");
+                                buf.append("constructor type classloader: ").append(testParameterType.getClassLoader()).append("\n");
+                            }
+                        } else {
+                            buf.append("different type in position: ").append(k).append("\n");
+                        }
+                    }
+                }
+            }
+            throw new InvalidConfigurationException(buf.toString());
         }
 
         // rebuild the gbean info based on the current attributes, operations, and references
because



Mime
View raw message