[hibernate-commits] Hibernate SVN: r11405 - branches/Branch_3_2/Hibernate3/src/org/hibernate/property.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Sun Apr 15 08:50:34 EDT 2007


Author: max.andersen at jboss.com
Date: 2007-04-15 08:50:34 -0400 (Sun, 15 Apr 2007)
New Revision: 11405

Modified:
   branches/Branch_3_2/Hibernate3/src/org/hibernate/property/DirectPropertyAccessor.java
Log:
align null assignment exception when access=field with access=property

Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/property/DirectPropertyAccessor.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/property/DirectPropertyAccessor.java	2007-04-13 14:29:43 UTC (rev 11404)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/property/DirectPropertyAccessor.java	2007-04-15 12:50:34 UTC (rev 11405)
@@ -79,7 +79,17 @@
 				field.set(target, value);
 			}
 			catch (Exception e) {
-				throw new PropertyAccessException(e, "could not set a field value by reflection", true, clazz, name);
+				if(value == null && field.getType().isPrimitive()) {
+					throw new PropertyAccessException(
+							e, 
+							"Null value was assigned to a property of primitive type", 
+							true, 
+							clazz, 
+							name
+						);					
+				} else {
+					throw new PropertyAccessException(e, "could not set a field value by reflection", true, clazz, name);
+				}
 			}
 		}
 




More information about the hibernate-commits mailing list