geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx GBeanMBeanAttribute.java
Date Sat, 12 Jun 2004 18:37:17 GMT
djencks     2004/06/12 11:37:16

  Modified:    modules/kernel/src/java/org/apache/geronimo/gbean/jmx
                        GBeanMBeanAttribute.java
  Log:
  Provide more informative error messages
  
  Revision  Changes    Path
  1.16      +14 -20    incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanAttribute.java
  
  Index: GBeanMBeanAttribute.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanAttribute.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- GBeanMBeanAttribute.java	4 Jun 2004 22:31:56 -0000	1.15
  +++ GBeanMBeanAttribute.java	12 Jun 2004 18:37:16 -0000	1.16
  @@ -289,7 +289,7 @@
                   persistentValue = getInvoker.invoke(gmbean.getTarget(), null);
               } catch (Throwable throwable) {
                   log.error("Could not get the current value of persistent attribute while
going offline.  The "
  -                        + "persistent attribute will not reflect the current state attribute:
name=" + name, throwable);
  +                        + "persistent attribute will not reflect the current state attribute.
" + getDescription(), throwable);
               }
           }
       }
  @@ -299,14 +299,14 @@
               if (persistent || special) {
                   return persistentValue;
               } else {
  -                throw new IllegalStateException("Only persistent attributes can be accessed
while offline");
  +                throw new IllegalStateException("Only persistent or special attributes
can be accessed while offline. " + getDescription());
               }
           } else {
               if (!readable) {
                   if (persistent) {
  -                    throw new IllegalStateException("This persistent attribute is not accessible
while online");
  +                    throw new IllegalStateException("This persistent attribute is not accessible
while online. " + getDescription());
                   } else {
  -                    throw new IllegalArgumentException("This attribute is not readable");
  +                    throw new IllegalArgumentException("This attribute is not readable.
" + getDescription());
                   }
               }
               try {
  @@ -322,33 +322,23 @@
           if (gmbean.isOffline()) {
               if (persistent || special) {
                   if (value == null && type.isPrimitive()) {
  -                    throw new IllegalArgumentException("Cannot assign null to a primitive
attribute:" +
  -                            " name=" + name +
  -                            ", type=" + type.getName());
  +                    throw new IllegalArgumentException("Cannot assign null to a primitive
attribute. " + getDescription());
                   }
                   // @todo actually check type
                   this.persistentValue = value;
               } else {
  -                throw new IllegalStateException("Only persistent attributes can be modified
while offline:" +
  -                        " name=" + name +
  -                        ", type=" + type.getName());
  +                throw new IllegalStateException("Only persistent attributes can be modified
while offline. " + getDescription());
               }
           } else {
               if (!writable) {
                   if (persistent) {
  -                    throw new IllegalStateException("This persistent attribute is not modifable
while online:" +
  -                            " name=" + name +
  -                            ", type=" + type.getName());
  +                    throw new IllegalStateException("This persistent attribute is not modifable
while online. " + getDescription());
                   } else {
  -                    throw new IllegalArgumentException("This attribute is not writable:"
+
  -                            " name=" + name +
  -                            ", type=" + type.getName());
  +                    throw new IllegalArgumentException("This attribute is not writable.
" + getDescription());
                   }
               }
               if (value == null && type.isPrimitive()) {
  -                throw new IllegalArgumentException("Cannot assign null to a primitive attribute:"
+
  -                        " name=" + name +
  -                        ", type=" + type.getName());
  +                throw new IllegalArgumentException("Cannot assign null to a primitive attribute.
" + getDescription());
               }
               // @todo actually check type
               try {
  @@ -357,6 +347,10 @@
                   throw new ReflectionException(new InvocationTargetException(throwable));
               }
           }
  +    }
  +
  +    private String getDescription() {
  +        return "Attribute Name: " + getName() + ", Type: " + getType() + ", GBean: " +
gmbean.getName();
       }
   
       private static Method searchForGetter(GBeanMBean gMBean, GAttributeInfo attributeInfo,
Class type) throws InvalidConfigurationException {
  
  
  

Mime
View raw message