[jboss-cvs] JBossAS SVN: r76472 - projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/attachments/helpers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 30 10:32:39 EDT 2008


Author: alesj
Date: 2008-07-30 10:32:39 -0400 (Wed, 30 Jul 2008)
New Revision: 76472

Modified:
   projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/attachments/helpers/AbstractMutableAttachments.java
Log:
Better error msg.

Modified: projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/attachments/helpers/AbstractMutableAttachments.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/attachments/helpers/AbstractMutableAttachments.java	2008-07-30 14:04:41 UTC (rev 76471)
+++ projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/attachments/helpers/AbstractMutableAttachments.java	2008-07-30 14:32:39 UTC (rev 76472)
@@ -44,6 +44,8 @@
       Object result = addAttachment(name, attachment);
       if (result == null)
          return null;
+      if (expectedType.isInstance(result) == false)
+         throw new IllegalArgumentException("Previous attachment not of the same type: expected=" + expectedType + ", previous=" + result);
       return expectedType.cast(result);
    }
 
@@ -72,6 +74,8 @@
       Object result = removeAttachment(name);
       if (result == null)
          return null;
+      if (expectedType.isInstance(result) == false)
+         throw new IllegalArgumentException("Removed attachment not of the same type: expected=" + expectedType + ", previous=" + result);      
       return expectedType.cast(result);
    }
 




More information about the jboss-cvs-commits mailing list