[hibernate-commits] Hibernate SVN: r11412 - in trunk/Hibernate3/src/org/hibernate: transaction and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Apr 17 10:38:51 EDT 2007


Author: max.andersen at jboss.com
Date: 2007-04-17 10:38:51 -0400 (Tue, 17 Apr 2007)
New Revision: 11412

Modified:
   trunk/Hibernate3/src/org/hibernate/property/DirectPropertyAccessor.java
   trunk/Hibernate3/src/org/hibernate/transaction/TransactionManagerLookupFactory.java
Log:
add context to exception
align null assignment exception when access=field with access=property

merged from 3.2 branch.

Modified: trunk/Hibernate3/src/org/hibernate/property/DirectPropertyAccessor.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/property/DirectPropertyAccessor.java	2007-04-17 07:32:39 UTC (rev 11411)
+++ trunk/Hibernate3/src/org/hibernate/property/DirectPropertyAccessor.java	2007-04-17 14:38:51 UTC (rev 11412)
@@ -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);
+				}
 			}
 		}
 

Modified: trunk/Hibernate3/src/org/hibernate/transaction/TransactionManagerLookupFactory.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/transaction/TransactionManagerLookupFactory.java	2007-04-17 07:32:39 UTC (rev 11411)
+++ trunk/Hibernate3/src/org/hibernate/transaction/TransactionManagerLookupFactory.java	2007-04-17 14:38:51 UTC (rev 11412)
@@ -44,7 +44,7 @@
 			}
 			catch (Exception e) {
 				log.error("Could not instantiate TransactionManagerLookup", e);
-				throw new HibernateException("Could not instantiate TransactionManagerLookup");
+				throw new HibernateException("Could not instantiate TransactionManagerLookup '" + tmLookupClass + "'");
 			}
 		}
 	}




More information about the hibernate-commits mailing list