Improve error handing in DataConnectorFactoryBean

Description

Following introspection by Spring, PropertyDescriptor.getWriteMethod() may return null, resulting in an NPE when getWriteMethod().invoke() is called.

An Exception should result anyway and the AttributeResolver should refuse to start, but it's probably an improvement nice to catch the NPE.

Environment

None

Activity

Rod Widdowson September 2, 2016 at 12:14 PM

Interestingly this has flushed an important drawback with the springResources thing. You cannot (easily) expect a map to be populated, because a bare parsed context always contains a map called "systemProperties" and a map called "systemEnvironment". In the case in point the bean in question contained a setter (only) for a list and a getter (only) for a map (with different names).

It was the getter-only which tripped this problem because the broken code as trying to assign systemProperties to it using the non-existant setter method.

Rod Widdowson September 1, 2016 at 4:17 PM

Fixed and test added as 8363.

Basically if somethign doesn't have a setter you shouldn't be calling it.

Fixed

Details

Assignee

Reporter

Affects versions

Created August 31, 2016 at 3:22 PM
Updated October 10, 2018 at 2:01 PM
Resolved September 1, 2016 at 4:17 PM