Author: max.andersen(a)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 + "'");
}
}
}
Show replies by date