LazyDynaBean doesn't accept null value assignments for certain properties -------------------------------------------------------------------------
Key: BEANUTILS-342 URL: https://issues.apache.org/jira/browse/BEANUTILS-342 Project: Commons BeanUtils Issue Type: Bug Affects Versions: 1.8.0 Environment: Ubuntu Linux (Gutsy), Sun Java 1.6 Reporter: Andras Soltesz With certain object types, LazyDynaBean doesn't accept null assignments correctly. Even if I set the null value (which is accepted without an error), when I query the property, I get a non-null value. It works correctly if I do the following: - assign a null value to the property - assign a real object value (non-null) - assign a null value again (this time it is accepted correctly) A small test script which demonstrates the issue: --------------------------- LazyDynaBean bean = new LazyDynaBean(); Object value; System.out.println("----------------------------"); bean.set("prop3", new Agent()); value = bean.get("prop3"); System.out.println("Prop3 value (should be an Agent): " + value); bean.set("prop3", null); value = bean.get("prop3"); System.out.println("Prop3 value (should be null): " + value); System.out.println("----------------------------"); bean.set("prop4", null); value = bean.get("prop4"); System.out.println("Prop4 value (should be null): " + value); bean.set("prop4", new Agent()); value = bean.get("prop4"); System.out.println("Prop4 value (should be an Agent): " + value); bean.set("prop4", null); value = bean.get("prop4"); System.out.println("Prop4 value (should be null): " + value); -------------------- I can't imagine that this is desired behaviour. As a temporary workaround, I have created a sublclass of LazyDynaBean with set() overridden, so it always sets a null before it sets a real value. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.