You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/05/14 00:14:33 UTC

svn commit: r406155 - in /geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean: GBeanData.java GBeanInfo.java

Author: djencks
Date: Sat May 13 15:14:33 2006
New Revision: 406155

URL: http://svn.apache.org/viewcvs?rev=406155&view=rev
Log:
slightly more informative exceptions

Modified:
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java?rev=406155&r1=406154&r2=406155&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java Sat May 13 15:14:33 2006
@@ -73,13 +73,14 @@
     public GBeanInfo getGBeanInfo() {
         return gbeanInfo;
     }
-    
-    public void clearAttribute(String name){
+
+    public void clearAttribute(String name) {
         attributes.remove(name);
     }
-    public void clearReference(String name){
+
+    public void clearReference(String name) {
         references.remove(name);
-    }  
+    }
 
     public void setGBeanInfo(GBeanInfo gbeanInfo) {
         this.gbeanInfo = gbeanInfo;
@@ -224,13 +225,19 @@
         }
 
 
-
         try {
             // read the attributes
             int attributeCount = in.readInt();
             for (int i = 0; i < attributeCount; i++) {
                 String attributeName = (String) in.readObject();
-                Object attributeValue = in.readObject();
+                Object attributeValue = null;
+                try {
+                    attributeValue = in.readObject();
+                } catch (ClassNotFoundException e) {
+                    throw new ClassNotFoundException("Unable to find class used in GBeanData " + abstractName + ", attribute: " + attributeName, e);
+                } catch (IOException e) {
+                    throw (IOException) new IOException("Unable to deserialize GBeanData " + abstractName + ", attribute: " + attributeName).initCause(e);
+                }
                 setAttribute(attributeName, attributeValue);
             }
 
@@ -238,7 +245,14 @@
             int endpointCount = in.readInt();
             for (int i = 0; i < endpointCount; i++) {
                 String referenceName = (String) in.readObject();
-                ReferencePatterns referencePattern = (ReferencePatterns) in.readObject();
+                ReferencePatterns referencePattern;
+                try {
+                    referencePattern = (ReferencePatterns) in.readObject();
+                } catch (ClassNotFoundException e) {
+                    throw new ClassNotFoundException("Unable to find class used in GBeanData " + abstractName + ", reference: " + referenceName, e);
+                } catch (IOException e) {
+                    throw (IOException) new IOException("Unable to deserialize GBeanData " + abstractName + ", reference: " + referenceName).initCause(e);
+                }
                 setReferencePatterns(referenceName, referencePattern);
             }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java?rev=406155&r1=406154&r2=406155&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java Sat May 13 15:14:33 2006
@@ -43,10 +43,11 @@
     /**
      * Static helper to try to get the GBeanInfo from the class supplied.
      *
-     * @param className name of the class to get the GBeanInfo from
+     * @param className   name of the class to get the GBeanInfo from
      * @param classLoader the class loader use to load the specifiec class
      * @return GBeanInfo generated by supplied class
-     * @throws org.apache.geronimo.gbean.InvalidConfigurationException if there is a problem getting the GBeanInfo from the class
+     * @throws InvalidConfigurationException
+     *          if there is a problem getting the GBeanInfo from the class
      */
     public static GBeanInfo getGBeanInfo(String className, ClassLoader classLoader) throws InvalidConfigurationException {
         Class clazz;
@@ -54,12 +55,16 @@
             clazz = classLoader.loadClass(className);
         } catch (ClassNotFoundException e) {
             throw new InvalidConfigurationException("Could not load class " + className, e);
+        } catch (NoClassDefFoundError e) {
+            throw new InvalidConfigurationException("Could not load class " + className, e);
         }
         Method method;
         try {
             method = clazz.getDeclaredMethod("getGBeanInfo", new Class[]{});
         } catch (NoSuchMethodException e) {
             throw new InvalidConfigurationException("Class does not have a getGBeanInfo() method: " + className);
+        } catch (NoClassDefFoundError e) {
+            throw new InvalidConfigurationException("Could not find getGBeanInfo method on " + className, e);
         }
         try {
             return (GBeanInfo) method.invoke(clazz, new Object[]{});
@@ -167,6 +172,7 @@
     /**
      * Gets the source class from which this GBeanInfo can be retrieved using GBeanInfo.getGBeanInfo(className, classLoader).
      * A null source class means the gbean info was dynamically generated.
+     *
      * @return the source of this GBeanInfo, or null if it was dynamically generated
      */
     public String getSourceClass() {
@@ -193,7 +199,7 @@
     public GAttributeInfo getAttribute(String name) {
         return (GAttributeInfo) attributesByName.get(name);
     }
-    
+
     /**
      * Returns a Set where the elements are type GAttributeInfo
      */